lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


John Passaniti wrote:
I've put Lua in embedded systems three times so far-- once in a
managed Ethernet switch, once in a box that manages digital audio
networks with SNMP, and once in an environmental monitoring and
control system.  All three times, I've had the luxury of beefy
processors running under an operating system (vxWorks and Linux).  But
now I'm targeting something smaller, and before I dive in too deeply,
I'd like to see if anyone has any wisdom they can offer.

The target is a ColdFire (specifically a MCF52258).  It has 64k of
RAM, and there is no operating system.  Right now, I'm not looking for
Lua to run the main-line code, but I guess it could eventually be used
for that.  The primary use would be for the end user to execute
scripts based on events in the system.

Welcome to the world of deeply embedded Lua, John. Your Forth
experience will come in handy :-)

So the questions are:

1.  What is the current state of making an integer-only Lua?  Yes, I
know you change a macro and "double" becomes "int".  But the last time
I tried this (back in Lua 4.x days), I remember there being... issues.
 I welcome those who have made an integer-only Lua  to comment on
their experience regarding this.

Doable and works. You may have to tweak some other parts of
luaconf.h, specifically functions like pow() and mod() but it
does work.

2.  With 64k of RAM I obviously want to be frugal.  So, are there any
tweaks to the Lua configuration that others who have targeted small
systems can recommend? I'm specifically concerned with what happens
when tables grow-- as I remember the allocation strategy involves
growing by powers of two, but I'm too lazy to look up the exact
mechanism right now.  The point being that I am willing to trade
performance for memory frugality, and would like suggestions and
experience related to that.

I am using 5.2 work 3 with the emergency GC. I force collections at the
beggining of the main parser loop. I also set the threshold for collections to something like 115 instead of 200 to force more frequent
collection.

Ralph