Will Espruino support RTOS environments

Posted on
  • So from my understanding Espruino works at the bare metal level. So for each device ported there needs to be bindings to make it work properly.

    So my question is why doesn't Espruino use a RTOS like zephyr or free RTOS. "other then it would take a lot and lot of work".

  • 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.

  • Very interesting! This is just something i was thinking about because Nordic is releasing a new chip and i'm guessing its only going to be supported with zephyr.


  • Exactly as @fanoush said really :) The idea was to make Espruino as minimal as possible, which meant effectively the building most minimal needed RTOS as part of it.

    We do effectively support running on RTOSes in that the ESP32 build runs on top of Espressif's RTOS - there are one or two hangovers there (like Serial/Bluetooth writes going through Espruino's output buffer before they go to the RTOS) but it's not a big deal.

    The main answer for why we don't use Zephyr is that when we started the nRF51 port it wasn't available. At some point we may well have to do a Zephyr port if we want to keep using Nordic devices, but while you could get Espruino running on Zephyr pretty quick, getting Bluetooth support up to the same level that we have on the existing nRF5x devices is going to take a while!

  • https://www.nordicsemi.com/Nordic-news/2­023/10/Nordic-announces-nRF54L-Series-ex­panding-industrys-most-efficient-Bluetoo­th-LE-portfolio

    Interesting. They went multicore with nrf5340 and then they announced nrf54H20 which goes even further (Multiple Arm Cortex-M33 processors, clocked up to 320 MHz, multiple RISC-V coprocessors, USB 480Mb high speed ) https://www.nordicsemi.com/Products/nRF5­4H20

    However this nRF54L15 is back to basics, a better nrf52840, single core just faster with a bit more flash memory https://www.nordicsemi.com/Products/nRF5­4L15

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Will Espruino support RTOS environments

Posted by Avatar for user156811 @user156811