Making Sense Of Real-Time Operating Systems In 2024

The best part about real-time OS (RTOS) availability in 2024 is that we developers are positively spoiled for choice, but as a corollary this also makes it a complete pain to determine what the optimal choice for a project is. Beyond simply opting for a safe choice like FreeRTOS for an MCU project and figuring out any implications later during the development process, it can pay off massively to invest some time up-front matching the project requirements with the features offered by these various RTOSes. A few years ago I wrote a primer on the various levels of ‘real-time’ and whether you may even just want to forego an RTOS at all and use a simple Big Loop™ & interrupt-based design.

With such design parameters in mind, we can then look more clearly at the available RTOS options available today, which is the focus of this article. Obviously it won’t be an exhaustive comparison, and especially projects like FreeRTOS have seen themselves customized to various degrees by manufacturers like ST Microelectronics and Espressif, among others. This also brings to the forefront less pleasant considerations, such as expected support levels, as illustrated by e.g. Microsoft’s Azure RTOS (formerly ThreadX) recently getting moved to the Eclipse Foundation as the Apache ThreadX open source project. On one hand this could make it a solid open-source licensed RTOS, or it could have been open sourced because Microsoft has moved on to something else and cleared out its cupboard.

Thus without further ado, let’s have a look at RTOSes in 2024 and which ones are worth considering, in my opinion.

Answering Some Questions

A crucial distinction when looking at operating systems for embedded systems is the kind of platform it is. If it’s something along the lines of an x86, Cortex-A ARM or similar, you’re likely looking at a desktop-like system, where a real-time OS such as VxWorks, QNX, a BSD or Linux (with or without real-time patches) is probably the best choice, if only due to hardware support concerns. For situations where hard real-time considerations are the most essential, an FPGA/CPLD-based solution might instead be worth it, but this is of course less flexible than an MCU-based solution.

If at this point an MCU-based solution seems the most sensible one, the next logical question is ‘which one RTOS?’. The answer to this is hidden somewhere in long lists of RTOSes, such as the one found over at Wikipedia, or the one over at the OSRTOS website. Assuming for a moment that we are looking only at open source RTOSes here that are seeing active development, we can narrow it down somewhat to the following list:

Of note is that the popular Mbed project was abandoned in July of 2024, rendering the future of this RTOS highly uncertain. Even with that one taken out of the picture, we are still left with an impressive list. Is NuttX better than ThreadX? What about Zephyr versus RIOT or ChibiOS/RT? Merely reading the bullet points for the features gets one only so far. Perhaps the most important questions here pertain to issues such as:

  • Build system requirements
  • Demands on a specific compiler (version)
  • Programming languages one can use with the OS
  • Whether direct hardware access to peripherals is allowed or require going through a HAL of some description.
  • Support availability when something inevitably doesn’t work as expected.
  • Accessibility of the source code when reading through it (readability, documentation, etc.)

Baseline Expectations

The baseline for the build environment demands and supported features is set here at FreeRTOS. It runs on a wide range of (MCU) platforms, provides a number of schedulers, SMP support, happily compiles with just about any compiler toolchain and is C-based so can be used with any programming language that can cooperate with C APIs. Direct hardware access is the standard way for peripherals and the OS generally gets out of your way beyond scheduling and multi-tasking matters. This ‘stay out of the way’ approach persists with developer tools and configuration, which works as easily in Vim as in any other editor.

ThreadX

As of writing the documentation is a stack of Markdown files on GitHub which are clearly not converted yet from their Azure OS era, and ‘getting started’ refers to connecting to the Microsoft Azure cloud. Building the library is apparently done using CMake, Ninja and the standard ARM GCC toolchain for ARM targets, but where’s a sample project and what about other MCU platforms?

After confusing myself clicking through the ‘documentation’ for a while, I’m sure that I would not pick this RTOS as I am spending far too much time even figuring out the basics.

Contiki-NG

Documentation exists and doesn’t look too bad, but you’re pushed right into using a Docker image for development. Fortunately native installation instructions are provided for Linux and MacOS, but not Windows. It’s clear that this RTOS is focused on Internet of Things projects, while the ability to easily run the code as a native (Linux) process is nifty.

Feels like this RTOS could be nice for network-related projects.

OpenERIKA

Confusing website and the impression is that it’s ‘free’, but do not expect any support unless you’re willing to pay for it. Hard pass.

MicroC/OS

I’m sure that Silicon Labs had good intentions with their Micrium OS site, but it’s too hard to find anything on it, never mind how to get started with the thing, plus it seems locked to Silabs devices. Ditto for the Weston-Embedded website. Hard pass.

RIOT

Seems to use basic tools and the standard platform toolchains per the ‘getting started‘ documentation. Build system is GNU Make-based, which is very flexible and should integrate with other build systems with little issue. Quite a lot of documentation to dig through, and might be worth scratching an itch with that FreeRTOS doesn’t cover?

