Elua on TWR-K60F120M

classic Classic list List threaded Threaded
14 messages Options
AyCh AyCh
Reply | Threaded
Open this post in threaded view
|

Elua on TWR-K60F120M

Hello ,
I want to run eLua on my TWR-K60F120M but as i saw on eluaproject.net that the CPU architecture cortex-M4 is still under development !
Also I'm new to lua and elua , i have learning about it the past two weeks about them  and all i see in the web is you can only run elua on Mac  or  Ubuntu  after setting up the Toolchain then you can run thee elua shell ,or you make binary file and copy on SD card if your board have  it .
My questions  are :
Can i run elua on my board by creating binary file and copy it the SD , if yes how can generate it and what can i change in elua v 9.0 to make it adequate for my board  and specifically for cortex M4? And do only have to do that in Ubuntu or Mac ?
It said also  on your website that can only run elua on bare metal, no OS needed ? It's not clear for me , meaning that the board that want work , i'm trying at the moment  to port the Erika Entreprise OS  on it ,so if how can i run the elua or lua on it ? Do use the lua script directly or elua  ? I don't understand really !
jbsnyder jbsnyder
Reply | Threaded
Open this post in threaded view
|

Re: Elua on TWR-K60F120M

Hi Chayma,

There was a port that was initiated to the MK60N512VMD100 part initiated back in 2011 which ran on the TWR-K60N512.  It should be functional for that part but the port may require some work to be functional with the part you have and if you wanted to use it with the current sources it would also have to be adjusted for the current build system.

I'd be happy to provide some assistance with updating it for the new build system, but I don't have the same part you have on hand to test with.  Getting it up and running on that part may be trivial, but I haven't used any Kinetis platforms recently so I'm not sure how much modification will be needed.

That original port is in the kinetis branch:
https://github.com/elua/elua/tree/kinetis

On Fri, Mar 27, 2015 at 4:13 AM, AyCh [via eLua Development] <[hidden email]> wrote:
Hello ,
I want to run eLua on my TWR-K60F120M but as i saw on eluaproject.net that the CPU architecture cortex-M4 is still under development !
Also I'm new to lua and elua , i have learning about it the past two weeks about them  and all i see in the web is you can only run elua on Mac  or  Ubuntu  after setting up the Toolchain then you can run thee elua shell ,or you make binary file and copy on SD card if your board have  it .
My questions  are :
Can i run elua on my board by creating binary file and copy it the SD , if yes how can generate it and what can i change in elua v 9.0 to make it adequate for my board  and specifically for cortex M4? And do only have to do that in Ubuntu or Mac ?

I don't know that Kinetis provide an SD-based bootloader.  The original port had to be flashed directly onto the K60 MCU using tools provided by Freescale to load the firmware.  If you're referring to running scripts from the SD card, this is also possible once eLua is flashed onto the MCU if the platform has SPI support and a SPI interface is connected to an SD card.

It should be possible to get a build environment up and running on Mac, Windows or Linux.  At the time when we were working on the port originally the built-in debug interface for the TWR dev kit needed to be interfaced with through Windows.   It looks like KDS is now available on Windows & Linux:

If you have another JTAG interface you may also be able to use OpenOCD to flash the part and that would certainly work on a Mac or Linux environment.

 
It said also  on your website that can only run elua on bare metal, no OS needed ? It's not clear for me , meaning that the board that want work , i'm trying at the moment  to port the Erika Entreprise OS  on it ,so if how can i run the elua or lua on it ? Do use the lua script directly or elua  ? I don't understand really !

eLua is written to run directly on the hardware without an RTOS underneath it. It provides its own system calls, filesystem, etc.., so it is a complete environment that runs on bare metal.
eLua includes Lua 5.1 + patches for MCU memory optimization + hardware abstraction layer + built-in system calls and filesystem functionality.

If you wanted to, you should also be able to take the original Lua sources and run those on top of an RTOS.

Lua scripts could be run within eLua after it is ported to support your specific part or within Lua running on an RTOS.

Best.

-jsnyder
 



If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485.html
To start a new topic under eLua Development, email [hidden email]
To unsubscribe from eLua Development, click here.
NAML



--
James Snyder
ph: <a href="tel:%28847%29%20448-0386" value="+18474480386" target="_blank">(847) 448-0386
AyCh AyCh
Reply | Threaded
Open this post in threaded view
|

Re: Elua on TWR-K60F120M

Thanks for replying and for your help ,

Well ,first i'm trying to build to eLua on windows , i downloaded some files that i don't understand the use of it like Python and as result Scons , first i had problem building the luac.cross with this command " lua cross-lua.lua" ,i got this error"[builder] Unable to create directory .build/cross-lua" so i built the cross compilers using this command "scons cross-lua.py" and after creating .elf and .bin for Kinetis TWR-K60N512 , my problem for now , how to add simple  application like tooggling a led .

As the same time , i have been searching how to modify some the file on elua-kinetis to make it adequate to my TWR-K60F120M , i found this good link on Freescale . http://www.freescale.com/webapp/sps/download/license.jsp?colCode=KINETIS_120MHZ_SC&prodCode=K70_120&location=null&fpsp=1 .



Again thanks help ,  I appreciate it



On Sat, Mar 28, 2015 at 4:12 AM, jbsnyder [via eLua Development] <[hidden email]> wrote:
Hi Chayma,

There was a port that was initiated to the MK60N512VMD100 part initiated back in 2011 which ran on the TWR-K60N512.  It should be functional for that part but the port may require some work to be functional with the part you have and if you wanted to use it with the current sources it would also have to be adjusted for the current build system.

I'd be happy to provide some assistance with updating it for the new build system, but I don't have the same part you have on hand to test with.  Getting it up and running on that part may be trivial, but I haven't used any Kinetis platforms recently so I'm not sure how much modification will be needed.

That original port is in the kinetis branch:
https://github.com/elua/elua/tree/kinetis

On Fri, Mar 27, 2015 at 4:13 AM, AyCh [via eLua Development] <[hidden email]> wrote:
Hello ,
I want to run eLua on my TWR-K60F120M but as i saw on eluaproject.net that the CPU architecture cortex-M4 is still under development !
Also I'm new to lua and elua , i have learning about it the past two weeks about them  and all i see in the web is you can only run elua on Mac  or  Ubuntu  after setting up the Toolchain then you can run thee elua shell ,or you make binary file and copy on SD card if your board have  it .
My questions  are :
Can i run elua on my board by creating binary file and copy it the SD , if yes how can generate it and what can i change in elua v 9.0 to make it adequate for my board  and specifically for cortex M4? And do only have to do that in Ubuntu or Mac ?

I don't know that Kinetis provide an SD-based bootloader.  The original port had to be flashed directly onto the K60 MCU using tools provided by Freescale to load the firmware.  If you're referring to running scripts from the SD card, this is also possible once eLua is flashed onto the MCU if the platform has SPI support and a SPI interface is connected to an SD card.

It should be possible to get a build environment up and running on Mac, Windows or Linux.  At the time when we were working on the port originally the built-in debug interface for the TWR dev kit needed to be interfaced with through Windows.   It looks like KDS is now available on Windows & Linux:

If you have another JTAG interface you may also be able to use OpenOCD to flash the part and that would certainly work on a Mac or Linux environment.

 
It said also  on your website that can only run elua on bare metal, no OS needed ? It's not clear for me , meaning that the board that want work , i'm trying at the moment  to port the Erika Entreprise OS  on it ,so if how can i run the elua or lua on it ? Do use the lua script directly or elua  ? I don't understand really !

eLua is written to run directly on the hardware without an RTOS underneath it. It provides its own system calls, filesystem, etc.., so it is a complete environment that runs on bare metal.
eLua includes Lua 5.1 + patches for MCU memory optimization + hardware abstraction layer + built-in system calls and filesystem functionality.

