Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: gavinmc42 on February 17, 2015, 11:42:52 PM

Title: Lua or ?
Post by: gavinmc42 on February 17, 2015, 11:42:52 PM
I see Luajit in in the tcz's

Has anyone got Lua going on the Pi?

I want a scripting interpreter that is faster than shell and smaller than python.
Is Lua the only one that fits?

Got some Pi 2 's on the way and I want to try multi threading for robotics/drone stuff.
Title: Re: Lua or ?
Post by: bmarkus on February 18, 2015, 02:10:41 AM
A while ago we tested different languages on RPi. It was a simple test generating prime numbers. Goal was not a generic benchmark but to see arithmetics. The winner was LUAJIT which was a big supprise. It was found that LUAJIT used floating point aritmetics for integer operation where it was faster. C, BACON (the BASIC compiler) and GO were a bit slower but very closed. These four were followd by RUBY,  than PERL and PYTHON which were much slower. So LUAJIT seems to be a good choise.

Title: Re: Lua or ?
Post by: gavinmc42 on February 18, 2015, 02:29:54 AM
OK, so another language to learn:(

Luajit = Lua Just In Time compiler, so compiled not interpreted.
A bit like Java?

450kB compared to 20MB+ for python.

Wonder if it can talk to the GPIO etc?
Title: Re: Lua or ?
Post by: bmarkus on February 18, 2015, 03:01:31 AM

Luajit = Lua Just In Time compiler, so compiled not interpreted.


In between, it is a Just In Time. See

http://stackoverflow.com/questions/95635/what-does-a-just-in-time-jit-compiler-do
http://en.wikipedia.org/wiki/Just-in-time_compilation
Title: Re: Lua or ?
Post by: gavinmc42 on February 23, 2015, 02:09:14 AM
Got new Pi 2, yippee, so fast.

Been using the Pi 2 running latest Raspbian to test Lua and this library.
https://github.com/vsergeev/lua-periphery

Just got Lua GPIO code to turn LED on.
Yep also works with LuaJIT to.

Now the question is how to get the lua-periphery library ported to piCore?

This is day one of Lua coding for me.

piCore base plus LuaJIT plus app code on Pi A+ all in 25MB?
Can you still get 64MB microSD cards:0

Title: Re: Lua or ?
Post by: bmarkus on February 23, 2015, 02:31:42 AM

Now the question is how to get the lua-periphery library ported to piCore?


It is just a C code. No need to port, just compile and try. If works, create a TCZ.
Title: Re: Lua or ?
Post by: gavinmc42 on February 23, 2015, 03:28:04 AM
Hi,

I don't suppose you want to make a full development version of piCore to run on the Pi 2?
With Lua, python, C compiler and IDE(Geany?) preinstalled for Pi and Pi 2.
Base, SSH, X and DevX++.

Been meaning to learn how to make tcz's .
TC/PiCore will be what I will be using for all my Pi based embedded devices.
This is now on my list of things to do, but it is a long list:)
Title: Re: Lua or ?
Post by: bmarkus on February 23, 2015, 03:52:24 AM

I don't suppose you want to make a full development version of piCore to run on the Pi 2?


Why?
Title: Re: Lua or ?
Post by: gavinmc42 on February 23, 2015, 07:40:02 PM
Hi Bela,

Most of my development is done off Net behind the University firewalls.
So it is hard to install tcz's, mostly I have to do it manually, which does not work most of the time.
Imagine trying to manually install GCC:(

That's why I mostly use Busybox ash shell scripting now, but it is too slow for some the stuff I need to do.
But it is reliable with 65 and 35 days uptime on two systems so far:)

LuaJIT is a small tcz and does not need large dependencies/libraries like python, apart from that Lua-periphery one.

Pi 2 with piCore  X windows, SSH and Dev tools + SDKs would be fast enough for native development?

Gavin