Quantcast

How can I use eLua as embedded interpreter in my firmware ?

classic Classic list List threaded Threaded
4 messages Options
Alexander Iovlev Alexander Iovlev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How can I use eLua as embedded interpreter in my firmware ?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello. I have a Texas Instruments lm3s5r31 microcontroller with a
Cortex-M3 core. I already have the firmware (written in C) which runs
on it. I want to use lua for embedded scripting as a part of my
firmware. I don't need support for filesystem, shell, input-output and
controller peripheral from scripts but I need to execute some firmware
functions from scripts.

How can I configure eLua for this purpose ?

What does my firmware need to support eLua ?

How much ram and flash memory do I need for eLua in this case ?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJR9lEpAAoJEGVXsYvfHzFn6t8H/3UN8uHwCUEZ05k7CqBwT6iM
qX25oJHP7r3154S8VLUa41aGM4A2QJvAdK4JDfERnqNVlat1A/2xjxKfJNziDp4J
L4OHBbQGj/3tO4M8zwNfxBBgwctp6dokCyxltSLwkVtXDc+kXrAqna4yo6qNN2fr
XL28eTzJk8i5mM+7zPYGUZN8Kd+bnmeXUEPxu1xVvN6h6rdocCttkyyPwyfGTYp9
j87sAdSXI39R3DsvzsVDHU//3C50ApGWJHmiQS+Dg7Z3WDmWA+RMyzec4KV0plJ0
CQjaqoqSRSAY37VNv5ZpVG3wpsNK0BKRiOo7A7/fnDQgXgtvxSss6stdXxFiZjY=
=mJeZ
-----END PGP SIGNATURE-----
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
raman raman
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How can I use eLua as embedded interpreter in my firmware ?


Dear Alexander,

> Hello. I have a Texas Instruments lm3s5r31 microcontroller with a

I just had a quick look at the current (dev) state of the eLua code
base. eLua currently doesn't support your device. So it cannot be
compiled for your board right away. It requires a port but this should
be fairly easy because eLua already runs on other Cortex M3 clones
(including a few M3 clones from Texas Instruments).

> Cortex-M3 core. I already have the firmware (written in C) which runs
> on it. I want to use lua for embedded scripting as a part of my

To access your C program from eLua, you'll have to write an eLua
module. Please check link [1] for some information on this. You can
also read this page [2] to understand the details of the Lua tiny RAM
(LTR) patch for eLua modules.

If you're looking for a quick solution for building an eLua module, you
can try the eLua mode for SWIG [3]. It can be instructed to generate
LTR compatible wrappers for your module.

> firmware. I don't need support for filesystem, shell, input-output and
> controller peripheral from scripts but I need to execute some firmware
> functions from scripts.

Once you have a port, this is an easy thing. You can configure the
eLua image for your MCU according to your needs by modifying Lua
scripts (which you'll have to write if you're doing a port for your
target). Please check this file [4] for an example.

Please note: If you're using elua0.9 (the current stable release),
you have a different approach for configuring your eLua build. You
must modify a file called platform_conf.h which can be found in
this path: elua/src/platform/<platform name>/platform_conf.h
So, unless you have a target/board which eLua already supports
this approach will not be of much use to you.

> How can I configure eLua for this purpose ?

You can read about configuring the eLua image in the eLua doc.
If you're using elua0.9 please check the old configuration
method [5]. Else, you can check on how the configuration is
done with Lua scripts [6].

> What does my firmware need to support eLua ?

I'm not sure I understand this question well but if you're talking
about compiling your program with eLua, then the answer is
simple. If you're using gcc (or one of the C99 compliant toolchains
that eLua uses and supports - like the codesourcery toolchain
for ARM Cortex targets), you shouldn't have any problem using
your C program with eLua.

Have a lot fun with your board.

Best,
Raman

Links:

[1]: http://wiki.eluaproject.net/Tutorials/cmodules
[2]: http://www.eluaproject.net/doc/v0.9/en_arch_ltr.html
[3]: http://www.swig.org/Doc2.0/Lua.html
[4]: https://github.com/elua/elua/blob/master/boards/known/ek-lm3s8962.lua
[5]: http://www.eluaproject.net/doc/v0.8/en_building.html
[6]: http://www.eluaproject.net/doc/master/en_configurator.html
BogdanM BogdanM
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How can I use eLua as embedded interpreter in my firmware ?