If you wanted to, you should also be able to take the original Lua sources and run those on top of an RTOS.

Lua scripts could be run within eLua after it is ported to support your specific part or within Lua running on an RTOS.

Best.

-jsnyder
 



If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485.html
To start a new topic under eLua Development, email [hidden email]
To unsubscribe from eLua Development, click here.
NAML



--
James Snyder
ph: <a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%28847%29%20448-0386" value="+18474480386" target="_blank">(847) 448-0386



If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485p7578486.html
To unsubscribe from Elua on TWR-K60F120M, click here.
NAML

jbsnyder jbsnyder
Reply | Threaded
Open this post in threaded view
|

Re: Elua on TWR-K60F120M



On Mon, Mar 30, 2015 at 5:22 PM, AyCh [via eLua Development] <[hidden email]> wrote:
Thanks for replying and for your help ,

Well ,first i'm trying to build to eLua on windows , i downloaded some files that i don't understand the use of it like Python and as result Scons , first i had problem building the luac.cross with this command " lua cross-lua.lua" ,i got this error"[builder] Unable to create directory .build/cross-lua" so i built the cross compilers using this command "scons cross-lua.py" and after creating .elf and .bin for Kinetis TWR-K60N512 , my problem for now , how to add simple  application like tooggling a led .

So do you have the build system working now to get the image for TWR-K60N512?

You can find an LED example here:

That will need to be adjusted for your target for which pins you need to toggle.

If you can get a serial port interface working, that would allow you to do this interactively as well.

Again, you may also have to modify the port for your particular part.  I'm not sure the differences between the K60N512 and the K60F120M.
 

As the same time , i have been searching how to modify some the file on elua-kinetis to make it adequate to my TWR-K60F120M , i found this good link on Freescale . http://www.freescale.com/webapp/sps/download/license.jsp?colCode=KINETIS_120MHZ_SC&prodCode=K70_120&location=null&fpsp=1 .

Strangely that links doesn't seem to be working for me, but it looks like that is the archive that should include sample code for the platform which could be useful for extending the kinetis port and adding functionality.

Best.

-jsnyder
 



Again thanks help ,  I appreciate it



On Sat, Mar 28, 2015 at 4:12 AM, jbsnyder [via eLua Development] <[hidden email]> wrote:
Hi Chayma,

There was a port that was initiated to the MK60N512VMD100 part initiated back in 2011 which ran on the TWR-K60N512.  It should be functional for that part but the port may require some work to be functional with the part you have and if you wanted to use it with the current sources it would also have to be adjusted for the current build system.

I'd be happy to provide some assistance with updating it for the new build system, but I don't have the same part you have on hand to test with.  Getting it up and running on that part may be trivial, but I haven't used any Kinetis platforms recently so I'm not sure how much modification will be needed.

That original port is in the kinetis branch:
https://github.com/elua/elua/tree/kinetis

On Fri, Mar 27, 2015 at 4:13 AM, AyCh [via eLua Development] <[hidden email]> wrote:
Hello ,
I want to run eLua on my TWR-K60F120M but as i saw on eluaproject.net that the CPU architecture cortex-M4 is still under development !
Also I'm new to lua and elua , i have learning about it the past two weeks about them  and all i see in the web is you can only run elua on Mac  or  Ubuntu  after setting up the Toolchain then you can run thee elua shell ,or you make binary file and copy on SD card if your board have  it .
My questions  are :
Can i run elua on my board by creating binary file and copy it the SD , if yes how can generate it and what can i change in elua v 9.0 to make it adequate for my board  and specifically for cortex M4? And do only have to do that in Ubuntu or Mac ?

I don't know that Kinetis provide an SD-based bootloader.  The original port had to be flashed directly onto the K60 MCU using tools provided by Freescale to load the firmware.  If you're referring to running scripts from the SD card, this is also possible once eLua is flashed onto the MCU if the platform has SPI support and a SPI interface is connected to an SD card.

It should be possible to get a build environment up and running on Mac, Windows or Linux.  At the time when we were working on the port originally the built-in debug interface for the TWR dev kit needed to be interfaced with through Windows.   It looks like KDS is now available on Windows & Linux:

If you have another JTAG interface you may also be able to use OpenOCD to flash the part and that would certainly work on a Mac or Linux environment.

 
It said also  on your website that can only run elua on bare metal, no OS needed ? It's not clear for me , meaning that the board that want work , i'm trying at the moment  to port the Erika Entreprise OS  on it ,so if how can i run the elua or lua on it ? Do use the lua script directly or elua  ? I don't understand really !

eLua is written to run directly on the hardware without an RTOS underneath it. It provides its own system calls, filesystem, etc.., so it is a complete environment that runs on bare metal.
eLua includes Lua 5.1 + patches for MCU memory optimization + hardware abstraction layer + built-in system calls and filesystem functionality.

If you wanted to, you should also be able to take the original Lua sources and run those on top of an RTOS.

Lua scripts could be run within eLua after it is ported to support your specific part or within Lua running on an RTOS.

Best.

-jsnyder
 



If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485.html
To start a new topic under eLua Development, email [hidden email]
To unsubscribe from eLua Development, click here.
NAML



--
James Snyder
ph: <a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%28847%29%20448-0386" value="+18474480386" target="_blank">(847) 448-0386



If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485p7578486.html
To unsubscribe from Elua on TWR-K60F120M, click here.
NAML




If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485p7578488.html
To start a new topic under eLua Development, email [hidden email]
To unsubscribe from eLua Development, click here.
NAML



--
James Snyder
ph: (847) 448-0386
jbsnyder jbsnyder
Reply | Threaded
Open this post in threaded view
|

Re: Elua on TWR-K60F120M

In reply to this post by AyCh
An additional detail:  If you want a script to run at startup you can add it to the romfs directory prior to build with the name autorun.lua.

On Fri, Apr 3, 2015 at 3:26 PM, James Snyder <[hidden email]> wrote:


On Mon, Mar 30, 2015 at 5:22 PM, AyCh [via eLua Development] <[hidden email]> wrote:
Thanks for replying and for your help ,

Well ,first i'm trying to build to eLua on windows , i downloaded some files that i don't understand the use of it like Python and as result Scons , first i had problem building the luac.cross with this command " lua cross-lua.lua" ,i got this error"[builder] Unable to create directory .build/cross-lua" so i built the cross compilers using this command "scons cross-lua.py" and after creating .elf and .bin for Kinetis TWR-K60N512 , my problem for now , how to add simple  application like tooggling a led .

So do you have the build system working now to get the image for TWR-K60N512?

You can find an LED example here:

That will need to be adjusted for your target for which pins you need to toggle.

If you can get a serial port interface working, that would allow you to do this interactively as well.

Again, you may also have to modify the port for your particular part.  I'm not sure the differences between the K60N512 and the K60F120M.
 

As the same time , i have been searching how to modify some the file on elua-kinetis to make it adequate to my TWR-K60F120M , i found this good link on Freescale . http://www.freescale.com/webapp/sps/download/license.jsp?colCode=KINETIS_120MHZ_SC&prodCode=K70_120&location=null&fpsp=1 .

Strangely that links doesn't seem to be working for me, but it looks like that is the archive that should include sample code for the platform which could be useful for extending the kinetis port and adding functionality.

Best.

-jsnyder
 



Again thanks help ,  I appreciate it



On Sat, Mar 28, 2015 at 4:12 AM, jbsnyder [via eLua Development] <[hidden email]> wrote:
Hi Chayma,

