Skip to content

Writing portable applications in EM

If you've made it this far, let's hit the ground running and starting coding !!!   This document will first familiarize you with the mechanics of viewing, editing, building, and loading EM programs and their constituent units using the EM Builder extension for VS Code. If you haven't worked with VS Code, the web abounds with tutorials + references for this ever-popular IDE.

The main portion of this document comprises a series of tours that visit some basic programming examples – curated to introduce elements of the EM runtime environment, as well as to reinforce common coding idioms of the EM language(1). To support these documentation resources, EM Builder includes a "tour guide" utility that walks you through this material in a somewhat specialized fashion.

  1. consult Language Syntax as a reference

If you've chosen to bypass Installing EM for now, a quick read through this document would still have benefit – even if you can't execute real software on real hardware.

If you have elected to install EM Builder – but haven't received your hardware or else prefer the ** FAST-TRACK ** option – you can still build the programs featured in any of the tours. Until your board arrives and you can actually load these programs, studying the logic capture(s) associated with each example should help bridge the gap.

These captures in fact reveal subtle timing details otherwise invisible to the naked eye.

We've generated all of the captures presented later in this document using a Saleae Logic Analyzer – in our opinion, the single most valuable tool for "debugging" real-time embedded software running on target MCU hardware. At a minimum, you should download the (free) Saleae Logic 2 software and explore these logic capture files off-line.

If you can't see the problem, you can't fix it !!!

Software debuggers have traditionally focused upon a rich presentation of program state (variables, call stacks, peripherals) – but only after program execution halts (say) upon reaching a breakpoint. Given the general nature of embedded software, however, a dynamic presentation depicting state-changes over time proves far more helpful for troubleshooting real-world problems.

While modern debuggers attempt to address this need, they often do so by introducing significant amounts of hardware / software overhead – limiting their utility to software development rather than system deployment. These approaches may also preclude the underlying MCU from entering its "deep-sleep" mode – a serious limitation that can obscure real-world, real-time wakeup issues.

But armed with no more than a basic logic analyzer, the EM language provides intrinsic "real-time debug" capabilities that enable us to dynamically capture program state without incurring excessive program overhead. In the spirit of "test what you fly, fly what you test", these capabilities prove equally valuable during development in the factory and well as during deployment in the field.

At the same time, we also want you to experience the joy of blinking LEDs !!!   With that, let's first skill-up on EM Builder and then tour the EM runtime

When finished, circle back to Learning more EM and plan your next adventure.