Can LuaJIT be build for ESP32?

coollofty
Posts: 13
Joined: Thu Feb 14, 2019 10:09 am

Can LuaJIT be build for ESP32?

Postby coollofty » Tue Feb 19, 2019 2:33 pm

I didn't succeeded, and I cannot find any useful stuff on Google, why?

ESP_Angus
Posts: 1729
Joined: Sun May 08, 2016 4:11 am

Re: Can LuaJIT be build for ESP32?

Postby ESP_Angus » Tue Feb 19, 2019 11:38 pm

It's probably technically possible to make LuaJIT run on an ESP32, although the extra memory overhead of Just In Time compilation may stretch the available IRAM for doing useful things with the natively compiled Lua routines.

It would still need a lot of complex porting work as the "JIT" part of LuaJIT is platform-specific (emitting native instructions), and AFAIK noone has ported it the Xtensa architecture.

Have you looked at NodeMCU ESP32 support? Not fast enough in some way?

coollofty
Posts: 13
Joined: Thu Feb 14, 2019 10:09 am

Re: Can LuaJIT be build for ESP32?

Postby coollofty » Wed Feb 20, 2019 5:46 am

Yes, not fast enough, and troublesome(I like ffi) to bind C function

ESP_Angus
Posts: 1729
Joined: Sun May 08, 2016 4:11 am

Re: Can LuaJIT be build for ESP32?

Postby ESP_Angus » Wed Feb 20, 2019 6:14 am

coollofty wrote:
Wed Feb 20, 2019 5:46 am
Yes, not fast enough, and troublesome(I like ffi) to bind C function
Unfortunately "easy" ffi type functionality requires dynamic shared library loading. This is something we also don't have on ESP32 at the moment, any C code needs to be compiled and statically linked into the "final" binary.

That said, it may worth discussing with the NodeMCU developers if there is any way to make integrating C code easier with that project.

ESP_igrr
Posts: 1496
Joined: Tue Dec 01, 2015 8:37 am

Re: Can LuaJIT be build for ESP32?

Postby ESP_igrr » Wed Feb 20, 2019 6:58 am

Have you looked at using Sol2 / Sol3 for doing Lua bindings? I've used it (on another MCU platform, not ESP32) and it is pretty awesome.

coollofty
Posts: 13
Joined: Thu Feb 14, 2019 10:09 am

Re: Can LuaJIT be build for ESP32?

Postby coollofty » Fri Mar 08, 2019 3:12 pm

I found the Sol2 on Github, it is great! Thanks :)

Who is online

Users browsing this forum: Bing [Bot] and 27 guests