There was a port that was initiated to the MK60N512VMD100 part initiated back in 2011 which ran on the TWR-K60N512.  It should be functional for that part but the port may require some work to be functional with the part you have and if you wanted to use it with the current sources it would also have to be adjusted for the current build system.

I'd be happy to provide some assistance with updating it for the new build system, but I don't have the same part you have on hand to test with.  Getting it up and running on that part may be trivial, but I haven't used any Kinetis platforms recently so I'm not sure how much modification will be needed.

That original port is in the kinetis branch:
https://github.com/elua/elua/tree/kinetis

On Fri, Mar 27, 2015 at 4:13 AM, AyCh [via eLua Development] <[hidden email]> wrote:
Hello ,
I want to run eLua on my TWR-K60F120M but as i saw on eluaproject.net that the CPU architecture cortex-M4 is still under development !
Also I'm new to lua and elua , i have learning about it the past two weeks about them  and all i see in the web is you can only run elua on Mac  or  Ubuntu  after setting up the Toolchain then you can run thee elua shell ,or you make binary file and copy on SD card if your board have  it .
My questions  are :
Can i run elua on my board by creating binary file and copy it the SD , if yes how can generate it and what can i change in elua v 9.0 to make it adequate for my board  and specifically for cortex M4? And do only have to do that in Ubuntu or Mac ?

I don't know that Kinetis provide an SD-based bootloader.  The original port had to be flashed directly onto the K60 MCU using tools provided by Freescale to load the firmware.  If you're referring to running scripts from the SD card, this is also possible once eLua is flashed onto the MCU if the platform has SPI support and a SPI interface is connected to an SD card.

It should be possible to get a build environment up and running on Mac, Windows or Linux.  At the time when we were working on the port originally the built-in debug interface for the TWR dev kit needed to be interfaced with through Windows.   It looks like KDS is now available on Windows & Linux:

If you have another JTAG interface you may also be able to use OpenOCD to flash the part and that would certainly work on a Mac or Linux environment.

 
It said also  on your website that can only run elua on bare metal, no OS needed ? It's not clear for me , meaning that the board that want work , i'm trying at the moment  to port the Erika Entreprise OS  on it ,so if how can i run the elua or lua on it ? Do use the lua script directly or elua  ? I don't understand really !

eLua is written to run directly on the hardware without an RTOS underneath it. It provides its own system calls, filesystem, etc.., so it is a complete environment that runs on bare metal.
eLua includes Lua 5.1 + patches for MCU memory optimization + hardware abstraction layer + built-in system calls and filesystem functionality.

If you wanted to, you should also be able to take the original Lua sources and run those on top of an RTOS.

Lua scripts could be run within eLua after it is ported to support your specific part or within Lua running on an RTOS.

Best.

-jsnyder
 



If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485.html
To start a new topic under eLua Development, email [hidden email]
To unsubscribe from eLua Development, click here.
NAML



--
James Snyder
ph: <a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%28847%29%20448-0386" value="+18474480386" target="_blank">(847) 448-0386



If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485p7578486.html
To unsubscribe from Elua on TWR-K60F120M, click here.
NAML




If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485p7578488.html
To start a new topic under eLua Development, email [hidden email]
To unsubscribe from eLua Development, click here.
NAML



--
James Snyder
ph: <a href="tel:%28847%29%20448-0386" value="+18474480386" target="_blank">(847) 448-0386



--
James Snyder
ph: (847) 448-0386
jbsnyder jbsnyder
Reply | Threaded
Open this post in threaded view
|

Re: Elua on TWR-K60F120M

In reply to this post by AyCh
I was just looking around for code examples for the kinetis platform.  Looks like we actually left the demos in the romfs folder for this platform:

If you do get a working serial interface up on the platform you would be able to run these by typing something similar at the prompt:
lua /rom/kinled.lua

or

lua /rom/<scriptname>

If you want one to run by default you can change its name to "autorun.lua" as mentioned in the previous email.

Best.

-jsnyder

On Fri, Apr 3, 2015 at 3:28 PM, James Snyder <[hidden email]> wrote:
An additional detail:  If you want a script to run at startup you can add it to the romfs directory prior to build with the name autorun.lua.

On Fri, Apr 3, 2015 at 3:26 PM, James Snyder <[hidden email]> wrote:


On Mon, Mar 30, 2015 at 5:22 PM, AyCh [via eLua Development] <[hidden email]> wrote:
Thanks for replying and for your help ,

Well ,first i'm trying to build to eLua on windows , i downloaded some files that i don't understand the use of it like Python and as result Scons , first i had problem building the luac.cross with this command " lua cross-lua.lua" ,i got this error"[builder] Unable to create directory .build/cross-lua" so i built the cross compilers using this command "scons cross-lua.py" and after creating .elf and .bin for Kinetis TWR-K60N512 , my problem for now , how to add simple  application like tooggling a led .

So do you have the build system working now to get the image for TWR-K60N512?

You can find an LED example here:

That will need to be adjusted for your target for which pins you need to toggle.

If you can get a serial port interface working, that would allow you to do this interactively as well.

Again, you may also have to modify the port for your particular part.  I'm not sure the differences between the K60N512 and the K60F120M.
 

As the same time , i have been searching how to modify some the file on elua-kinetis to make it adequate to my TWR-K60F120M , i found this good link on Freescale . http://www.freescale.com/webapp/sps/download/license.jsp?colCode=KINETIS_120MHZ_SC&prodCode=K70_120&location=null&fpsp=1 .

Strangely that links doesn't seem to be working for me, but it looks like that is the archive that should include sample code for the platform which could be useful for extending the kinetis port and adding functionality.

Best.

-jsnyder
 



Again thanks help ,  I appreciate it



On Sat, Mar 28, 2015 at 4:12 AM, jbsnyder [via eLua Development] <[hidden email]> wrote:
Hi Chayma,

There was a port that was initiated to the MK60N512VMD100 part initiated back in 2011 which ran on the TWR-K60N512.  It should be functional for that part but the port may require some work to be functional with the part you have and if you wanted to use it with the current sources it would also have to be adjusted for the current build system.

I'd be happy to provide some assistance with updating it for the new build system, but I don't have the same part you have on hand to test with.  Getting it up and running on that part may be trivial, but I haven't used any Kinetis platforms recently so I'm not sure how much modification will be needed.

That original port is in the kinetis branch:
https://github.com/elua/elua/tree/kinetis

On Fri, Mar 27, 2015 at 4:13 AM, AyCh [via eLua Development] <[hidden email]> wrote:
Hello ,
I want to run eLua on my TWR-K60F120M but as i saw on eluaproject.net that the CPU architecture cortex-M4 is still under development !
Also I'm new to lua and elua , i have learning about it the past two weeks about them  and all i see in the web is you can only run elua on Mac  or  Ubuntu  after setting up the Toolchain then you can run thee elua shell ,or you make binary file and copy on SD card if your board have  it .
My questions  are :
Can i run elua on my board by creating binary file and copy it the SD , if yes how can generate it and what can i change in elua v 9.0 to make it adequate for my board  and specifically for cortex M4? And do only have to do that in Ubuntu or Mac ?

I don't know that Kinetis provide an SD-based bootloader.  The original port had to be flashed directly onto the K60 MCU using tools provided by Freescale to load the firmware.  If you're referring to running scripts from the SD card, this is also possible once eLua is flashed onto the MCU if the platform has SPI support and a SPI interface is connected to an SD card.

It should be possible to get a build environment up and running on Mac, Windows or Linux.  At the time when we were working on the port originally the built-in debug interface for the TWR dev kit needed to be interfaced with through Windows.   It looks like KDS is now available on Windows & Linux:

