What’s Lua RTOS?
Lua RTOS is a real-time operating system designed to run on embedded systems, with minimal requirements of FLASH and RAM memory. Currently Lua RTOS is available for ESP32, ESP8266 and PIC32MZ platforms, and can be easilly ported to other 32-bit platforms.
Lua RTOS has a 3-layer design:
- In the top layer there is a Lua 5.3.4 interpreter which offers to the programmer all the resources provided by the Lua programming language, plus special modules for access the hardware (PIO, ADC, I2C, RTC, etc …), and middleware services provided by Lua RTOS (Lua Threads, LoRa WAN, MQTT, …).
- In the middle layer there is a Real-Time micro-kernel, powered by FreeRTOS. This is the responsible for that things happen in the expected time.
- In the bottom layer there is a hardware abstraction layer, which talk directly with the platform hardware.
Lua Threads
Lua Threads are probably the main key point of the Whitecat ecosystem programming model. Historically Lua has been a single-thread programming language, but Lua RTOS gives Lua the capacity to execute Lua functions concurrently on independent tasks which shares the same Lua state.
The capacity to execute Lua functions in different threads, makes Lua RTOS programs more intelligible, so programs are written in a similar manner to the human thought.
Pthreads API
Lua RTOS is POSIX compliant. This feature, plus the fact that Lua RTOS provides a Pthread API, ensures that programmers can compile a lot of existing software with minimal changes.
Lua RTOS functionality matrix
ESP32 | ESP8266 | PIC32MZ | |
Lua Threads | yes | yes | yes |
Pthread API | yes | yes | yes |
SSL | yes | not planned | not planned |
On-board editor | yes | not planned | yes |
Shell | yes | not planned | yes |
FAT file system | yes | not planned | yes |
SPIFFS file system | yes | yes | yes |
LoRa WAN, class A & B node | yes | planned | yes |
LoRa WAN, gateway | yes | not planned | not planned |
ADC | yes | not planned | yes |
SPI | yes | planned | yes |
UART | yes | planned | yes |
PIO | yes | yes | yes |
PWM | yes | planned | yes |
I2C | yes | planned | yes |
CAN | yes | not planned | yes |
Wi-Fi | yes | planned | not planned |
Ethernet | yes | not planned | yes |
Sensor | yes | not planned | planned |
Servo | yes | not planned | planned |
Stepper | yes | not planned | yes |