In reply to this post by Alexander Iovlev
Hi Alexander,




On Mon, Jul 29, 2013 at 2:25 PM, Alexander Iovlev <[hidden email]> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello. I have a Texas Instruments lm3s5r31 microcontroller with a
Cortex-M3 core. I already have the firmware (written in C) which runs
on it. I want to use lua for embedded scripting as a part of my
firmware. I don't need support for filesystem, shell, input-output and
controller peripheral from scripts but I need to execute some firmware
functions from scripts.

How can I configure eLua for this purpose ?

What does my firmware need to support eLua ?

eLua is not supported in this configuration (embeddable interpreter) out of the box, you'd probably need to hack around it quite a bit to make it work.

Best,
Bogdan
 

How much ram and flash memory do I need for eLua in this case ?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJR9lEpAAoJEGVXsYvfHzFn6t8H/3UN8uHwCUEZ05k7CqBwT6iM
qX25oJHP7r3154S8VLUa41aGM4A2QJvAdK4JDfERnqNVlat1A/2xjxKfJNziDp4J
L4OHBbQGj/3tO4M8zwNfxBBgwctp6dokCyxltSLwkVtXDc+kXrAqna4yo6qNN2fr
XL28eTzJk8i5mM+7zPYGUZN8Kd+bnmeXUEPxu1xVvN6h6rdocCttkyyPwyfGTYp9
j87sAdSXI39R3DsvzsVDHU//3C50ApGWJHmiQS+Dg7Z3WDmWA+RMyzec4KV0plJ0
CQjaqoqSRSAY37VNv5ZpVG3wpsNK0BKRiOo7A7/fnDQgXgtvxSss6stdXxFiZjY=
=mJeZ
-----END PGP SIGNATURE-----
_______________________________________________
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
Tom Schouten Tom Schouten
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How can I use eLua as embedded interpreter in my firmware ?

In reply to this post by Alexander Iovlev
This can be done using standard Lua.

Essentially, just copy the Lua sources into your code base and link it
in the main binary.  If your firmware has a full C library, most of the
dependencies should be there.  Once you link, you'll immediately see
what is missing through undefined symbols.  Then you can either decide
to properly implement those functions, or replace them with dummies if
you don't use them.  Lua has a fairly small base when it comes to OS
dependency.

The big question is probably RAM usage. You'd really have to try to find
out how it goes, though it will be tight.

I did this integration process for eCos, but it only ever ran on the
emulator (synthetic target), not a small uC.




On 07/29/2013 07:25 AM, Alexander Iovlev wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello. I have a Texas Instruments lm3s5r31 microcontroller with a
> Cortex-M3 core. I already have the firmware (written in C) which runs
> on it. I want to use lua for embedded scripting as a part of my
> firmware. I don't need support for filesystem, shell, input-output and
> controller peripheral from scripts but I need to execute some firmware
> functions from scripts.
>
> How can I configure eLua for this purpose ?
>
> What does my firmware need to support eLua ?
>
> How much ram and flash memory do I need for eLua in this case ?
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.12 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQEcBAEBAgAGBQJR9lEpAAoJEGVXsYvfHzFn6t8H/3UN8uHwCUEZ05k7CqBwT6iM
> qX25oJHP7r3154S8VLUa41aGM4A2QJvAdK4JDfERnqNVlat1A/2xjxKfJNziDp4J
> L4OHBbQGj/3tO4M8zwNfxBBgwctp6dokCyxltSLwkVtXDc+kXrAqna4yo6qNN2fr
> XL28eTzJk8i5mM+7zPYGUZN8Kd+bnmeXUEPxu1xVvN6h6rdocCttkyyPwyfGTYp9
> j87sAdSXI39R3DsvzsVDHU//3C50ApGWJHmiQS+Dg7Z3WDmWA+RMyzec4KV0plJ0
> CQjaqoqSRSAY37VNv5ZpVG3wpsNK0BKRiOo7A7/fnDQgXgtvxSss6stdXxFiZjY=
> =mJeZ
> -----END PGP SIGNATURE-----
> _______________________________________________
> 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
Loading...