If you have another JTAG interface you may also be able to use OpenOCD to flash the part and that would certainly work on a Mac or Linux environment.

 
It said also  on your website that can only run elua on bare metal, no OS needed ? It's not clear for me , meaning that the board that want work , i'm trying at the moment  to port the Erika Entreprise OS  on it ,so if how can i run the elua or lua on it ? Do use the lua script directly or elua  ? I don't understand really !

eLua is written to run directly on the hardware without an RTOS underneath it. It provides its own system calls, filesystem, etc.., so it is a complete environment that runs on bare metal.
eLua includes Lua 5.1 + patches for MCU memory optimization + hardware abstraction layer + built-in system calls and filesystem functionality.

If you wanted to, you should also be able to take the original Lua sources and run those on top of an RTOS.

Lua scripts could be run within eLua after it is ported to support your specific part or within Lua running on an RTOS.

Best.

-jsnyder
 



If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485.html
To start a new topic under eLua Development, email [hidden email]
To unsubscribe from eLua Development, click here.
NAML



--
James Snyder
ph: <a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%28847%29%20448-0386" value="+18474480386" target="_blank">(847) 448-0386



If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485p7578486.html
To unsubscribe from Elua on TWR-K60F120M, click here.
NAML




If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485p7578488.html
To start a new topic under eLua Development, email [hidden email]
To unsubscribe from eLua Development, click here.
NAML



--
James Snyder
ph: <a href="tel:%28847%29%20448-0386" value="+18474480386" target="_blank">(847) 448-0386



--
James Snyder
ph: <a href="tel:%28847%29%20448-0386" value="+18474480386" target="_blank">(847) 448-0386



--
James Snyder
ph: (847) 448-0386
AyCh AyCh
Reply | Threaded
Open this post in threaded view
|

Re: Elua on TWR-K60F120M

Hi Again , this time i have a  different questions:
The problem is i'm trying to connect the Kinetis board to my PC with USB and  then when i will write scripts  in lua such "set led " the board execute the command if not, it will be an error message .
Is it possible make an interpreter language such as Lua to work between the PC and the MCU which this time has OS in it?
How can make Lua  scripts  be understandable to  the board? 
Maybe do i just need to copy the src files of Lua in the MCU's OS and try to use it ?
And concerning eLua can  I dynamically run commands meaning in eLua shell prompt ,so that i don't need to copy whatever application i need to use in ROMFS  and the evoking the build system?


On Fri, Apr 3, 2015 at 11:06 PM, jbsnyder [via eLua Development] <[hidden email]> wrote:
I was just looking around for code examples for the kinetis platform.  Looks like we actually left the demos in the romfs folder for this platform:

If you do get a working serial interface up on the platform you would be able to run these by typing something similar at the prompt:
lua /rom/kinled.lua

or

lua /rom/<scriptname>

If you want one to run by default you can change its name to "autorun.lua" as mentioned in the previous email.

Best.

-jsnyder

On Fri, Apr 3, 2015 at 3:28 PM, James Snyder <[hidden email]> wrote:
An additional detail:  If you want a script to run at startup you can add it to the romfs directory prior to build with the name autorun.lua.

On Fri, Apr 3, 2015 at 3:26 PM, James Snyder <[hidden email]> wrote:


On Mon, Mar 30, 2015 at 5:22 PM, AyCh [via eLua Development] <[hidden email]> wrote:
Thanks for replying and for your help ,

Well ,first i'm trying to build to eLua on windows , i downloaded some files that i don't understand the use of it like Python and as result Scons , first i had problem building the luac.cross with this command " lua cross-lua.lua" ,i got this error"[builder] Unable to create directory .build/cross-lua" so i built the cross compilers using this command "scons cross-lua.py" and after creating .elf and .bin for Kinetis TWR-K60N512 , my problem for now , how to add simple  application like tooggling a led .

So do you have the build system working now to get the image for TWR-K60N512?

You can find an LED example here:

That will need to be adjusted for your target for which pins you need to toggle.

If you can get a serial port interface working, that would allow you to do this interactively as well.

Again, you may also have to modify the port for your particular part.  I'm not sure the differences between the K60N512 and the K60F120M.
 

As the same time , i have been searching how to modify some the file on elua-kinetis to make it adequate to my TWR-K60F120M , i found this good link on Freescale . http://www.freescale.com/webapp/sps/download/license.jsp?colCode=KINETIS_120MHZ_SC&prodCode=K70_120&location=null&fpsp=1 .

Strangely that links doesn't seem to be working for me, but it looks like that is the archive that should include sample code for the platform which could be useful for extending the kinetis port and adding functionality.

Best.

-jsnyder
 



Again thanks help ,  I appreciate it



On Sat, Mar 28, 2015 at 4:12 AM, jbsnyder [via eLua Development] <[hidden email]> wrote:
Hi Chayma,

There was a port that was initiated to the MK60N512VMD100 part initiated back in 2011 which ran on the TWR-K60N512.  It should be functional for that part but the port may require some work to be functional with the part you have and if you wanted to use it with the current sources it would also have to be adjusted for the current build system.

I'd be happy to provide some assistance with updating it for the new build system, but I don't have the same part you have on hand to test with.  Getting it up and running on that part may be trivial, but I haven't used any Kinetis platforms recently so I'm not sure how much modification will be needed.

That original port is in the kinetis branch:
https://github.com/elua/elua/tree/kinetis

On Fri, Mar 27, 2015 at 4:13 AM, AyCh [via eLua Development] <[hidden email]> wrote:
Hello ,
I want to run eLua on my TWR-K60F120M but as i saw on eluaproject.net that the CPU architecture cortex-M4 is still under development !
Also I'm new to lua and elua , i have learning about it the past two weeks about them  and all i see in the web is you can only run elua on Mac  or  Ubuntu  after setting up the Toolchain then you can run thee elua shell ,or you make binary file and copy on SD card if your board have  it .
My questions  are :
Can i run elua on my board by creating binary file and copy it the SD , if yes how can generate it and what can i change in elua v 9.0 to make it adequate for my board  and specifically for cortex M4? And do only have to do that in Ubuntu or Mac ?

I don't know that Kinetis provide an SD-based bootloader.  The original port had to be flashed directly onto the K60 MCU using tools provided by Freescale to load the firmware.  If you're referring to running scripts from the SD card, this is also possible once eLua is flashed onto the MCU if the platform has SPI support and a SPI interface is connected to an SD card.

It should be possible to get a build environment up and running on Mac, Windows or Linux.  At the time when we were working on the port originally the built-in debug interface for the TWR dev kit needed to be interfaced with through Windows.   It looks like KDS is now available on Windows & Linux:

If you have another JTAG interface you may also be able to use OpenOCD to flash the part and that would certainly work on a Mac or Linux environment.

 
It said also  on your website that can only run elua on bare metal, no OS needed ? It's not clear for me , meaning that the board that want work , i'm trying at the moment  to port the Erika Entreprise OS  on it ,so if how can i run the elua or lua on it ? Do use the lua script directly or elua  ? I don't understand really !

eLua is written to run directly on the hardware without an RTOS underneath it. It provides its own system calls, filesystem, etc.., so it is a complete environment that runs on bare metal.
eLua includes Lua 5.1 + patches for MCU memory optimization + hardware abstraction layer + built-in system calls and filesystem functionality.

If you wanted to, you should also be able to take the original Lua sources and run those on top of an RTOS.

Lua scripts could be run within eLua after it is ported to support your specific part or within Lua running on an RTOS.

Best.

-jsnyder
 



If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485.html
To start a new topic under eLua Development, email [hidden email]
To unsubscribe from eLua Development, click here.
NAML



--
James Snyder
ph: <a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="<a href="tel:%2B18474480386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%2B18474480386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%28847%29%20448-0386" value="+18474480386" target="_blank">(847) 448-0386



