- more build configuration attributes (allocator, target)
- more sanity checks
- more color in the builder
- 'romfs' is now a separate builder target, not a function being called separately
- added mappings for the configurator attributes
This should really be more than one commit, but I wrote everything in one
shot and I don't feel like arranging the changes logically into different
commits. So, these are the changes:
- added WOFS (Write Once File System). This is a writeable file system that
exists in the MCU's internal Flash memory and allows files to be written,
but only once, in a single shot. More details to follow.
- the platform interface has a new MCU flash access interface.
- added WOFS "reference implementations" for two CPUs: LM3S8962 and
STM32F103RE. They are easily extendable to other CPUs in the same platform
and can be taken as a model for other platforms.
- the ROMFS file layout in memory was slightly changed.
- the simulator (src/platform/sim) got a new function (lseek).
- shell: now each shell command receives its arguments in a C-main-style
(argc, argv) pair. This was originally Marcelo's idea and it finally
made it to the master (although this particular implementation is mine),
after I got fed up with all the argument parsing in the shell functions.
- new shell command: wofmt ("formats" a WOFS, effectively clearing it).
- a couple of small fixes in the shell code
This patch adds more RAM optimizations to eLua:
- direct file memory mapping: files in ROMFS will be read directly from Flash,
without allocating any additional buffers. This doesn't help with RAM
consumption in itself, but enables the set of optimizations below.
- pseudo read-only strings. These are still TStrings, but the actual string
content can point directly to Flash. Original Lua strings are kept in
TStrings structures (lobject.h):
typedef union TString {
L_Umaxalign dummy; /* ensures maximum alignment for strings */
struct {
CommonHeader;
lu_byte reserved;
unsigned int hash;
size_t len;
} tsv;
} TString;
The actual string content comes right after the union TString above.
Pseudo RO strings have the same header, but instead of having the string
content after TString, they have a pointer that points to the actual
string content (which should exist in a RO memory (Flash) that is directly
accesbile from the MCU bus (like its internal Flash memory)). lua_newlstr
detects automatically if it should create a regular string or a pseudo RO
string by checking if the string pointer comes from the Flash region of the
MCU. This optimization works for both precompiled (.lc) files that exist in
ROMFS and for internal Lua strings (C code).
- functions in Flash: for precompiled (.lc) files that exist in ROMFS, the code
of the functions and a part of the debug information will be read directly
from Flash.
- ROMFS was changed to support files that are larger than 2**16 bytes and it
aligns all its files to an offset which is a multiple of 4 in order to prevent
data alignment issues with precompiled Lua code.
- the Lua bytecode dumper was changed to align all the instructions in a Lua
function and a part of the debug information to an offset which is a multiple
of 4. This might slightly increase the size of the precompiled Lua file.
These changes were succesfully checked against the Lua 5.1 test suite.
These changes were tested in eLua on LM3S and AVR32.
The separate dependency generation step from the Lua build system
was not needed, now the dependencies are generated at the same time
as the object files.
- specify -Dmacro on the builder command line to automatically include the macro in the compiler command line
- refactoring: option handling code now moved to utils/utils.lua
- various small bugfixes
The files that will be compiled to link an eLua image are now found automatically,
there's no need to specify them explicitly anymore. This applies only to the main
'build_elua.lua' build file, each target's 'conf.lua' still needs to specify them
explicitly (but can use the same automatic source file finding as the main build file).
Added a 'summary' display mode in the builder which displays less information
(thus making the output more readable) and also adds colors :) Not exactly
very useful but I saw this recently in cmake and I _had_ to implement it :)
Activate with "disp_mode=summary" in the command line.
Now a target can be reffered to also by its name, not only by the
corresponding _target object. Also added 'utils.lua' as a separate
file in utils/ (it used to be a part of build.lua)
$ lua build_elua.lua board=et-stm32 burn /dev/ttyUSB0
will invoke stm32ld (the default for stm32's platform 'burn' target) on port /dev/ttyUSB0.
I really have to document all this stuff somewhere. Don't panic though, for now you can use the old build system exactly like you used it before :)
- added support for per-backend targets. avr32 now has a 'burn' target (besides the regular 'prog') that can be used to build the image and burn it to the board (lua build_elua.lua board=atevk1100 burn). It is created in 'conf.lua'
- other fixes and improvements to the build system
well), per-project build directories and other nice stuff. So far used only for mux and rfs_server; 'lua mux.lua' or 'lua rfs_server.lua' to test (add "-c" to clean). Only needs lfs.