1
0
mirror of https://github.com/elua/elua.git synced 2025-01-08 20:56:17 +08:00

24 Commits

Author SHA1 Message Date
Bogdan Marinescu
5ce6a8aef6 Multiple changes
- 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
2012-07-01 20:59:55 +03:00
Bogdan Marinescu
59beff6b99 working on the new build configurator. starting to get shape 2012-07-01 01:07:59 +03:00
Bogdan Marinescu
e9a24cac11 Added WOFS + other stuff
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
2012-06-24 23:07:32 +03:00
Bogdan Marinescu
01a8dcd9a5 Changed the ROMFS terminator char
The ROMFS termination char is now 0xFF instead of 0x00 (in preparation
of WOFS).
2012-06-19 16:21:14 +03:00
Bogdan Marinescu
d54659b572 RAM optimizations: pseudo RO strings, functions in Flash
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.
2012-05-10 00:39:42 +03:00
James Snyder
011d90fec6 Fix missing file close. Adjust formatting of definitions 2011-11-29 10:23:40 -06:00
James Snyder
7e6ea54e9b Modifications to Lua build system to include git revision when available 2011-11-28 22:32:42 -06:00
Bogdan Marinescu
7ba13aaf7e build system dependency fix 2011-10-07 17:19:48 +03:00
Bogdan Marinescu
60d62078b7 Remove separate dependency step from Lua build system
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.
2011-10-03 14:08:22 +03:00
Bogdan Marinescu
091b5d31e9 Lua build system improvements and bug fixes
- 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
2011-04-07 17:38:10 +03:00
Bogdan Marinescu
ab5e07bf10 Small fix for running build_elua.lua in Windows 2011-03-06 13:06:45 +02:00
Bogdan Marinescu
9cde5334a8 Compiled files are now found automatically
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).
2011-03-06 03:29:31 +02:00
Bogdan Marinescu
2764ae4c57 Added 'summary' display mode in builder
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.
2011-03-05 21:42:20 +02:00
Bogdan Marinescu
77ac825d39 Targets can be reffered to by name now
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)
2011-03-05 20:22:11 +02:00
Bogdan Marinescu
163870081d Yeah, you guessed it: even more improvements to the build system :) 2011-02-27 18:31:09 +00:00
Bogdan Marinescu
aafb49e079 added automatic check of changes in the command line for different tools; if a change is detected the build system will automatically issue a 'clean' before building the target 2011-02-23 08:04:03 +00:00
Bogdan Marinescu
1822ee1572 Now all eLua platforms compile using build_elua.lua; output compared with scons' output to verify that the same code is generated 2011-02-22 09:58:02 +00:00
Bogdan Marinescu
cd3d721519 added more platforms to the new build script; fixed issue that prevented compilation under Windows 2011-02-21 23:29:54 +00:00
Bogdan Marinescu
36d160876d More refinements to the new build system (yes, a lot of those, I know :) ) It is now possible to send arguments to targets if they are Lua functions. For example:
$ 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 :)
2011-02-21 16:08:55 +00:00
Bogdan Marinescu
b95dd84c41 - avr32 platform now uses the Lua build system (lua build_elua.lua board=mizar32|atevk1100|atevk1101)
- 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
2011-02-21 13:22:47 +00:00
Bogdan Marinescu
df9cacec40 mkfs.lua bug fixes; now it works with actual ROMFS data in all modes (verbatim, compress, compile) 2011-02-21 07:57:44 +00:00
Bogdan Marinescu
e3d6ee2715 Continuing work on the build system, try 'lua build_elua.lua board=et-stm32 prog' (it only works for stm32 for now). Still a lot of WIP and not throughly tested (for example the new mkfs.lua script was not tested at all with a non-empty FS) but it does seem to work nicely. NOTE: you need to install 'lpack' for this to work (luarocks install lpack). Anybody knows of a good way
to implement make's (or scon's ) '-jn' option (for parallel builds) in a cross-platform manner?
2011-02-21 01:01:21 +00:00
Bogdan Marinescu
2d0dbd0ed3 First step towards a Lua based build system. NOT Lake based, just a set of functions that I wrote (utils/build.lua). Does automatic dependency checking (something Lake doesn't do very
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.
2011-02-20 00:15:16 +00:00
Bogdan Marinescu
f9fbead54c merged pre0.8 branch back to trunk 2011-02-02 17:52:12 +00:00