Using eLua with the LM3S (Cortex-M3) CPUs from Luminary Micro

Luminary Micro is the company that produced the world's first silicon implementation of the Cortex-M3 processor. Their device portfolio is quite impressive, ranging from relatively simple devices to full-featured CPUs (with on-chip USB, EMAC, CAN, and many other peripherals). The support package for these devices is also very good, with drivers for all the CPU peripherals and ports of 3rd party applications. And, on a personal note, I contacted Luminary Micro some while ago with a request to support this project with one of their evaluation kits, and their response was excellent (thanks again, Luminary!). That's how a EKx-LM3S8962K landed on my desk. This is the development board that I'm going to use in this tutorial. eLua also supports the EKx-LM3S6965 board from Luminary (which can be programmed exactly like the EKx-LM3S8962) and the Eagle 100 board from Micromint, which uses a different installation procedure.


Before you'll be able to use eLua on the LM3S CPU, make sure that:

Installing eLua on EKx-LM3S8962EK and EKx-LM3S6965

Fortunately, this is as easy and painless as possible. One of the nicest things about these two kits is they use the on-board USB port for both firmware downloading and for emulating a serial port (via a hardware USB to UART converter, so you don't need any special software on the CPU to access this UART port). Moreover, it automagically knows how (and when) to switch from the firmware download mode to the UART emulation mode, so you don't need to move jumpers around or anything like this. It's zero effort firmware upgrading at its best. So, let's do it:

It's worth to mention that since these boards come with an USB to JTAG converter it should be possible to use OpenOCD (or a similar package) instead of the Luminary tool to program the image. The Luminary Micro forums are a good place to look for information if you're exploring the OpenOCD option.

Installing eLua on Eagle 100

The Eagle 100 board can also be programmed via JTAG, but it doesn't include an on-board USB to JTAG adapter, so you'd need an external adapter if you want to use JTAG for programming. Fortunately, it also comes with an Ethernet bootloader, so you can upload your image via Ethernet. The only requirement to use the bootloader is to start your image at address 0x2000 instead of the usual 0x0, since that's where the bootloader jumps. The eLua build system does this automatically if the "board=eagle-100" parameter is given at build time.
For a full description of the Ethernet bootloader consult the Eagle 100 board manual, (look for section 2.7, Firmware Updates using the Ethernet Bootloader).
You still need the LM Flash Tool to use the Ethernet bootloader, but since the board can use JTAG for firmware uploading, it should be possible to use it with OpenOCD (or a similar package) and an external USB to JTAG adapter. The Luminary Micro forums are a good place to look for information if you're exploring the OpenOCD option.