[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua+Coco on Tiny Devices
- From: Jerome Vuarand <jerome.vuarand@...>
- Date: Tue, 14 Apr 2009 19:07:39 +0200
2009/4/14 James Snyder <jbsnyder@fanplastic.org>:
> Hi -
>
> This is mainly directed at Mike Pall, but I figured it would be good to have
> the results of this discussion out in the open.
>
> I've recently been working on making Coco work with eLua
> (http://eluaproject.net), and I've managed to get the patching approach to
> work for setjmp as provided by newlib. I'll be happy to contribute back the
> changes for this when they're a little more polished and I've had a chance
> to test them more.
>
> The first thing I noticed is that the default stack size pretty much
> exceeded the available memory on the device I was using (64k SRAM total). I
> was able to pare it back to about 1k and get all of the test scripts running
> with reduced numbers of coroutines. When I try going lower than this
> further (to, say, 512 or 256 bytes), though, it blows up. I'm not familiar
> enough with Lua itself or with coco to know what to expect in terms of
> necessary stack space, but I was wondering if anyone had any thoughts on
> this. When the coroutines are created in the example scripts, what exactly
> is needing to be preserved on the stack? Can this be pared back at the cost
> of performance? Also, could one safely allocate stack space only as needed
> by actual stack size as opposed to pre-allocation?
AFAIK the stack has to be a single block of memory. So to have several
independently growing C stacks you need an MMU (to fragment the stack
while keeping it solid in terms of address space), and you will only
be able to do it on a page-by-page basis. But I guess most of your
embedded targets don't provide an MMU.
> All in all, I was amazed at how easy it was to get up and running on a
> device that has no operating system, but I'd like to see what I can squeeze
> out of it to make the tradeoffs work better for embedded devices.
>
> Thanks!
>
> --
> James Snyder
> Biomedical Engineering
> Northwestern University
> jbsnyder@fanplastic.org
> http://fanplastic.org/key.txt
> ph: (847) 448-0386
>
>