eLua on LM3S CPUs

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. 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 LM3S8962-EK landed on my desk. This is the development board that I'm going to use in this tutorial (of course you might still try this if you have a different LM3S8962 board).

Luminary Micro has recently included eLua in their Third Party Products page !

NOTE: Starting with version 0.3, eLua has support for the LM3S8962 and LM3S6965 MCUs. All the instructions in this tutorial are applicable to the EK-LM3S6965 with minimal changes.

Prerequisites

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

  • you're using Windows. Yes, I really said Windows. The reason is quite simple: we're going to use Luminary's tools to burn eLua to the EK, and they're Windows specific. This is the case with many CPUs and vendors out there, so get used to the idea. You can have Windows installed on your HDD, or under an emulator in Linux, it doesn't matter, you can even try to run it from Wine if you're really, really brave. I'm using XP, Vista should work too. We've been sucessfully using a Windows XP Virtual Machine, under VMWare, in an Ubuntu Linux host.
  • you have installed the LM Flash Programmer tool from Luminary. Look for it on this page, for example (the link is in the "Software updates" table).
  • you already built your eLua image for the LM3S8962 CPU. Simply put, this means that you have a GCC toolchain for Cortex-M3, and that you used it to build eLua (remember to specify "prog" on the scons command line to get a .bin file that's suitable for programming). Or follow the instructions from the download page and download a precompiled binary image.

Burning eLua on the LM3S8962-EK

Fortunately, this is as easy and painless as possible. One of the nicest things about the LM3S8962-EK is that it uses 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:

  • connect your board to your PC using a suitable USB cable. If you didn't install the board drivers yet, you'll be asked to install them now.
  • if you're already using the USB connection on the board in the UART emulation mode, close your terminal program (or at least disconnect it from the USB COM port).
  • fire up the "Luminary Micro Flash Programmer" application.
  • in the "Configuration" tab, select "LM3S8962 Ethernet and CAN Evaluation board".
  • in the "Program" tab, select the eLua .bin file that you got from the compilation step.
  • select the "Options" as you like (I generally choose "Erase entire flash" and Reset MCU after program").
  • hit the "Program" button.
  • wait until programming is over, then exit the flash programmer application.

That's it! eLua is now programmed in the CPU, so you can start your terminal emulator and enjoy it, as described in using eLua. If you have any problems with this procedure, feel free to contact us. Although, if you know how to burn the image from Linux, please let me know and I'll include the instructions in this page. Since the on-board programming interface in still JTAG, this can surely be done with a JTAG tool like OpenOCD, but we don't know much about such tools.

Powered by Sputnik