Compile and integrate the Lua language in various hardware/software environments, but focusing on embedded devices. Integration means a platform specific FFI and a layer abstracting away (some of) the differences between the supported environments.
License: BSD 3-clause.
2013-01-23 First publishing:
Lua works stable on the two supported platforms (vega5000 and pc1000), and basic FFI works together with the beginnings of a platform abstraction layer.
The project was initially written as a proof of concept with internal use in mind, so as of now approachability is probably less than ideal.
Contribution is welcome.
It's possible to connect the Lua runtime with Emacs either using the serial port or using TCP/IP (e.g. mobile internet). You can find the Emacs side and the Lua side in the repo.
Once the connection has been successfully established, it becomes possible to evaluate Lua expressions from inside your Emacs with a keyboard shortcut (i.e. you can remotely redefine Lua functions on the fly while your code is running on the PoS terminal). This greatly improves development speed compared to working in C.
Consider using luabind.
Regarding the Lua FFI bindings:
- Every parameter is in its natural unit regardless of the API (e.g. time is always expected and returned in seconds)
- To keep the platform docs useful, functions and variables are never renamed (not even e.g. DelayMS, even though its Lua binding expects seconds). Redundant prefixes are removed though.
- Functions raise Lua errors, unless return codes are part of the normal usage (e.g. Wls_CheckNetLink returns the network link state)
The makefiles expect the following directories:
../dependencies/squish
(build-time Lua lib to concatenate many .lua files into one;hg clone http://code.matthewwild.co.uk/squish/
)../$(PLATFORM)/dependencies/lua-5.2.0
(Lua compiled with the platform compiler. The source distribution is available from Lua.org. Look for possible diff files in $(PLATFORM)/patches that helps the compilation.)../$(PLATFORM)/api/include
(C header files of the platform API)../$(PLATFORM)/api/lib
(binary link libraries of the platform)../$(PLATFORM)/gcc/bin/
(a gcc from the platform toolchain, can be copied from the platform SDK, but take care of multiple incompatible cygwin.dll's lying around)
A MIPS based POS terminal with 32MB flash and 32MB RAM running Linux.
Cygwin compiled gcc binary (v3.4.6).
- no support for floats on the C side (unless my memory fails me)
An ARM (ARM9 32-bit) based POS terminal with 8MB flash and 16MB RAM running a custom kernel.
Cygwin compiled gcc binary (v3.0.2).
- There's no malloc/free on this platform (the firmware binaries need to be raw bits compiled to a specific memory address). I had to write a custom ldscript to layout a heap and compile in an external malloc.c.
- %f in printf doesn't work (C side issue)
- no support for floats on the C side (unless my memory fails me)
The project was initially written by Attila Lendvai ([email protected]) and used in projects at iSoft.kz
The project's name was suggested by Rob Hoelz (hoelzro). 'Lua' means 'moon' in Portuguese, and 'boot' comes from 'bootstrap'.