If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485p7578486.html
To unsubscribe from Elua on TWR-K60F120M, click here.
NAML




If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485p7578488.html
To start a new topic under eLua Development, email [hidden email]
To unsubscribe from eLua Development, click here.
NAML



--
James Snyder
ph: <a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%28847%29%20448-0386" value="+18474480386" target="_blank">(847) 448-0386



--
James Snyder
ph: <a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%28847%29%20448-0386" value="+18474480386" target="_blank">(847) 448-0386



--
James Snyder
ph: <a href="tel:%28847%29%20448-0386" value="+18474480386" target="_blank">(847) 448-0386



If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485p7578491.html
To unsubscribe from Elua on TWR-K60F120M, click here.
NAML

jbsnyder jbsnyder
Reply | Threaded
Open this post in threaded view
|

Re: Elua on TWR-K60F120M



On Mon, Apr 6, 2015 at 3:56 PM, AyCh [via eLua Development] <[hidden email]> wrote:
Hi Again , this time i have a  different questions:
The problem is i'm trying to connect the Kinetis board to my PC with USB and  then when i will write scripts  in lua such "set led " the board execute the command if not, it will be an error message .
Is it possible make an interpreter language such as Lua to work between the PC and the MCU which this time has OS in it?

This would depend on the OS/RTOS's functionality.  If you want the MCU to communicate with a Lua state on the desktop you could use something like LuaRPC:

Note: For bytecode transfer to work between an MCU and desktop this might depend somewhat on some changes in eLua's compiler that allow translating the bytecode to run on different platforms:

Otherwise if the OS/RTOS provides some filesystem functionality you could use that perhaps in conjunction with some serial file transfer functionality.
 
How can make Lua  scripts  be understandable to  the board? 

I'm not sure if I understand.  A full Lua includes a compiler so long as the script uses available modules and is written for the same version of Lua and Lua is running on the target it should be able to compile and run it.

If you're meaning how to get the scripts to the board, as in the above answer that will depend on the OS or RTOS running on the MCU.
 
Maybe do i just need to copy the src files of Lua in the MCU's OS and try to use it ?

You should be able to get raw Lua sources up and running within an OS that provides system calls relatively easily.  Otherwise you'll need to provide your own system calls.
 
And concerning eLua can  I dynamically run commands meaning in eLua shell prompt ,so that i don't need to copy whatever application i need to use in ROMFS  and the evoking the build system?

There are a couple of ways to have the Lua state on the microcontroller interact with a PC.

You can use xmodem with the recv command (this is probably the simplest way):

You can also use LuaRPC to have a state that runs on your desktop environment that allows you to control the Lua state on your MCU:

Additionally, there's eLua's RFS which makes use of a serial interface to access the filesystem on your computer:

Otherwise, an SD card could be used on the MCU platform, but this requires SPI support being added to the port.

Best.

-jsnyder
 


On Fri, Apr 3, 2015 at 11:06 PM, jbsnyder [via eLua Development] <[hidden email]> wrote:
I was just looking around for code examples for the kinetis platform.  Looks like we actually left the demos in the romfs folder for this platform:

If you do get a working serial interface up on the platform you would be able to run these by typing something similar at the prompt:
lua /rom/kinled.lua

or

lua /rom/<scriptname>

If you want one to run by default you can change its name to "autorun.lua" as mentioned in the previous email.

Best.

-jsnyder

On Fri, Apr 3, 2015 at 3:28 PM, James Snyder <[hidden email]> wrote:
An additional detail:  If you want a script to run at startup you can add it to the romfs directory prior to build with the name autorun.lua.

On Fri, Apr 3, 2015 at 3:26 PM, James Snyder <[hidden email]> wrote:


On Mon, Mar 30, 2015 at 5:22 PM, AyCh [via eLua Development] <[hidden email]> wrote:
Thanks for replying and for your help ,

Well ,first i'm trying to build to eLua on windows , i downloaded some files that i don't understand the use of it like Python and as result Scons , first i had problem building the luac.cross with this command " lua cross-lua.lua" ,i got this error"[builder] Unable to create directory .build/cross-lua" so i built the cross compilers using this command "scons cross-lua.py" and after creating .elf and .bin for Kinetis TWR-K60N512 , my problem for now , how to add simple  application like tooggling a led .

So do you have the build system working now to get the image for TWR-K60N512?

You can find an LED example here:

That will need to be adjusted for your target for which pins you need to toggle.

If you can get a serial port interface working, that would allow you to do this interactively as well.

Again, you may also have to modify the port for your particular part.  I'm not sure the differences between the K60N512 and the K60F120M.
 

As the same time , i have been searching how to modify some the file on elua-kinetis to make it adequate to my TWR-K60F120M , i found this good link on Freescale . http://www.freescale.com/webapp/sps/download/license.jsp?colCode=KINETIS_120MHZ_SC&prodCode=K70_120&location=null&fpsp=1 .

Strangely that links doesn't seem to be working for me, but it looks like that is the archive that should include sample code for the platform which could be useful for extending the kinetis port and adding functionality.

Best.

-jsnyder
 



Again thanks help ,  I appreciate it



On Sat, Mar 28, 2015 at 4:12 AM, jbsnyder [via eLua Development] <[hidden email]> wrote:
Hi Chayma,

There was a port that was initiated to the MK60N512VMD100 part initiated back in 2011 which ran on the TWR-K60N512.  It should be functional for that part but the port may require some work to be functional with the part you have and if you wanted to use it with the current sources it would also have to be adjusted for the current build system.

I'd be happy to provide some assistance with updating it for the new build system, but I don't have the same part you have on hand to test with.  Getting it up and running on that part may be trivial, but I haven't used any Kinetis platforms recently so I'm not sure how much modification will be needed.

That original port is in the kinetis branch:
https://github.com/elua/elua/tree/kinetis

On Fri, Mar 27, 2015 at 4:13 AM, AyCh [via eLua Development] <[hidden email]> wrote:
Hello ,
I want to run eLua on my TWR-K60F120M but as i saw on eluaproject.net that the CPU architecture cortex-M4 is still under development !
Also I'm new to lua and elua , i have learning about it the past two weeks about them  and all i see in the web is you can only run elua on Mac  or  Ubuntu  after setting up the Toolchain then you can run thee elua shell ,or you make binary file and copy on SD card if your board have  it .
My questions  are :
Can i run elua on my board by creating binary file and copy it the SD , if yes how can generate it and what can i change in elua v 9.0 to make it adequate for my board  and specifically for cortex M4? And do only have to do that in Ubuntu or Mac ?

I don't know that Kinetis provide an SD-based bootloader.  The original port had to be flashed directly onto the K60 MCU using tools provided by Freescale to load the firmware.  If you're referring to running scripts from the SD card, this is also possible once eLua is flashed onto the MCU if the platform has SPI support and a SPI interface is connected to an SD card.

It should be possible to get a build environment up and running on Mac, Windows or Linux.  At the time when we were working on the port originally the built-in debug interface for the TWR dev kit needed to be interfaced with through Windows.   It looks like KDS is now available on Windows & Linux:

If you have another JTAG interface you may also be able to use OpenOCD to flash the part and that would certainly work on a Mac or Linux environment.

 
It said also  on your website that can only run elua on bare metal, no OS needed ? It's not clear for me , meaning that the board that want work , i'm trying at the moment  to port the Erika Entreprise OS  on it ,so if how can i run the elua or lua on it ? Do use the lua script directly or elua  ? I don't understand really !

eLua is written to run directly on the hardware without an RTOS underneath it. It provides its own system calls, filesystem, etc.., so it is a complete environment that runs on bare metal.
eLua includes Lua 5.1 + patches for MCU memory optimization + hardware abstraction layer + built-in system calls and filesystem functionality.

