lua-users home
lua-l archive

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

On Tue, Jan 31, 2012 at 8:33 PM, Tim Mensch <> wrote:
> On 1/31/2012 8:22 AM, Tom Freund wrote:
>> One question: what is the footprint of eLua on an ARM Cortex M3 ?
> I'm using stock Lua 5.1.4 (not eLua) on an ARM, using armv6, I'm seeing
> about 189k of code, including most of the libraries (no OS or IO libraries),
> just to give you one benchmark of standard Lua (in case you can find someone
> who says "half as big" or similar, or otherwise can compare the code of eLua
> with stock Lua).

Stock lua 5.1 on Cortex M3 is 70k. When taking any desktop-y code onto
embedded systems you usually find out it drags in a substantial part
of libc and libm, in this case giving a 190k executable (with newlib
as libc). You *probably* don't want doubles, but once you've killed
off the last few references to doubles in Lua itself, fprintf still
drags in the softfp library. At which point you would rebuild newlib
not to have them either.

RAM is the real problem for Lua. Looking at the STM32 chips, I see
256k flash devices with 32-64k of RAM. The Arduino-killer
STM32F103RB6T is 128k/20k. Yeah, quantity 1000 it's only like $1 more
for the 64k devices, but we're talking about a $4 chip. If you just
want to play with cheap Lua, economics in the West shove you at
wireless routers running Linux. I see the D-Link DIR-301 for $30
retail, and that's 32M RAM, 4M flash. Comparable non-branded
direct-from-China are in the $25 range including a USB port or two
(for you to plug your direct-from-China Arduino clone into of course).

We're in this really weird situation right now where Linux-flavored
compute power owns the entire assembled computer market down to
$25[1]. But it can be a pain to hook stuff up directly. It's nice to
put hard real time tasks like PID motor control on a separate
microcontroller and let the main machine do the planning and UI. There
is theoretically a gap between ~$20 and $50 which
super-microcontrollers and RTOSs could fill (perhaps very
power-efficient like meshes), but I'm just not seeing it in real
life--the $60 systems get PIC chips grafted on.

I would guess there are industrial applications where none of this
consumer-oriented stuff is true. The economic circumstances that make
buying a router and ignoring half its hardware a sensible idea may not
last forever either.


[1]: And Linux runs all the way to the top too. The Top 10
supercomputers at all claim to be
running Linux. I am not *aware* of any toasters running Linux, but at
this rate there will be in a few years.