Introducing Lua

A project log for Screvle - Lua Web IDE

ARM Cortex-M4 with browser-based Lua Development Environment. Provides an ideal software and hardware platform for your next project.

Ronald VanschorenRonald Vanschoren 08/17/2014 at 16:160 Comments

While the Screvle firmware and hardware platform is very useful as a starting point to create the next tool/project, it remains an embedded system which requires some expertise and experience to use. For someone to start developing Screvle firmware you need to install an IDE, cross-compiler, JTAG/Flash utility, some drivers,... This was too cumbersome for quick proof of concepts and hacks. Ideally, Screvle would support "apps" that can be dynamically installed and executed.

By introducing Lua to the platform, I could do that (and more). Lua is an (under appreciated) scripting language written completely in C and designed to be embedded in other applications. Lua has little RAM and ROM requirements and the available Lua API can be easily extended to provide more functionality.

What followed next was a huge porting effort, making the C API I had created previously available to Lua. This includes the microGraphics Framework, Settings Framework, Peripheral Framework and many more. It is now possible to dynamically run Lua scripts stored on the SD-card. This means there is no longer a need to change the actual microcontroller firmware, so you no longer need a cross-compiler or JTAG/Flash utilities. The only things needed is a text-editor to write the Lua script, put it on the SD card and execute it from there.

Wait a minute... a scripting language on an embedded system... are you sure? Yes. Screvle hardware is many times more powerful platforms that are often used by the community (read: Arduino's) and some modifications were made to the Lua runtime to further reduce the overhead. Some of these modifications were originally developed by the eLua project ( ).

 - Support for read-only tables that can be stored in Flash

 - Use 32-bit signed integers instead of double precision floating point numbers

 - Emergency garbage collector

How could this be made even easier? By using the build-in Lua Development Environment explained in the next project log.