If you wanted to, you should also be able to take the original Lua sources and run those on top of an RTOS.

Lua scripts could be run within eLua after it is ported to support your specific part or within Lua running on an RTOS.

Best.

-jsnyder
 



If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485.html
To start a new topic under eLua Development, email [hidden email]
To unsubscribe from eLua Development, click here.
NAML



--
James Snyder
ph: <a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="<a href="tel:%2B18474480386" value="<a href="tel:%2B18474480386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%2B18474480386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%2B18474480386" value="<a href="tel:%2B18474480386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%2B18474480386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="<a href="tel:%2B18474480386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%2B18474480386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank">(847) 448-0386



If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485p7578486.html
To unsubscribe from Elua on TWR-K60F120M, click here.
NAML




If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485p7578488.html
To start a new topic under eLua Development, email [hidden email]
To unsubscribe from eLua Development, click here.
NAML



--
James Snyder
ph: <a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank">(847) 448-0386



--
James Snyder
ph: <a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank">(847) 448-0386



--
James Snyder
ph: <a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank">(847) 448-0386



If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485p7578491.html
To unsubscribe from Elua on TWR-K60F120M, click here.
NAML




If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485p7578492.html
To start a new topic under eLua Development, email [hidden email]
To unsubscribe from eLua Development, click here.
NAML



--
James Snyder
ph: (847) 448-0386
AyCh AyCh
Reply | Threaded
Open this post in threaded view
|

Re: Elua on TWR-K60F120M

Hi James, thanks for answering every question that I ask. 

I have questions about the eLua and Lua scripts in general :

•About lua-cross.lua doesn’t want to be built i think because i didn't install LuaRocks , i only installed the LFW

Is it necessary to install the LuaRocks ? 

I buildt the cross-lua with Scons but the output was cross-lua.exe ? should it be cross-lua.elf?

•Now, I have downloaded this application works on bare metal from git://github.com/laswick/kinetis.git   that I tested in   TWR-K60F120M  ( i used the demo for Gpio). My main goal is to use Lua interactively when i flash the board just like this https://twitter.com/nodemcu/status/559743827054194689. So I did these following steps:

I tried  at first to copy the src files from Lua to the project and then  add them  the C_PIECES in the make file .Also I checked the boot process from eLua (main.c) , I'm trying to open the Lua interactive when I flash the board so I used this code from main.c  (and of course after open the Lua interpreter and the Lua's library)

           char* lua_argv[] = { "lua", NULL };

           lua_main( 1, lua_argv );

But It doesn't work ! 


jbsnyder jbsnyder
Reply | Threaded
Open this post in threaded view
|

Re: Elua on TWR-K60F120M

Hi,

Replies in-line.

On Fri, Apr 17, 2015 at 4:11 AM, AyCh [via eLua Development] <[hidden email]> wrote:

Hi James, thanks for answering every question that I ask. 

I have questions about the eLua and Lua scripts in general :

•About lua-cross.lua doesn’t want to be built i think because i didn't install LuaRocks , i only installed the LFW

Is it necessary to install the LuaRocks ? 


You'll need some Lua modules.  If I recall most are included in luaforwindows:

I believe all the needed modules are included in that distribution.
 

I buildt the cross-lua with Scons but the output was cross-lua.exe ? should it be cross-lua.elf?


cross-lua is a cross compiler that builds Lua bytecode that can be used on a microcontroller, it is not the binary that will run on the microcontroller.

If you want to build the binary for the TWR-K60N512 you could do this:
scons board=TWR-K60N512 prog

This will give you an elf and a bin file that could be flashed at least on the mk60n512vmd100.  You might have to modify the port for your TWR-K60F120M.
 

•Now, I have downloaded this application works on bare metal from git://github.com/laswick/kinetis.git   that I tested in   TWR-K60F120M  ( i used the demo for Gpio). My main goal is to use Lua interactively when i flash the board just like this https://twitter.com/nodemcu/status/559743827054194689. So I did these following steps:

I tried  at first to copy the src files from Lua to the project and then  add them  the C_PIECES in the make file .Also I checked the boot process from eLua (main.c) , I'm trying to open the Lua interactive when I flash the board so I used this code from main.c  (and of course after open the Lua interpreter and the Lua's library)

           char* lua_argv[] = { "lua", NULL };

           lua_main( 1, lua_argv );

But It doesn't work ! 


I haven't used the particular bare metal environment you're describing. Does it currently compile with what you're trying?  Do you have implementations for system calls that Lua will need?

If you're building with Newlib as your libc you'll need to provide your own implementations of calls that would typically be provided by an operating system as described here: 

You can find examples in the eLua sources for Newlib: 

You may only need a subset of that actually implemented for reading/writing and sbrk for the memory allocator to request heap to get the basics working.

Best.

-jsnyder
 





If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485p7578494.html
To start a new topic under eLua Development, email [hidden email]
To unsubscribe from eLua Development, click here.
NAML



--
James Snyder
ph: (847) 448-0386
jbsnyder jbsnyder
Reply | Threaded
Open this post in threaded view
|

Re: Elua on TWR-K60F120M

In reply to this post by AyCh
You may also find this implementation of syscalls.c from Michael Fischer useful for getting your initial implementation going:

Best.

-jsnyder

On Sat, Apr 18, 2015 at 4:41 PM, James Snyder <[hidden email]> wrote:
Hi,

Replies in-line.

On Fri, Apr 17, 2015 at 4:11 AM, AyCh [via eLua Development] <[hidden email]> wrote:

Hi James, thanks for answering every question that I ask. 

I have questions about the eLua and Lua scripts in general :

•About lua-cross.lua doesn’t want to be built i think because i didn't install LuaRocks , i only installed the LFW

Is it necessary to install the LuaRocks ? 


You'll need some Lua modules.  If I recall most are included in luaforwindows:

I believe all the needed modules are included in that distribution.
 

I buildt the cross-lua with Scons but the output was cross-lua.exe ? should it be cross-lua.elf?


cross-lua is a cross compiler that builds Lua bytecode that can be used on a microcontroller, it is not the binary that will run on the microcontroller.

If you want to build the binary for the TWR-K60N512 you could do this:
scons board=TWR-K60N512 prog

This will give you an elf and a bin file that could be flashed at least on the mk60n512vmd100.  You might have to modify the port for your TWR-K60F120M.
 

•Now, I have downloaded this application works on bare metal from git://github.com/laswick/kinetis.git   that I tested in   TWR-K60F120M  ( i used the demo for Gpio). My main goal is to use Lua interactively when i flash the board just like this https://twitter.com/nodemcu/status/559743827054194689. So I did these following steps:

I tried  at first to copy the src files from Lua to the project and then  add them  the C_PIECES in the make file .Also I checked the boot process from eLua (main.c) , I'm trying to open the Lua interactive when I flash the board so I used this code from main.c  (and of course after open the Lua interpreter and the Lua's library)

           char* lua_argv[] = { "lua", NULL };

           lua_main( 1, lua_argv );

But It doesn't work ! 


I haven't used the particular bare metal environment you're describing. Does it currently compile with what you're trying?  Do you have implementations for system calls that Lua will need?

If you're building with Newlib as your libc you'll need to provide your own implementations of calls that would typically be provided by an operating system as described here: 

You can find examples in the eLua sources for Newlib: 

You may only need a subset of that actually implemented for reading/writing and sbrk for the memory allocator to request heap to get the basics working.

Best.

-jsnyder
 





If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485p7578494.html
To start a new topic under eLua Development, email [hidden email]
To unsubscribe from eLua Development, click here.
NAML



--
James Snyder
ph: <a href="tel:%28847%29%20448-0386" value="+18474480386" target="_blank">(847) 448-0386



