0
votes

NodeMCU documentation states

NodeMCU firmware build now automatically generates a luac.cross image as standard in the firmware root directory; this can be used to compile and to syntax-check Lua source on the Development machine for execution under NodeMCU Lua on the ESP8266.

Where do I get luac.cross from and how do I install it?

Do I build NodeMCU firmware from source on Mac and is luac.cross created as part of that process? I have been using the cloud service to create custom firmware. Is luac.cross available via cloud build?

Straight lua code has overwhelmed the MakerFocus NodeMCU board resulting runtime panic with out of memory issue. Hoping compiled code will reduce RAM needs.

2

2 Answers

1
votes

Where do I get luac.cross from and how do I install it?

You gave the answer in the quote from the documentation you posted. Specifically this

NodeMCU firmware build now automatically generates a luac.cross image...

So, if you build the NodeMCU manually on your platform the build process will also create a lua.cross for your platform. That's the reason you cannot download or install lua.cross - it has to fit your platform i.e. OS et.al.

The logical next question would then be: how do I manually build NodeMCU on macOS?

I don't know the answer to that as I build with the Docker image (from yours truly) on macOS. Running the Docker build creates a luac.cross in the firmware root directory. However, as macOS is just the host OS for Docker in this setup luac.cross is for Linux rather than native for macOS. To use it you would start the Docker container again and run bash in it to get a shell to execute the Lua cross compilation: docker run --rm -ti -vpwd:/opt/nodemcu-firmware marcelstoer/nodemcu-build bash.

Straight lua code has overwhelmed the MakerFocus NodeMCU board resulting runtime panic with out of memory issue. Hoping compiled code will reduce RAM needs.

I hate to disillusion you, but if I had to bet I would expect that savings won't be significant enough to yield the expected results. As you already started reading documentation I'd like to point you to the relevant FAQ: How is NodeMCU Lua different to standard Lua? and Techniques for Reducing RAM

And maybe using LFS will be your life saver.

0
votes

In case you want to use this tool regardless of the platform - you can use my API to build it:

curl -d @yourscript.lua -X POST https://nodemcu-luacross-run-64l7ehzjta-uc.a.run.app/compile > output.luac