Two pieces of software are factory-programmed into the Mizar32's flash memory:
- The tiny (8KB) USB DFU bootloader
- The eLua interpreter
The DFU bootloader
When the Mizar32 powers on or when its Reset button is pressed, the DFU bootloader is the first program that it runs. This checks if the user button is pressed and, if it is, allows you to update the rest of the firmware from your PC.
If it isn't, it runs:
The eLua interpreter
The eLua interpreter reads commands in the Lua programming language from the SD card or from the console.
- Lua 5.1 as per the Lua 5.1 Reference Manual with
- Integer variables and arithmetic instead of the usual double precision floating point
- eLua support for
- FAT filesystem on MMC/SD card
- console on the RS232 serial port or on USB serial port
- Standard Lua modules:
coroutine, io, package, string, table
- Integer version of the
abs, ceil, floor, huge, max, min, pow, random, randomseed, sqrt.
- eLua hardware driver modules:
adc, i2c, pio, pwm, spi, tmr, uart
- eLua extension modules:
bit, cpu, elua, pack, pd, term
- eLua TCP/IP Networking uIP module:
- eLua extension modules for the Mizar32 to drive the LCD character display and the Real Time Clock.
If you have the Mizar32 A or B models with 256KB or 512KB of flash, you can change the firmware to use floating point instead of integer variables. If you have a 128KB flash Mizar32 C and you need to load a bigger eLua image than will fit you can still do it by loading the image from SDCard to SDRAM and executing it in SDRAM (with a speed penalty) using the emBLOD second-stage bootloader.
- The Lua 5.1 Reference Manual.
- There is a free online book teaching Lua 5.0 which has a second edition for Lua 5.1 available on paper.
- Pieces of Lua code to achieve some common effects can be found at snippets.luacode.org and more resources at lua-users.org.
- To write the fastest Lua code, consult the wiki of speed optimization tips.