--
James Snyder
ph: (847) 448-0386
AyCh AyCh
Reply | Threaded
Open this post in threaded view
|

Re: Elua on TWR-K60F120M

I'm using Eclipse Porlasys  as IDE . The Lua srcs files included  in the projects are compiled but i don't get Lua interactively when i flash the board . 
Why does L need implementation system calls :/ Sorry i'm beginner

On Sun, Apr 19, 2015 at 7:42 PM, jbsnyder [via eLua Development] <[hidden email]> wrote:
You may also find this implementation of syscalls.c from Michael Fischer useful for getting your initial implementation going:

Best.

-jsnyder

On Sat, Apr 18, 2015 at 4:41 PM, James Snyder <[hidden email]> wrote:
Hi,

Replies in-line.

On Fri, Apr 17, 2015 at 4:11 AM, AyCh [via eLua Development] <[hidden email]> wrote:

Hi James, thanks for answering every question that I ask. 

I have questions about the eLua and Lua scripts in general :

•About lua-cross.lua doesn’t want to be built i think because i didn't install LuaRocks , i only installed the LFW

Is it necessary to install the LuaRocks ? 


You'll need some Lua modules.  If I recall most are included in luaforwindows:

I believe all the needed modules are included in that distribution.
 

I buildt the cross-lua with Scons but the output was cross-lua.exe ? should it be cross-lua.elf?


cross-lua is a cross compiler that builds Lua bytecode that can be used on a microcontroller, it is not the binary that will run on the microcontroller.

If you want to build the binary for the TWR-K60N512 you could do this:
scons board=TWR-K60N512 prog

This will give you an elf and a bin file that could be flashed at least on the mk60n512vmd100.  You might have to modify the port for your TWR-K60F120M.
 

•Now, I have downloaded this application works on bare metal from git://github.com/laswick/kinetis.git   that I tested in   TWR-K60F120M  ( i used the demo for Gpio). My main goal is to use Lua interactively when i flash the board just like this https://twitter.com/nodemcu/status/559743827054194689. So I did these following steps:

I tried  at first to copy the src files from Lua to the project and then  add them  the C_PIECES in the make file .Also I checked the boot process from eLua (main.c) , I'm trying to open the Lua interactive when I flash the board so I used this code from main.c  (and of course after open the Lua interpreter and the Lua's library)

           char* lua_argv[] = { "lua", NULL };

           lua_main( 1, lua_argv );

But It doesn't work ! 


I haven't used the particular bare metal environment you're describing. Does it currently compile with what you're trying?  Do you have implementations for system calls that Lua will need?

If you're building with Newlib as your libc you'll need to provide your own implementations of calls that would typically be provided by an operating system as described here: 

You can find examples in the eLua sources for Newlib: 

You may only need a subset of that actually implemented for reading/writing and sbrk for the memory allocator to request heap to get the basics working.

Best.

-jsnyder
 





If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485p7578494.html
To start a new topic under eLua Development, email [hidden email]
To unsubscribe from eLua Development, click here.
NAML



--
James Snyder
ph: <a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%28847%29%20448-0386" value="+18474480386" target="_blank">(847) 448-0386



--
James Snyder
ph: <a href="tel:%28847%29%20448-0386" value="+18474480386" target="_blank">(847) 448-0386



If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485p7578496.html
To unsubscribe from Elua on TWR-K60F120M, click here.
NAML

jbsnyder jbsnyder
Reply | Threaded
Open this post in threaded view
|

Re: Elua on TWR-K60F120M

Hi,

You need the system calls so that when your MCU tries to use functions like printf it has a place to go. Likewise if you want the OS functionality those would need to have functions to call when they want to interact with the filesystem.

Also, since Lua dynamically allocates memory it either needs to have heap pre-allocated or provide functions like sbrk (https://en.wikipedia.org/wiki/Sbrk) so that the memory allocator (malloc) can request that more memory space out of the available RAM.

It looks like the kinetis project you started with does include some of these functions:

It also looks like it has some mechanism for setting up UARTs for interacting with it over the serial port:

So, that may be enough to help you get started, but I haven't tried to build anything on top of this project and it's difficult to provide recommendations without having more detail on the issues you're running into.

My recommendation would be to try the following, if you're not already doing so:

1) Make sure the sources from this project (https://github.com/laswick/kinetis) have working demos for your board without including any Lua sources.

2) Try some simple extensions of your own that include some dynamic memory allocation (malloc/free) and ensure that those work.  Also try some fgets/fputs (or scanf/printf) loops to make sure you can read & write with the serial port.  It sounds like you tried a GPIO demo, but did you try any of the printing functionality?

3) Integrate the Lua sources, get them to compile, then insert the Lua entry point after some code you already know works.

You could also try something simpler than an interpreter and maybe just initialize Lua, do a luaL_loadbuffer of one simple Lua chunk to execute, do a lua_pcall on that and exit.  Then you can build towards your interpreter either using the built-in source code or something based on this example from an older version of PiL:
(Note the warning in there about just using luaL_openlibs(L) instead of all the luaopen_ statements.)

4) Use a debugger to observe what's going on where it fails or use print statements inserted at different stages to figure out where your code is getting to.  As a further fallback, you can use GPIO & LEDs to get an idea of what stage your code is getting to.

Best.

-jsnyder

On Sun, Apr 19, 2015 at 2:15 PM, AyCh [via eLua Development] <[hidden email]> wrote:
I'm using Eclipse Porlasys  as IDE . The Lua srcs files included  in the projects are compiled but i don't get Lua interactively when i flash the board . 
Why does L need implementation system calls :/ Sorry i'm beginner

On Sun, Apr 19, 2015 at 7:42 PM, jbsnyder [via eLua Development] <[hidden email]> wrote:
You may also find this implementation of syscalls.c from Michael Fischer useful for getting your initial implementation going:

Best.

-jsnyder

On Sat, Apr 18, 2015 at 4:41 PM, James Snyder <[hidden email]> wrote:
Hi,

Replies in-line.

On Fri, Apr 17, 2015 at 4:11 AM, AyCh [via eLua Development] <[hidden email]> wrote:

Hi James, thanks for answering every question that I ask. 

I have questions about the eLua and Lua scripts in general :

•About lua-cross.lua doesn’t want to be built i think because i didn't install LuaRocks , i only installed the LFW

Is it necessary to install the LuaRocks ? 


You'll need some Lua modules.  If I recall most are included in luaforwindows:

I believe all the needed modules are included in that distribution.
 

I buildt the cross-lua with Scons but the output was cross-lua.exe ? should it be cross-lua.elf?


cross-lua is a cross compiler that builds Lua bytecode that can be used on a microcontroller, it is not the binary that will run on the microcontroller.

If you want to build the binary for the TWR-K60N512 you could do this:
scons board=TWR-K60N512 prog

This will give you an elf and a bin file that could be flashed at least on the mk60n512vmd100.  You might have to modify the port for your TWR-K60F120M.
 

•Now, I have downloaded this application works on bare metal from git://github.com/laswick/kinetis.git   that I tested in   TWR-K60F120M  ( i used the demo for Gpio). My main goal is to use Lua interactively when i flash the board just like this https://twitter.com/nodemcu/status/559743827054194689. So I did these following steps:

I tried  at first to copy the src files from Lua to the project and then  add them  the C_PIECES in the make file .Also I checked the boot process from eLua (main.c) , I'm trying to open the Lua interactive when I flash the board so I used this code from main.c  (and of course after open the Lua interpreter and the Lua's library)

           char* lua_argv[] = { "lua", NULL };

           lua_main( 1, lua_argv );

But It doesn't work ! 


I haven't used the particular bare metal environment you're describing. Does it currently compile with what you're trying?  Do you have implementations for system calls that Lua will need?

