Raspberry Pi Real-Time OS (RTOS)

OS to RTOS

The Raspberry Pi Zero W single-board computer beside the Raspberry Pi Pico microcontroller board
The Raspberry Pi Zero W single-board computer beside the Raspberry Pi Pico microcontroller board (Source: Tom's Hardware)

Raspberry Pis make up a family of single-board computers (SBCs) by the Raspberry Pi Foundation. Initially developed as an educational tool, they’ve gone on to be used in all manner of projects, including robotics, home automation, IoT, personal and commercial uses. These credit card-sized computers are capable of tasks performed by a regular PC, such as word processing, programming, and web browsing.

On a personal desktop computer, you’re likely using a full-scale operating system like Windows, MacOS, or Linux. (Some Raspberry Pis are capable of running Windows, but their native OS is based on Linux.) But sometimes, these types of operating systems are too resource-intensive for your task. For certain projects, a real-time operating system (RTOS) is a more suitable choice.

RTOS on Pi

Just as the name suggests, an RTOS is meant for time-critical use cases, or in other words, projects with a timing requirement that must be met. Some examples can be seen in spacecraft systems, heart pacemakers, and air traffic control. In contrast to a general-purpose computing system, real-world uses like these require precise time constraints to manage and prioritize tasks.

It must be noted that it’s more standard to use a microcontroller board like an Arduino for real-time tasks. That said, Raspberry Pi SBCs are inexpensive, have a huge community, and offer ample educational resources to get you started. The Raspberry Pi foundation has also released the Raspberry Pi Pico, their first microcontroller board.

Limitations

If you do intend to run an RTOS on a Raspberry Pi SBC, some limitations need to be made note of. An important requirement for an RTOS system is sufficient random-access memory (RAM), which older Raspberry Pi models may not have. Depending on your specific use, you’ll also need to pay attention to your board’s maximum clock speed (the Raspberry Pi 4 can reach up to 1,500 MHz, but this is not true across the range).

Additionally, Raspberry Pi SBCs lack a real-time clock (RTC), and instead keep time via an internet connection. This could mean less reliability and accuracy for time-critical feedback applications. However, there are workarounds for this issue, such as adding a real-time clock module. In fact, the Raspberry Pi Pico is already equipped with RTC hardware.

(Note that the “real-time” in RTC is not the same as the “real-time” in RTOS. The former refers to a device capable of telling time in the real world, whereas the latter refers to non-interrupted timing in electronics.)

If you have a project in mind that needs an RTOS, there’s a wide variety to choose from. Let’s look at some of the best RTOS options for Raspberry Pi!

Back to Contents

Advertisement
Advertisement
Advertisement
1
Raspberry Pi Real-Time OS (RTOS)

FreeRTOS

FreeRTOS is a well-document RTOS with strong community support
FreeRTOS is a well-documented option with strong community support (Source: FreeRTOS)

FreeRTOS, as you can probably guess from the name, is a free, open-source RTOS for embedded systems. It’s a relatively small application composed of just under 9,000 lines of code, including comments! Despite its small size, it’s capable of prioritizing, scheduling, and running user-defined tasks. About 40% of its code deals with communication between tasks, so it’s a strong option for projects with competing priorities.

FreeRTOS is actively being developed and supported and is even available for use in commercial applications. This means users can bring their product to market using FreeRTOS without permission or even payment to the developers.

GitHub user jameswalmsley has put together a basic port of FreeRTOS to Raspberry Pi, which would be a good starting point if you want to try it out for yourself.

  • Developer: Richard Barry (now managed by Amazon Web Services)
  • Intended purpose: A single, independent solution for time-critical embedded system applications; a smaller and easier-to-use option
  • Notable features and functions: Provides methods for multiple threads or tasks, mutexes, semaphores, and software timers; tickless mode for low-power applications

Back to Contents

Advertisement
Advertisement
Advertisement
2
Raspberry Pi Real-Time OS (RTOS)

ChibiOS

A close-up look at ChibiOS on an STM32 Nucleo F401RE
A close-up look at ChibiOS on an STM32 Nucleo F401RE (Source: PLAY Embedded via YouTube)

ChibiOS is a compact and fast real-time operating system. Despite its small size (though it’s not quite as small as FreeRTOS), there’s no compromise to performance. It’s scalable from 8-bit architecture upwards, is functionally complete, and has a fully static architecture as well as a clean and elegant codebase.

If you want to use it, ChibiOS is available under three licenses: There are open source and commercial options available for free, and a full commercial license, intended for large-scale deployment, for a fee.

GitHub user steve-bate has shared a Raspberry Pi port for ChibiOS and has a helpful guide to getting started, including hardware explanations.

  • Developer: Giovanni Di Sirio
  • Intended purpose: A compact, fast RTOS
  • Notable features and functions: Uses efficient double-linked circular lists for most of its internal data structures, such as a ready list, timers list, and queues of threads

Back to Contents

Advertisement
Advertisement
Advertisement
3
Raspberry Pi Real-Time OS (RTOS)

RTEMS

RTEMS is an RTOS that has been used for time-critical applications such as space flight
RTEMS is an RTOS that has been used for time-critical applications such as space flight (Source: radu5toma via YouTube)

Real-Time Executive for Multiprocessor Systems (RTEMS) is an open-source option that supports open API standards such as Portable Operating System Interface (POSIX). It’s been used in space flight, medical applications, networking, and many more embedded systems.

RTEMS is regularly updated with new stable releases and has a Discord server for community support.

Unlike some of the other options on this list, RTEMS directly supports Raspberry Pi hardware. If you want to try it out, the package can be downloaded from the RTEMS website, and there’s a useful guide on how to set it up.

  • Developer: OAR Corporation
  • Intended purpose: Applications for space flight, medical industries, networking, and more
  • Notable features and functions: Designated support package for Raspberry Pi

Back to Contents

Advertisement
Advertisement
4
Raspberry Pi Real-Time OS (RTOS)

RT-Thread

RT-Thread is an open-source RTOS that can run on RP2040 development boards
RT-Thread is an open-source RTOS that can run on RP2040 development boards (Source: RT-Thread)

RT-Thread is an open-source and scalable real-time operating system. It’s compatible with x86, ARM RISC-V, and Xtensa hardware, and there’s a Nano version for resource-constrained devices. The minimum kernel only needs 1.2 KB of RAM and 3 KB of flash, which is far less than your Raspberry Pi is likely to have available.

RT-Thread specifically supports RP2040-based development boards like the Raspberry Pi Pico, and it also lists support for Raspberry Pi models 2, 3, and 4. There’s also a graphical IDE (RT-Thread Studio) that makes this RTOS much more accessible for less-experienced developers.

  • Developer: Bernard Xiong & RT-Thread Team
  • Intended purpose: Embedded applications and IoT devices
  • Notable features and functions: Designated support for several Raspberry Pi SBC models and the Pico; graphical IDE

Back to Contents

Advertisement
Advertisement
5
Raspberry Pi Real-Time OS (RTOS)

NuttX

NuttX has received initial support for the Raspberry Pi Pico and other RP2040 boards
NuttX supports the Raspberry Pi Pico and other RP2040 boards (Source: Gareth Halfacree via Hackster)

NuttX is an RTOS that focuses on standards compliance, specifically POSIX and the American National Standards Institute (ANSI). Its second focus is on scalability, and it’s compatible with microcontroller environments from 8-bit to 64-bit.

It’s also been ported to the new Raspberry Pi Pico and other boards based on the RP2040 microcontroller. There’s full support for symmetric multiprocessing (SMP) operation for its two ARM Cortex-M0+ cores.

  • Developer: Gregory Nutt
  • Intended purpose: RTOS compliant with international standards
  • Notable features and functions: Small footprint, scalability

Back to Contents

Advertisement
Advertisement
6
Raspberry Pi Real-Time OS (RTOS)

TrampolineRTOS

The TrampolineRTOS respository is maintained on GitHub
The TrampolineRTOS respository is maintained on GitHub (Source: TrampolineRTOS via GitHub)

Trampoline is designed for small embedded systems and is a static RTOS, which means the user has more control over the memory allocation. This type of RTOS is more complicated to operate but can be a more stable and predictable option for repetitive tasks.

The Trampoline API is aligned with automotive standards, but this is a straightforward option with applications far beyond that single industry. The Broadcom BCM2836 processor used in earlier Raspberry Pi models is specifically supported in the documentation, so if you have an older Pi lying around, this will be a safe and stable option.

  • Developer: Real-Time System Group at LS2N
  • Intended purpose: Embedded RTOS for automotive contexts
  • Notable features and functions: Static RTOS; support for older Raspberry Pi models

Back to Contents

Advertisement
Advertisement
7
Raspberry Pi Real-Time OS (RTOS)

RODOS

The RODOS embedded operating system on GitLab
The RODOS embedded operating system on GitLab (Source: rodos via GitLab)

Realtime Onboard Dependable Operating System (RODOS) is another open-source embedded option that was originally developed to control satellites, so you know you can trust it for accuracy! After all, it was developed in the German Aerospace Center, and it’s still used for the center’s microsatellite program.

RODOS can run alone (“bare-metal”) or on top of another operating system, which gives you flexibility in the types of projects it can be used for.

  • Developer: Informatics Institute, University of Würzburg
  • Intended purpose: Satellite control or any application demanding high dependability
  • Notable features and functions: Ultra-fast booting; thread-safe communication and synchronization

Back to Contents

Advertisement
Advertisement
8
Raspberry Pi Real-Time OS (RTOS)

Mbed (Linux) OS

Mbed has superseded Mbed Linux OS, but Raspberry Pi support is on the way
Mbed has superseded Mbed Linux OS, but Raspberry Pi support is on the way (Source: Arm Mbed)

Finally, Mbed OS is an open-source embedded operating system designed for IoT devices. It includes all the features required to develop an IoT device based on an ARM Cortex-M microcontroller. While Mbed OS doesn’t specifically support Raspberry Pi boards as yet, at the time of writing a port for the Raspberry Pi Pico is in the works, and some APIs for Raspberry Pi have been successfully implemented in the past.

However, the related OS Mbed Linux OS was specifically designed for the ARM Cortex-A processors that are the foundation of popular development boards like the Raspberry Pi 3. The repository is sadly no longer maintained but is still accessible on GitHub, just be aware that there’s no ongoing support.

  • Developer: Arm
  • Intended purpose: Embedded applications and IoT devices
  • Notable features and functions: Raspberry Pi Pico port currently in development

Back to Contents

Advertisement
Advertisement

Lead image source: PiBookPro

License: The text of "Raspberry Pi Real-Time OS (RTOS): Which to Choose" by All3DP is licensed under a Creative Commons Attribution 4.0 International License.

Stay informed with notifications from All3DP.

You get a notification when a new article is published.

You can’t subscribe to updates from All3DP. Learn more… Subscribe to updates

You can’t subscribe to updates from All3DP. Learn more…

Advertisement