Hi,
I would like to use elua on a STM32 board. My understanding is that what is proposed in the repos is a complete environment allowing to program the MCU 100% with elua. But in my case i have a core program written in c and i would like to enable extensions provided as Lua scripts files on a SD card. Can someone give me some hints on how to do that ? How can i compile elua as a library i will add to my project? How can i expose some of my C variables in ELua to allow the scripts to use them ? Any example of such a plug-in interface for elua ? Thanks for any help François _______________________________________________ eLua-dev mailing list [hidden email] https://lists.berlios.de/mailman/listinfo/elua-dev |
Björn Kalkbrenner |
Hello François,
On 22.04.2013 10:47, François wrote: > But in my case i have a core program written in c and i would like to > enable extensions provided as Lua scripts files on a SD card. > Can someone give me some hints on how to do that ? I am also a beginner of elua but as my understanding is correct, you can't do that. eLua is more like some sort of "operating system" which needs some task to be handled directly by elua (e.g. interrupt handling). > How can i compile elua as a library i will add to my project? You can't, elua is not a library. It may be possible if you rewrite the src/main.c and other internals to put your code into your local elua branch and adding platform specific code to src/platform/<yourplatform> but i don't think that's what you are hoping to find. You can find more information about the internals at http://www.eluaproject.net/doc/v0.9/en_arch_overview.html http://www.eluaproject.net/doc/v0.9/en_index.html > How can i expose some of my C variables in ELua to allow the scripts to > use them ? That's more a question of how lua modules are written in C but if you want to see real-life examples, take a look at the sourcecode of elua, especially in the src/platform/ section you can find several modules which exports their functionality to elua. One example: src/platform/stm32/lua_lcd.c Bye Björn _______________________________________________ eLua-dev mailing list [hidden email] https://lists.berlios.de/mailman/listinfo/elua-dev |
Bjorn,
Thank you for your answer. You are right and since i don't need that the Lua scripts have access to MCU internals, may be eLua is not what i need ! I think now that i should look at the Lua C sources from lua.org. It is ANSI C so i should be able to cross-compile it. Under Linux, Lua compiles as a library liblua.a and then a main.c provides an exec that acts as a terminal for code input. This is not far from what i need, so i will investigate this way. Best regards François Le 22/04/2013 11:26, Björn Kalkbrenner a écrit : > Hello François, > > On 22.04.2013 10:47, François wrote: > >> But in my case i have a core program written in c and i would like to >> enable extensions provided as Lua scripts files on a SD card. >> Can someone give me some hints on how to do that ? > I am also a beginner of elua but as my understanding is correct, you > can't do that. eLua is more like some sort of "operating system" which > needs some task to be handled directly by elua (e.g. interrupt handling). > >> How can i compile elua as a library i will add to my project? > You can't, elua is not a library. It may be possible if you rewrite the > src/main.c and other internals to put your code into your local elua > branch and adding platform specific code to src/platform/<yourplatform> > but i don't think that's what you are hoping to find. > > You can find more information about the internals at > http://www.eluaproject.net/doc/v0.9/en_arch_overview.html > http://www.eluaproject.net/doc/v0.9/en_index.html > > >> How can i expose some of my C variables in ELua to allow the scripts to >> use them ? > That's more a question of how lua modules are written in C but if you > want to see real-life examples, take a look at the sourcecode of elua, > especially in the src/platform/ section you can find several modules > which exports their functionality to elua. One example: > src/platform/stm32/lua_lcd.c > > > Bye > Björn > > _______________________________________________ > eLua-dev mailing list > [hidden email] > https://lists.berlios.de/mailman/listinfo/elua-dev _______________________________________________ eLua-dev mailing list [hidden email] https://lists.berlios.de/mailman/listinfo/elua-dev |
Francois, 22.4.2013 14.34 "François" <[hidden email]> kirjoitti:
Bjorn, _______________________________________________ eLua-dev mailing list [hidden email] https://lists.berlios.de/mailman/listinfo/elua-dev |
In reply to this post by Francois
You could work with the Lua sources directly if you like. eLua also has some patches applied that make it more amenable to working on low memory devices like an emergency garbage collector, NaN packing for Lua's data types (both of these are available as broken-out patches) and read-only tables (there's not a broken-out patch of the most recent version of this) which store static data in flash keeping down SRAM requirements to around 5 kB at startup. You could use the Lua sources within eLua as a starting point if you like, or you could also just replace the main entry point and start up whatever you want and instantiate a Lua state later. All that said, the way the project is put together isn't exactly designed to make it easy to drop it into a project and use eLua as an extension.
On Mon, Apr 22, 2013 at 6:33 AM, François <[hidden email]> wrote: Bjorn, James Snyder Biomedical Engineering Northwestern University http://fanplastic.org/key.txt ph: (847) 448-0386 _______________________________________________ eLua-dev mailing list [hidden email] https://lists.berlios.de/mailman/listinfo/elua-dev |
Free forum by Nabble | Edit this page |