Embedded RTOS middleware
March 25, 2024

RTOS systems provide specially designed middleware solutions that are tailored to the needs of a specific operating system. Customization for a specific solution is designed to enhance its performance and capabilities. The following table and accompanying description provide an overview of the capabilities of RTOSes such as FreeRTOS, ThreadX, embOS, and Zephyr. What are we comparing? What we think is most often problematic: file handling, USB communication, TCP/IP stack, and several other functionalities.

According to our experience, middleware support for RTOS is one of the key things in project development. RTOSes, of course, meet such needs and provide their own solutions developed specifically for their system. The table below presents in a condensed way the information that can help in the selection of an RTOS depending on the project requirements. An elaboration of several aspects with commentary is below it.

Below we will go through the most important components of the middleware layer from our perspective.

Middleware comparison - FreeRTOS vs ThreadX vs embOS vs Zephyr

File management

  • Zephyr: offers the Zephyr RTOS Virtual Filesystem Switch (VFS) - this system provides so-called Mount points allowing you to hook up separate (including your own) file systems to your application; the Zephyr repository provides several examples of running such a system, such as in FAT format;
  • FreeRTOS: Offers FreeRTOS-Plus-FAT which is a file system compatible with FAT 12/16/32, DOS/Windows. The system is still under development and configuration is done traditionally as in FreeRTOS i.e. by modifying parameters in the corresponding header file.
  • ThreadX: FileX supports the same formats as FreeRTOS (FAT 12/16/32) but also offers FLASH memory usage level analysis in the form of an additional LevelX module.
  • embOS: Segger offers 4 packages: PRO, FAT, EFS and Storage Layer. The most advanced, or PRO, offers support for FAT12/FAT16/FAT32 and ready-made drivers for NAND and NOR FLASH memory. In addition, data can also be encrypted with DES and AES ciphers.

FAT eternally alive. Zephyr's solution seems the most universal - it supports versions from old-school FatFs (still written in ANSI C89) through the more secure LittleFS. The FreeRTOS and ThreadX solutions are the same.

‍USB

  • Zephyr: Zephyr provides a stack for the device and support for classes such as audio and BT. Unfortunately, the host is only available as an experimental library - ultimately, it is intended to replace the current one.
  • ThreadX: USBX is a stack that offers host and USB device support, as well as an OTG (on-the-go) option. The module is lightweight (the code takes up 10.5 KB for the device and 18 KB for the host) and specially prepared to work with FileX.
  • embOS: USB support is divided between 2 separate middleware: emUSB-Host and emUSB-Device. The license is divided into 2 versions: Pro and Base. Base offers basic storage and HID support, while Pro extends it with at least audio, video and printer support.

Zephyr OS and embOS provide their own integrated USB stacks, making implementation easy. FreeRTOS requires external solutions to support USB, which provides flexibility, but may also require additional integration work. ThreadX, via USBX, offers extensive USB support. The lack of USB support from ThreadX is an unpleasant surprise.

TCP/IP

  • Zephyr: Zephyr provides a full Network Stack allowing full configuration - using provided solutions, or basing new ones on selected architecture layers. Among the protocols provided are basic IPv4 or IPv6, but also support for WiFi, Ethernet, BT and CAN. MQTT, popular in IoT, is also available.
  • FreeRTOS: Offers several separate libraries. FreeRTOS-Plus-TCP is a basic TCP/IP stack that supports IPv4 as well as IPv6, ideal for smaller microcontrollers. The needed protocols can be added using separate coreHTTP, coreSNTP and coreMQTT libraries. In addition, Amazon, as owner of FreeRTOS, offers libraries to integrate functionality specific to AWS IoT services.
  • ThreadX: Microsoft's core proprietary NetX library is a stack for TCP/IP IPv4. It offers the most commonly used protocols such as HTTP, DHCP, UDP, TCP, as well as support for Ethernet, WiFi and BLE. Separately, you can also use NetX Duo which is, so to speak, another step that extends the standard with IPv6 and SSL/TLS/DTLS security. In addition, Duo also includes middleware between ThreadX and the Azure SDK used to support Azure IoT services for easy integration.
  • embOS: emNet, used in J-Link programmers, is advertised as a base for IoT applications - it provides a TCP/IP stack and protocols such as UDP or TCP on which higher layers can be easily built. An RTOS is of course recommended for operation, but standalone operation without it is also possible. In addition, Segger offers support for RTOSes other than their own. emNet also provides support for Ethernet and WiFi (requires a separate driver);


Zephyr OS and embOS are distinguished by their extensive library support and modularity in the context of the TCP/IP protocol. FreeRTOS provides an external FreeRTOS+TCP module that can be configured for specific needs. ThreadX, on the other hand, offers powerful NetX and NetX Duo stacks that are well integrated with the Microsoft ecosystem, including Azure IoT.

Cryptography

  • Zephyr: provides 2 cryptographic libraries. The first is TinyCrypt providing basic algorithms such as SHA-256 and designed for small devices (with limitations on memory or processing power). The second library, on the other hand, is used to generate true and pseudorandom numbers as required by NIST (National Institute of Standards and Technology - a US government agency).
  • FreeRTOS: FreeRTOS offers corePKCS11 based on PKCS#11 (an implementation of the standard under FreeRTOS). This is an API used to manipulate cryptographic objects in such a way as to not share their contents with program memory (private keys, certificates). For example, this library is used by AWS for key authentication in the TLS protocol.
  • embOS: emCrypt is the cryptographic library on which Segger's other products targeting encryption are built: emSSL, emSSH and emSecure. emCrypt itself (BASE version) includes a wide range of the most popular algorithms (AES-128/256 DES, 3DES, SHA-224/512).

ThreadX (actually Eclipse ThreadX) stands out here by far for its lack of broader support for cryptography libraries.
Is it a matter of microcontrollers getting cheaper and cheaper with hardware support for cryptography?

GUI

  • ThreadX: GUIX provides an API that allows standard GUI support, i.e. drawing basic shapes, math functions, drivers for popular displays, a library of ready-made widgets or reading .jpg files. In addition, Microsoft also provides GUIX Studio, a desktop application in which you can create the interface fully graphically (WYSIWYG) and then generate code in C based on it, ready for use in the application.
  • embOS: emWin has 4 licensing versions: PRO, BASE color, BASE grayscale and BASE b/w. PRO additionally has at least an anti-aliasing option or widget support, while the rest differ in the available colors. Like GUIX, emWin also has its own dedicated application that allows you to design the interface without writing a single line of code - AppWizard. 

No support from Zephyr and FreeRTOS for graphics libraries.
Yes, you read that right - you want anti-aliasing in embWin-> you have to buy the right version of the library.
We haven't encountered a similar approach from any graphics library vendor (TouchGFX, Embedded Wizard, LVGL or Microchip Graphics Library) so far.

In the list above, you can see the general trend.
Extensive support inside RTOS (Zephyr, embOS) vs external modules (freeRTOS) vs proprietary solutions (ThreadX).

#RTOS #Zephyr #FreeRTOS #ThreadX #embOS #GoodByte