What is an RTOS and why should I use one? [free eBook]

Posted by Magnus Unemyr on Aug 26, 2015 11:20:00 AM

Many embedded developers use a real-time operating system in their Cortex-M designs. But what do an RTOS do and why do you need one in your product?

In our new free RTOS eBook, you will learn more about what a real-time operating system is, the benefits and components of an RTOS, including explanations of key concepts like tasks, scheduling models, context switching, latency and more.


There are many RTOS'es for Cortex-M on the market currently, and the most popular one is probably FreeRTOS due to the fact it is free and readily available. It is also very lightweight. Commercial options includes products from Micrium, Segger, Quadros, ExpressLogic, etc.

All of them allow concurrent execution of parallel tasks, using different scheduling strategies.
RTOS’es also include support for semaphores, mailboxes, timers, etc. This allows for synchronization and resource sharing. By separating application logic into separate and “independent” tasks, application logic can sometimes be simplified greatly.

But, introducing an RTOS in your embedded design (and it doesn’t matter if you use STM32, Kinetis or any other device) also adds complexities. You must add the RTOS code to the project of course, and integrate it with power-on reset logic, device drivers and interrupt handlers. Then you might need to worry about scheduling models, context switching and latency.

Parallel execution of different tasks also introduces problems when accessing shared resources, such as reading and writing SFR register bits in a peripheral module, or when accessing a shared data structure. Synchronization mechanisms like semaphores are used to guard access to shared resources, and mailboxes, message queues or pipes are used for inter-task communications.

Debugging also introduces new problems. For example, what is the state of a semaphore or message queue when you stop on a breakpoint to debug a problem? To successfully use an RTOS, your debugger needs to support kernel aware debugging of the RTOS you use.

Atollic TrueSTUDIO for example includes kernel aware RTOS debugging for the majority of real-time operating systems on the market. This ensures a smooth debugging process also when using an RTOS; for example a project using FreeRTOS on an STM32 or Kinetis device.

Read our free eBook to learn more on using an RTOS in your embedded development!

 New Call-to-action

Topics: Debugging, RTOS