If you're building with Newlib as your libc you'll need to provide your own implementations of calls that would typically be provided by an operating system as described here: 

You can find examples in the eLua sources for Newlib: 

You may only need a subset of that actually implemented for reading/writing and sbrk for the memory allocator to request heap to get the basics working.

Best.

-jsnyder
 





If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485p7578494.html
To start a new topic under eLua Development, email [hidden email]
To unsubscribe from eLua Development, click here.
NAML



--
James Snyder
ph: <a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%28847%29%20448-0386" value="+18474480386" target="_blank">(847) 448-0386



--
James Snyder
ph: <a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%28847%29%20448-0386" value="+18474480386" target="_blank">(847) 448-0386



If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485p7578496.html
To unsubscribe from Elua on TWR-K60F120M, click here.
NAML




If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485p7578497.html
To start a new topic under eLua Development, email [hidden email]
To unsubscribe from eLua Development, click here.
NAML



--
James Snyder
ph: (847) 448-0386
AyCh AyCh
Reply | Threaded
Open this post in threaded view
|

Re: Elua on TWR-K60F120M

Yes,I already ran the demoGpio project in my board.Thank you for pointing the use of syscalls.c i didn't pay attention to that because i didn't run the other demos.
I Thought i will be easier just to try to use Lua on this simple application.I already wrote in it this code as I mentioned before
   lua_State *L = lua_open();
   luaL_openlibs(L); 
    char* lua_argv[] = { (char *)"lua", NULL };
    lua_main( 1, lua_argv );

But the problem is I don't get any errors. But when i flash the board, i can't use Lua interactively ! the eLua shell prompt is perfect idea to use  but at this stage i just want to have use Lua intertactivly .
Thanks for posting those steps , they seem reasonable to follow .I try to execute them .

On Sun, Apr 19, 2015 at 9:19 PM, jbsnyder [via eLua Development] <[hidden email]> wrote:
Hi,

You need the system calls so that when your MCU tries to use functions like printf it has a place to go. Likewise if you want the OS functionality those would need to have functions to call when they want to interact with the filesystem.

Also, since Lua dynamically allocates memory it either needs to have heap pre-allocated or provide functions like sbrk (https://en.wikipedia.org/wiki/Sbrk) so that the memory allocator (malloc) can request that more memory space out of the available RAM.

It looks like the kinetis project you started with does include some of these functions:

It also looks like it has some mechanism for setting up UARTs for interacting with it over the serial port:

So, that may be enough to help you get started, but I haven't tried to build anything on top of this project and it's difficult to provide recommendations without having more detail on the issues you're running into.

My recommendation would be to try the following, if you're not already doing so:

1) Make sure the sources from this project (https://github.com/laswick/kinetis) have working demos for your board without including any Lua sources.

2) Try some simple extensions of your own that include some dynamic memory allocation (malloc/free) and ensure that those work.  Also try some fgets/fputs (or scanf/printf) loops to make sure you can read & write with the serial port.  It sounds like you tried a GPIO demo, but did you try any of the printing functionality?

3) Integrate the Lua sources, get them to compile, then insert the Lua entry point after some code you already know works.

You could also try something simpler than an interpreter and maybe just initialize Lua, do a luaL_loadbuffer of one simple Lua chunk to execute, do a lua_pcall on that and exit.  Then you can build towards your interpreter either using the built-in source code or something based on this example from an older version of PiL:
(Note the warning in there about just using luaL_openlibs(L) instead of all the luaopen_ statements.)

4) Use a debugger to observe what's going on where it fails or use print statements inserted at different stages to figure out where your code is getting to.  As a further fallback, you can use GPIO & LEDs to get an idea of what stage your code is getting to.

Best.

-jsnyder

On Sun, Apr 19, 2015 at 2:15 PM, AyCh [via eLua Development] <[hidden email]> wrote:
I'm using Eclipse Porlasys  as IDE . The Lua srcs files included  in the projects are compiled but i don't get Lua interactively when i flash the board . 
Why does L need implementation system calls :/ Sorry i'm beginner

On Sun, Apr 19, 2015 at 7:42 PM, jbsnyder [via eLua Development] <[hidden email]> wrote:
You may also find this implementation of syscalls.c from Michael Fischer useful for getting your initial implementation going:

Best.

-jsnyder

On Sat, Apr 18, 2015 at 4:41 PM, James Snyder <[hidden email]> wrote:
Hi,

Replies in-line.

On Fri, Apr 17, 2015 at 4:11 AM, AyCh [via eLua Development] <[hidden email]> wrote:

Hi James, thanks for answering every question that I ask. 

I have questions about the eLua and Lua scripts in general :

•About lua-cross.lua doesn’t want to be built i think because i didn't install LuaRocks , i only installed the LFW

Is it necessary to install the LuaRocks ? 


You'll need some Lua modules.  If I recall most are included in luaforwindows:

I believe all the needed modules are included in that distribution.
 

I buildt the cross-lua with Scons but the output was cross-lua.exe ? should it be cross-lua.elf?


cross-lua is a cross compiler that builds Lua bytecode that can be used on a microcontroller, it is not the binary that will run on the microcontroller.

If you want to build the binary for the TWR-K60N512 you could do this:
scons board=TWR-K60N512 prog

This will give you an elf and a bin file that could be flashed at least on the mk60n512vmd100.  You might have to modify the port for your TWR-K60F120M.
 

•Now, I have downloaded this application works on bare metal from git://github.com/laswick/kinetis.git   that I tested in   TWR-K60F120M  ( i used the demo for Gpio). My main goal is to use Lua interactively when i flash the board just like this https://twitter.com/nodemcu/status/559743827054194689. So I did these following steps:

I tried  at first to copy the src files from Lua to the project and then  add them  the C_PIECES in the make file .Also I checked the boot process from eLua (main.c) , I'm trying to open the Lua interactive when I flash the board so I used this code from main.c  (and of course after open the Lua interpreter and the Lua's library)

           char* lua_argv[] = { "lua", NULL };

           lua_main( 1, lua_argv );

But It doesn't work ! 


I haven't used the particular bare metal environment you're describing. Does it currently compile with what you're trying?  Do you have implementations for system calls that Lua will need?

If you're building with Newlib as your libc you'll need to provide your own implementations of calls that would typically be provided by an operating system as described here: 

You can find examples in the eLua sources for Newlib: 

You may only need a subset of that actually implemented for reading/writing and sbrk for the memory allocator to request heap to get the basics working.

Best.

-jsnyder
 





If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485p7578494.html
To start a new topic under eLua Development, email [hidden email]
To unsubscribe from eLua Development, click here.
NAML



--
James Snyder
ph: <a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="<a href="tel:%2B18474480386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%2B18474480386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%28847%29%20448-0386" value="+18474480386" target="_blank">(847) 448-0386



--
James Snyder
ph: <a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%28847%29%20448-0386" value="<a href="tel:%2B18474480386" value="+18474480386" target="_blank">+18474480386" target="_blank"><a href="tel:%28847%29%20448-0386" value="+18474480386" target="_blank">(847) 448-0386



If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485p7578496.html
To unsubscribe from Elua on TWR-K60F120M, click here.
NAML




If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485p7578497.html
To start a new topic under eLua Development, email [hidden email]
To unsubscribe from eLua Development, click here.
NAML



--
James Snyder
ph: <a href="tel:%28847%29%20448-0386" value="+18474480386" target="_blank">(847) 448-0386



If you reply to this email, your message will be added to the discussion below:
http://elua-development.2368040.n2.nabble.com/Elua-on-TWR-K60F120M-tp7578485p7578498.html
To unsubscribe from Elua on TWR-K60F120M, click here.
NAML