Chat about current Lua tools and IDEs

User avatar
By JamesDeehan
#88015 Hi. Just started w/esp8266 2 days ago. :). Read lot's o docs but here's my dumb question.

I flashed an esp8266 with nodemcu FW which I understand is programmed in lua.
I connect to the serial port and get a lua prompt.

And yet, I upload an example/test sketch from the interweb using Arduino IDE. That sketch is C++ file.

I realize there is a file system area in the flash as per
http://arduino.esp8266.com/Arduino/vers ... ystem.html

But how does a LUA based firmware exec a C program? I'd expect it need to be based in lua.

Is the C program compiled into a manner than the firmware can execute?

What would have been a good resource so I did not have to bother anyone here w/my q? :D
User avatar
By quackmore
#88025 that's the way I approached ESP8266, using NODEMCU and LUA

even if you will choose Arduino, give it a try, it's cool

I used ESPlorer for that

you will find some resources at the link

Enjoy
User avatar
By pangolin
#88030
JamesDeehan wrote:I get it now.

Arduino IDE replaces the entire firmware

https://forum.arduino.cc/index.php?topic=531542.0


Any flash upload should / will replace the entire binary. We need to be very careful when we talk about "upload". If the flashed program is designed to take a script which it then executes, such as LUA or MicroPython, then that is a different process and the binary stays intact.

I like to think of the latter as "sending data" to the binary interpreter. The fact we know the "data" is "code" to be interpreted doesn't really matter, but it helps to reinforce that we are NOT flashing a compiled binary.

So, using ArduinoIDE which compiles C++ and C code into a binary executable, we will totally replace what was in there before. If that is a newer version of the interpreter (I'd bet a lot of money that any interpreter that ESP8266 can run is written in C/C++) then you can still upload scripts for it to run. If its your own compiled code - then only that code will run.

If you wanted to go back to scripting language, you.d need to re-flash the interpreter firmware to overwrite your own code.

In summary then,
1) All MCU can only ever run compiled code. To get that code into the MCU you FLASH it.
2) The original language the compiled code is written in is irrelevant - it is the compiled binary that gets FLASHED
3) Some compiled binaries act as script interpreters and once loaded can read "uploaded" scripts and execute them.