DETAILS: for most platforms, the main stack size was set to 256 bytes to
save RAM. During a routine Lua debugging session, I discovered that there
are at least two data structures in Lua (declared on the stack) that can
lead to a stack overflow problem because of their size:
lparser.h -> struct FuncState (original size: 572) is allocated on the stack
when the parser needs to compile a Lua function
lstrlib.c -> MatchState (original size: 272) is allocated on the stack
everytime the string library does match-related operations.
To fix the first problem I modified these macros in luaconf.h:
/*
@@ LUAI_MAXUPVALUES is the maximum number of upvalues per function
@* (must be smaller than 250).
*/
LUAI_MAXUPVALUES from 60 to 10
/*
@@ LUAI_MAXVARS is the maximum number of local variables per function
@* (must be smaller than 250).
*/
LUAI_MAXVARS from 200 to 25
The new size of the FuncState structure: 124
To fix the second problem I modified this macro in luaconf.g
/*
@@ LUA_MAXCAPTURES is the maximum number of captures that a pattern
@* can do during pattern-matching.
** CHANGE it if you need more captures. This limit is arbitrary.
*/
LUA_MAXCAPTURES from 32 to 10
The new size of the MatchState structure: 96
All these values are experimental, but they should work well.
Also, I forced the main stack to 512 bytes in all the backends. Hopefully
this will take care of this problem.
- all eLua modules updated to work with LTR
- "cpu" module added to avr32, at91sam7x, str7
- "disp" module no longer generic (now stays in src/modules/lm3s). For this reason, the "disp" platform interface was also removed.
- the "modcommon" mechanism in STM32 (ROM loader) was depreciated in favour of the Lua Tiny RAM patch (and the "stm3210lcd" module from the STM32 backend now uses LTR).
- small bugfixes
- added virtual timers (on LM3S, AVR32 and AT91SAM7 for now)
- added interrupt handling code for AT91SAM7 and AVR32
- fixed two serious bugs that prevented the eLua image to run on both STR9 and LPC2888 (linker command file issues)
- fixed line endings (DOS->UNIX) in the STM32 library files
- fixed preprocessor errors (hopefully all of them) like #if ELUA_CPU == LM3S8962
- other minor or less than minor fixes :)
an eLua_Manual.pdf was added to docs
separate .txt files will be removed soon
The eLua_Manual.odt development will be part of another area (branch) of the repo
It now illustrates how to create and use a module in Lua for eLua.
An LM3S platform-dependend module is created, exposing it's buttons, leds and offering some utility functions.
This very first version is basic an assembly of the previous txt files written
by Bogdan.
Documentation for the new disp module was included and some initial revisions too.
This document, in PDF format, will soon replace the separated txt files in the docs
folder of the eLua distros and it will also be available separetely on the site.
- ls shell command enhanced with column aligned file sizes and total size report
- New section on CHANGELOG for ongoing dev changes, to ease up next release
- pong.lua added to examples in romfs
- minor URL and e-mail updates, to reflect the new eluaproject.net domain
* Added systick functions (for stm3210lcd module)
* Created modcommon.{c,h} which contain module helper functions and module loader
* Created lstm32_mod.c which demonstrates module helper functions and module loader (in addition to lua_lcd.c)
* Added a .lua_init section to the stm32.ld linker script to facilitate platform module loading (see modcommon and lstm32_mod)
* Updated conf.py auxmods.h and SConstruct to build the new files.
* Modified linit.c to add support for require and package back in so that require 'stm3210lcd' would work.
- added the eLua web server example (romfs/lhttpd.lua, romfs/index.pht, romfs/test.lua). Use "lua /rom/lhttpd.lua" from the console to run the server. The server code is largely WIP.