• If you like any such RTOS you can certainly port Espruino to it, you need to make another target and implement at least the jshardware layer, simplest to start from may be the Linux target https://github.com/espruino/Espruino/tre­e/master/targets/linux Also if you would like to use just the bare interpreter you can use EMBED target https://github.com/espruino/Espruino/blo­b/master/boards/EMBED.py#L15 and include it into your RTOS based application.

    why doesn't Espruino use a RTOS like zephyr or free RTOS

    Espruino (and javascript) is single threaded and manages memory with its own garbage collector so there are not that many RTOS APIs and abstractions that would give some advantage for using it internally on every platform. Currently the core is OS agnostic so can be easily ported to anything. Picking one specific RTOS could actually limit portability. Just checked ZephyrOS vs ESP32 and it got much better recently https://github.com/zephyrproject-rtos/ze­phyr/issues/29394 but was not there in 2020 (Espruino is a bit older :-)

    Also being baremetal it still builds for nrf51 with 16KB RAM/256 KB Flash including Bluetooth or for stm32F103 with 20/128 KB ram/flash. RTOS would add some bloat for basically no gain.

    But fortunately it is not either or situation, anyone can certainly add some RTOS target for new or existing platforms/boards.


Avatar for fanoush @fanoush started