Table of Contents
KEY TAKEAWAYS
- Select an RTOS based on five criteria: footprint, MCU support, licensing, certification needs, and ecosystem/community size.
- FreeRTOS suits most projects; Zephyr excels for IoT connectivity; ThreadX (Azure RTOS) is best for safety-critical ultra-low-footprint applications.
- Evaluate RTOS candidates by building a simple blinky + UART demo on your target hardware — this reveals toolchain issues, documentation quality, and BSP maturity.
Choosing the wrong RTOS wastes weeks of integration effort and can paint you into a corner for the entire product lifecycle. This guide provides a systematic framework for evaluating RTOS options based on your project’s actual requirements — not marketing material.
Decision Framework: Five Key Criteria
Before evaluating specific RTOSes, define your requirements across five dimensions:
1. Resource footprint — how much flash and RAM can you dedicate to the RTOS? If your MCU has 32 KB flash and 8 KB RAM, you need a kernel that fits in 5-10 KB flash and 1-2 KB RAM. FreeRTOS and ThreadX fit. Zephyr’s minimum footprint is larger (~30 KB flash with a minimal configuration).
2. MCU/BSP support — does the RTOS have a Board Support Package for your specific chip? An RTOS with great features but no support for your STM32 variant means you’ll write the port yourself — a significant effort.
3. Licensing — open-source RTOSes (FreeRTOS: MIT, Zephyr: Apache 2.0, ThreadX: MIT) have no royalty or licensing costs. Some commercial RTOSes (Micrium µC/OS, embOS) require per-unit royalties. Check if your use case requires a commercial license.
4. Safety certifications — medical devices (IEC 62304), automotive (ISO 26262), industrial (IEC 61508), and aerospace (DO-178C) may require a pre-certified RTOS. SafeRTOS, ThreadX, and RTEMS have relevant certifications. Using a non-certified RTOS in a safety-critical application means you must certify the RTOS yourself — prohibitively expensive.
5. Ecosystem and community — documentation quality, number of examples, active forums, Stack Overflow answers, and third-party middleware availability. FreeRTOS has the largest ecosystem by far. Zephyr is growing rapidly.
Comparing Major RTOS Options
FreeRTOS — the safe default choice. 6-12 KB flash, 1-2 KB RAM minimum. Supports 40+ architectures. MIT license. Massive community. Amazon maintains it and provides FreeRTOS+TCP, +FAT, +CLI, and AWS IoT libraries. Excellent documentation and tutorials. Weaknesses: no built-in device driver framework, minimal networking (use lwIP or FreeRTOS+TCP).
Zephyr RTOS — the modern choice for connected devices. 30-100 KB flash minimum (depends on configuration). Built-in Bluetooth LE, WiFi, Thread, LwM2M, USB stacks. CMake + Kconfig build system. Devicetree for hardware abstraction. Apache 2.0 license. Growing rapidly with strong industry backing (Nordic, NXP, Intel, Google). Weaknesses: steeper learning curve, larger footprint, less documentation than FreeRTOS.
Azure RTOS (ThreadX) — ultra-small footprint and safety certifications. As low as 2 KB flash, 1 KB RAM. Extremely fast context switches. IEC 61508 SIL 4, IEC 62304, DO-178C certified versions available. Now MIT licensed. Includes NetX (networking), FileX (file system), GUIX (graphics), USBX (USB). Weaknesses: smaller community than FreeRTOS, certification is for specific versions only.
RT-Thread — feature-rich with a package manager. Minimal nano kernel (~3 KB flash) or full standard kernel (~10 KB flash). Rich middleware: virtual file system, networking, GUI (LVGL integration), and 500+ software packages. Large community in China, growing internationally. Apache 2.0 license.
NuttX — POSIX-compliant, used by Apache and Sony. Follows Unix/Linux conventions with POSIX APIs, virtual file system, and socket networking. Good if you want code portable between NuttX and Linux. Used in PX4 (drone autopilot) and Sony products.
Practical Evaluation Process
Don’t choose an RTOS from feature comparison tables alone. Build a test project:
Step 1: Blinky test (1 hour) — create a minimal project with two tasks: one blinks an LED at 1 Hz, another at 5 Hz. This tests: toolchain integration, BSP quality, build system, and basic scheduling. If this takes more than an hour, the RTOS developer experience may be poor.
Step 2: UART + queue test (2 hours) — add a UART driver task that receives characters and sends them through a queue to a processing task. This tests: interrupt handling, queue API usability, and ISR-to-task communication.
Step 3: Resource contention test (2 hours) — add two tasks that share a hardware resource (SPI bus or I2C) using a mutex. Verify that access is properly serialized and check for priority inversion handling.
Step 4: Measure overheads — with a logic analyzer or scope, measure context switch time, interrupt latency, and queue send/receive time. Compare against your timing requirements.
If the RTOS passes all four tests on your target hardware in under a day, it’s a viable candidate. If any test is painful (missing drivers, poor documentation, build system issues), consider alternatives before committing.
Migration Considerations
If you need to switch RTOS later (it happens), minimize pain by abstracting the RTOS API:
// os_abstraction.h — thin wrapper over RTOS API
typedef void* os_task_t;
typedef void* os_queue_t;
typedef void* os_mutex_t;os_task_t os_task_create(void (*func)(void*), const char *name, uint32_t stack_size, uint8_t priority); os_queue_t os_queue_create(uint32_t depth, uint32_t item_size); int os_queue_send(os_queue_t q, const void *item, uint32_t timeout_ms); int os_queue_receive(os_queue_t q, void *item, uint32_t timeout_ms); os_mutex_t os_mutex_create(void); int os_mutex_lock(os_mutex_t m, uint32_t timeout_ms); void os_mutex_unlock(os_mutex_t m); void os_delay_ms(uint32_t ms); “`
CMSIS-RTOS2 is a standardized RTOS abstraction from ARM that works with FreeRTOS, RTX, and others. If you’re on ARM Cortex-M and want portability, CMSIS-RTOS2 is a practical choice.
However, don’t over-abstract. Using RTOS-specific features (event groups, stream buffers, task notifications) often produces cleaner and more efficient code. Abstract only if you have a concrete reason to expect migration.

Vivek Bhageria — Lead Firmware R&D Engineer, 12+ years. Ex-Bosch (automotive powertrain), MusicTribe (real-time audio), medical devices. M.Tech BITS Pilani. I write at NerdyElectronics — practical, register-level embedded systems for engineers who want to understand what’s actually happening under the hood.