NuttX, Zephyr, ChibiOS/RT

RTOSes which have lots of bullet points are kinda fancy, but demanding the use of KConfig with NuttX, the insistence on setting up a special Python-based development with Zephyr and the seemingly hard requirement to use the special IDE with ChibiOS/RT all makes for problematic choices that will make developing with these either impossible — KConfig on Windows — or integrating with other build systems impossible to tedious.

While I’m not a Python hater, my experiences with Python-based build environments and tools are very negative, and I’d rather avoid such unnecessary dependencies in a development workflow. If you’re a Python fan, you might want to look more seriously at Zephyr.

With that said, the remaining RTOSes in the list are fairly small and can probably be skipped safely.

FreeRTOS

Back in my original 2021 article I covered getting started with FreeRTOS, which at the time was focused mostly on STM32 and similar ARM-based MCUs. Since then I have extensively expanded my use of FreeRTOS in the form of Espressif ESP32 development, both on the base ESP32 MCU and the ESP32-S3. This provided a range of interesting perspectives, also since I was porting significant amounts of cross-platform C and C++ code to these MCUs.

An important aspect of FreeRTOS is that it is commonly included in MCU SDKs, as is the case with Espressif’s ESP-IDF. It supports three different versions of FreeRTOS: the single-core ‘vanilla’ FreeRTOS, the Espressif (SMP) version and Amazon’s SMP FreeRTOS. Espressif’s version is optimized for the dual-core design of the ESP32 and ESP32-S3 and the default choice. What this demonstrates clearly is that the strength of FreeRTOS lies in its flexibility. You can slot in any custom scheduler, heap allocation algorithm, and pile on additions that are optimized for the target platform.

ESP-IDF provides partial POSIX compatibility, which uses FreeRTOS primitives internally. In order to port projects based on the cross-platform PoCo libraries, I added FreeRTOS support to these in the compatible NPoCo project. With this approach I can use virtually all of the features provided by the PoCo libraries also with (ESP-IDF) FreeRTOS, while allowing for the exact same code to compile on desktop platforms. The only platform-specific elements (e.g. start-up and peripheral use) are handled by compile-time preprocessor inclusions.

Drawing Conclusions

Although there are many ways to go about developing a project and advocating a particular approach is the best way to end up forever shunned by friends & colleagues, looking at a different approach can be enlightening. Over my own career I have gravitated strongly towards simplicity and reducing potential pain points. A big part of this is finding the optimal ways to do as little work as possible, which is where my own approach to MCU-based RTOSes comes from. I really don’t want to write more code than absolutely necessary, also because new code has new bugs.

As software is incredibly flexible, the real value in an (RT)OS lies in the scheduler, heap allocator and similar elements which provide the primitives on which other features can be built. While many RTOSes seem to go out of their way to (incompatibly) replicate the scope of the entire Linux kernel space & userspace in miniature, this to me at least seems restrictive. What I personally appreciate in FreeRTOS is that you can have as much or as little FreeRTOS in your code as you want, making it extremely hackable.

For others their priorities may be completely different, in which case any of the other RTOSes may work better, which is also perfectly fine. As long as the project is completed on time, within budget and no keyboards were thrown through the room, there are no wrong choices.

