Simulated with either Renode or PICSimLab
Step-by-Step Guide STM32F4xx with Embassy-rs
-
Embassy is a modern, lightweight, asynchronous runtime and framework for embedded systems written in Rust. It enables writing highly efficient, concurrent firmware using Rust’s async/await features — without needing a traditional RTOS.
-
Embassy is designed specifically for resource-constrained microcontrollers and works without requiring dynamic memory allocation. It uses cooperative multitasking, where tasks yield control at
.awaitpoints, resulting in predictable and efficient execution. -
The framework provides integrated support for timers, peripherals, interrupts, and multiple hardware platforms through HAL integrations. It also focuses on low-power operation by automatically putting the MCU to sleep when idle.
Step-by-Step Guide STM32F4xx with RTIC
-
RTIC (Real-Time Interrupt-driven Concurrency) is a lightweight concurrency framework for embedded systems written in Rust. It enables developers to build real-time applications with deterministic behavior by leveraging hardware interrupts and a priority-based scheduling model.
-
RTIC is designed for resource-constrained microcontrollers and does not require dynamic memory allocation. It follows a task-based model where software tasks are bound to interrupts or scheduled with defined priorities, ensuring predictable execution and low latency.
-
The framework provides compile-time guarantees for memory safety and data sharing, preventing race conditions without requiring a traditional RTOS. By combining Rust’s safety features with a static scheduling model, RTIC helps developers create reliable, efficient, and real-time embedded applications.
Step-by-Step Guide STM32F4xx with FreeRTOS
-
FreeRTOS is a widely used, open-source real-time operating system designed for microcontrollers and small embedded systems. It enables developers to build deterministic, multitasking applications using a preemptive priority-based scheduler.
-
FreeRTOS provides core RTOS features such as tasks (threads), queues, semaphores, mutexes, timers, and event groups for inter-task communication and synchronization. It supports both preemptive and cooperative scheduling modes, allowing flexibility depending on application requirements.
-
The kernel is small and highly portable, running on a wide range of architectures and microcontrollers. FreeRTOS can operate with or without dynamic memory allocation and is suitable for resource-constrained devices.
-
With its mature ecosystem, extensive documentation, and commercial support options, FreeRTOS is commonly used in IoT devices, industrial control systems, consumer electronics, and safety-critical applications.
ThreadX is a small, high-performance real-time operating system (RTOS) developed by Express Logic, acquired by Microsoft in 2019 and rebranded as Azure RTOS ThreadX. It is designed for deeply embedded systems where determinism, low memory footprint, and fast response times are critical.
Key characteristics:
- Preemptive scheduling with priority-based thread management and optional round-robin for equal-priority threads
- Picokernel architecture — core services execute directly without intermediate layers, keeping latency minimal and deterministic
- Very small footprint — typically 2–15 KB of Flash and under 1 KB of RAM for the kernel itself
- Rich IPC primitives — semaphores, mutexes, message queues, event flags, and memory pools
- Priority inheritance on mutexes to address priority inversion
- Preemption-threshold — a unique feature that reduces unnecessary context switches by allowing a thread to block preemption only by threads above a defined priority ceiling
- No GPL/copyleft licensing concerns — historically royalty-free for production use; Microsoft later open-sourced it under the MIT license in 2022
It is widely used in industrial control, medical devices, consumer electronics, and IoT edge hardware, and often pairs with other Azure RTOS components like NetX (TCP/IP), FileX (FAT filesystem), and USBX (USB stack).
Zephyr is an open-source, scalable real-time operating system hosted by the Linux Foundation, initially released by Wind River in 2016 and now backed by a broad industry consortium including Intel, Nordic Semiconductor, NXP, and others.
It is designed to span a wide range of hardware — from tiny resource-constrained microcontrollers to more capable embedded processors — under a single, unified codebase.
Key characteristics:
- Preemptive, priority-based scheduling with optional cooperative and time-slice modes
- Highly configurable kernel — Kconfig-driven build system allows the kernel itself to be trimmed down to only the features a project needs, from a minimal footprint up to a full-featured build
- Broad hardware support — hundreds of officially supported boards across ARM Cortex-M/A/R, RISC-V, x86, ARC, and Xtensa architectures
- Device driver model with a standardised API layer that abstracts hardware peripherals consistently across platforms
- Rich connectivity stack — Bluetooth LE (including Mesh), IEEE 802.15.4, OpenThread, Wi-Fi, CAN, USB, and TCP/IP (via LwIP or its own network stack)
- Memory protection — optional MPU/MMU integration for fault isolation between threads
- West tool — a meta-tool for managing multi-repository projects, building, flashing, and debugging
- Apache 2.0 license — permissive, with no copyleft obligations for commercial products
Compared to ThreadX, Zephyr is heavier and more complex but offers a far richer ecosystem, stronger community, and greater hardware coverage. It is widely adopted in IoT products, wearables, industrial sensors, and audio devices — particularly where Bluetooth or Thread connectivity is needed.