18 thoughts on “Making Sense Of Real-Time Operating Systems In 2024

  1. I like FreeRTOS so far: it provides all the features I want without a lot of extra bloat and it’s easy to use, since it only requires a few clicks to set up with the STM32 SDK and it’s already baked into ESP-IDF.

    I haven’t needed any of the more advanced features of e.g. Zephyr and I’ve never used any of the Pic microcontrollers, so I don’t know what the landscape is over there.

  2. Some comments from my own experience:

    FreeRTOS: fine for what it does, but for many purposes you’ll need to combine it with a bunch of extra drivers and libraries and that can be quite a hassle.
    NuttX: feels quite familiar when coming from Linux background. The build can be done on Windows, but is indeed easiest to setup on Linux or WSL. A decade back I was constantly hitting bugs with NuttX, but it feels a lot more stable nowadays.
    Chibios: well designed hardware drivers. No need to use the IDE, build process is just regular makefiles. Paid license needed if GPL is not suitable for the project.

    1. You overlook NuttX has the ridiculous “feature” of needing different drivers for MCP2515 used on different platforms, not to mention the horrible spaghetti of header files which makes almost impossible to fix dependencies in a reasonable manner

      Basically, NuttX is a scam conducted by a gang associated with its main developer

  3. I’ve used or evaluated most of these over they ears. They’re all fairly good. And getting one to work with a product, assuming the feature set matches your needs, boils down to investing the time into learning the OS and its tools.

    ThreadX is great and when it went open source it was great news for some.
    NuttX/Tizen is pretty straight forward and good for getting something up and going pretty quickly.

    For closed source there are a lot of good RTOSes out there. Nucleus RTOS is still great. I somewhat miss working on the paid version of eCos. I don’t miss VxWorks, mostly because of the add on components are so bad and not worth the money. QNX is of course fantastic to develop on if money is no object on your project.

    1. Must agree on ThreadX. The OS is available to selected STM32 chips via STM32MX tool, and we found it to be lightweight and memory efficient. I still prefer FreeRTOS just because I’ve used it long enough that I have muscle memory for its idioms and naming conventions.

    2. I used VxWorks on a VME crate when working at CERN. It was decent, but I tried to avoid it. Since then, there seems to be lots that is better.

      I’ve kept an eye on Lynx, they do a range of “aviation-certified” RTOS’, but I’ve no clue if they’re actually any good.

      Do you know of any reliable sources of information on the various RTOS? FreeRTOS has books, SEL4 (as far as I know) doesn’t, CapROS barely has a website, and so feature comparisons are quite difficult.

  4. I have used ChibiOS in the past and it is normal Make-based build system. There are also quite a few CMake wrappers for it around. The ChibiStudio IDE is certainly not required – I have never used it myself. No idea where did author come to the notion that this is a hard requirement? The website doesn’t say anything of the sort.

    1. I regularly use ChibiOS and never used the ChibiStudio IDE. It is definitely not required. It can help you set up the IO pin configuration for your board, but you can easily do that by defining them in an XML file instead.

      One thing to note is that ChibiOS comes with an extensive HAL (Hardware Abstraction Layer) that really earns that name, in that the hardware of the supported microcontrollers is abstracted in a vendor-neutral way. So porting a project for example from a STM32 to a RP2040 becomes quite easy.

      There is a free book-style documentation available which gives a good introduction:
      https://www.chibios.org/dokuwiki/doku.php?id=chibios:documentation:books:rt:start

  5. Another one is RTE/MS. Besides having the most hard-core acronym (originally Real Time Executive for Missile Systems, and yes it started out as DoD rocket science.) Used in several sattelites and space probes. Hard (very deterministic) real time, continuing if low-key development, free mailing-list-level support with commercial support avail. Distributed and heterogenious–e.g. ARM and x86 processors/threads in the same system. C/C++/Ada. Slightly patched GNU toolchain. POSIX, FreeBSD drivers support. Documentation decent. Lots of different BSPs, including RPi (though limited HW features support, no put-it-in-hard-real-time mode for the BSP).

  6. FreeRTOS : Simple workhorse, easy to work with, simple to setup and just works. Don’t mind writing the drivers at all, since everything works as expected.

    OpenRTOS : Same as above, but i like it less.

    ChibiOS : My brain thinks of it as FreeRTOS but with more complex networking options available. More experience required on my part to get a better taste of it though. It stays out of the way and lets me do whatever I want. iirc their GPIOs are called “pads” or something, but its quite run-of-the-mill otherwise.

    Zephyr : Quite decent for IoT applications. If you want anything close to the hardware (using comparators, or other chip specific mixed signal hardware, or anything that’s not in their library) or anything timing crucial, you are in a world of hurt. 99% config, 1% actual programming. Good luck spending your days searching google for the one missing line of config you missed. 0 debuggability, compiler errors are complete nonsense. Provided sensor driver library is impressive at a glance but if you want anything that’s not the easiest and most obvious and straightforward thing, you will have to rewrite the driver, often completely from scratch. Its like arduino kind of libraries.

    Still I will say, its good when you just want stuff to work and don’t care what’s happening under the hood. I won’t say that’s a good thing but I’ve had days at work where I just want stuff to work so I can go home. Zephyr is perfect for those days.

    Also last thing, if your platform isn’t well supported by zephyr, DO NOT USE IT

    /rant over. As an engineer, I believe I am free to attack poor engineering decisions, but never the people behind the decisions.

  7. Personally, I’d have added at least one more to that list. SEL4, definitely, as it provides certain guarantees, which never hurts and is definitely different.

    CapROS, RTAI, and Xenomai definitely have unique qualities, but its not clear how useful they are or what state they’re in.

  8. I used NuttX a little some 6 years ago. When it works, it’s not bad, and it is nice to have a POSIXian system API relative to the FreeRTOS which I now use almost exclusively.
    The main problem I had is that I was using an STM32L476, which was then new, so support had to be added. That meant creating headers for all the SFRs, etc., and implementing all the drivers, because it doesn’t like to use the stuff provided by the silicon vendors.
    If you’re using an ‘F4, then you’ll be better off.

  9. No eCos? But… eCos provides a platform for all the zany architectures like CalmRISC, FR-V, Hitachi H8, Motorola 68000, Matsushita AM3x, MIPS, NEC V850, Nios II, PowerPC, SPARC, and SuperH! ;)

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.