RT-Thread
v5.2.2Features
-
Minimum kernel footprint requiring only 1.2KB RAM and 3KB Flash for resource-constrained systems.
-
Object-oriented programming model implemented in C for modular and structured system design.
-
Preemptive priority-based thread scheduling with support for multi-threading and synchronization primitives.
-
Dual-tier distribution offering a Nano version for MCUs and a Standard version for feature-rich IoT devices.
-
Comprehensive software package ecosystem with over 450 reusable components across various domains.
-
Standardized application interfaces including full POSIX, CMSIS, and C++ runtime environments.
-
Virtual File System (VFS) providing a unified interface for various storage and file system types.
-
Integrated FinSH command-line interface for real-time system interaction and debugging.
-
Highly scalable device framework for unified peripheral management and driver abstraction.
-
Support for multiple memory management schemes including small memory, slab, and heap allocators.
-
Native support for high-performance graphical user interfaces with touch and sliding effects.
-
Cross-compiler compatibility with GCC, Keil MDK, and IAR toolchains.
-
Integrated development environment (RT-Thread Studio) for one-stop project management and debugging.
-
Env auxiliary tool providing a TUI for Kconfig-based project configuration and generation.
-
Support for advanced scripting languages including MicroPython and JerryScript (JavaScript).
-
Real-time kernel features including semaphores, mailboxes, message queues, and software timers.
-
Hardware abstraction layer (libcpu/BSP) for rapid porting across diverse architectures.
-
Built-in simulator support via QEMU for development without physical hardware.
Architecture
RT-Thread employs a highly modular, layered architecture designed to scale from simple microcontrollers to complex IoT systems. The architecture is divided into three primary layers: the Kernel Layer, the Components and Service Layer, and the Software Package Layer. This design follows object-oriented principles implemented in C, ensuring high internal cohesion within modules and low coupling between different subsystems.
The Kernel Layer is the core of the system, providing essential multi-threading, preemptive scheduling, and inter-thread communication primitives such as semaphores, mailboxes, and message queues. It also includes the Hardware Abstraction Layer (libcpu/BSP), which isolates the kernel from specific hardware details, facilitating rapid porting to new architectures. The Components and Service Layer sits atop the kernel, offering higher-level abstractions like the Virtual File System (VFS), the FinSH shell for command-line interaction, and comprehensive device and network frameworks. Finally, the Software Package Layer provides a massive ecosystem of reusable components that can be seamlessly integrated into projects to add complex functionality such as scripting languages, multimedia support, and cloud connectivity.
Core Components
- Real-Time Kernel: Multi-threaded scheduler, memory management, and synchronization primitives.
- FinSH Shell: A powerful command-line interface for system debugging and interaction.
- Virtual File System (VFS): Unified interface for FAT, SPIFFS, and network-based file systems.
- Device Framework: Standardized I/O device management for UART, I2C, SPI, and ADC.
- Network Stack: Support for LWIP and various protocol implementations (MQTT, HTTP, TLS).
Use Cases
This RTOS is ideal for:
- Resource-Constrained MCUs: Using the Nano version to provide multi-tasking on devices with as little as 3KB Flash and 1.2KB RAM.
- IoT Gateways: Leveraging the rich network stack and protocol support (MQTT, CoAP, WebSocket) for cloud connectivity.
- Industrial Control: Utilizing the real-time preemptive kernel for deterministic task execution in automated systems.
- Smart Home Appliances: Implementing complex graphical user interfaces and touch effects using the integrated GUI components.
- Edge Computing: Running scripting languages like MicroPython or JerryScript for flexible, high-level application development on embedded hardware.
- Wearable Devices: Taking advantage of low power consumption and fast startup times for battery-operated electronics.
Getting Started
Developers can begin by choosing between the Standard and Nano versions based on their hardware requirements. The recommended development path is using RT-Thread Studio, a one-stop integrated development environment that provides graphical configuration, project management, and debugging tools. For those preferring command-line workflows, the Env tool provides a TUI for Kconfig-based system tailoring and project generation for GCC, Keil MDK, and IAR.
For initial testing without physical hardware, RT-Thread provides comprehensive QEMU BSP support, allowing developers to run and debug the OS on simulated ARM or RISC-V platforms. Detailed documentation, including the Programming Guide and Kernel Samples, is available on the official website to assist with the learning curve. Links to these resources and the software package index can be found in the repository’s README.
Related Projects
View All Projects →BC28 MQTT Package for RT-Thread
An MQTT client package for RT-Thread designed to interface with Quectel BC28 NB-IoT modules using AT commands. It provides a thread-safe, multi-instance API for connecting embedded devices to cloud platforms like Alibaba Cloud IoT.
BME680 Sensor Package for RT-Thread
A hardware driver package for the Bosch BME680 4-in-1 environmental sensor, designed to integrate seamlessly with the RT-Thread sensor device framework. It provides measurement capabilities for VOC, temperature, humidity, and atmospheric pressure, supporting both I2C and SPI communication interfaces.
μC/Clk for RT-Thread
A port of the Micrium uC/Clk clock and calendar management module for the RT-Thread RTOS. It provides Year 2000 compliant timekeeping with support for NTP and Unix timestamps, offering comprehensive date/time conversion utilities and automatic initialization within the RT-Thread environment.
μC/Common for RT-Thread
A port of Micrium's µC/Common module for the RT-Thread RTOS, providing a Kernel Abstraction Layer (KAL) and shared components for Micrium software stacks. It enables the integration of µC/FS, µC/USB, and µC/TCP-IP into RT-Thread environments by leveraging a uCOS-III compatibility layer.
μC/CRC for RT-Thread
A port of the uC/CRC utility library to the RT-Thread RTOS, providing comprehensive Error Detecting Code (EDC) and Error Correcting Code (ECC) calculation utilities. It supports multiple CRC-16 and CRC-32 models along with Hamming code for error correction, integrated with the RT-Thread build system.
μC/OS-II Compatibility Layer for RT-Thread
A compatibility layer that allows applications developed for the μC/OS-II RTOS to migrate seamlessly to the RT-Thread operating system. It supports μC/OS-II versions 2.00 through 2.93 and provides a 100% C-based implementation of the μC/OS-II API.
μC/OS-III Compatibility Layer for RT-Thread
A high-fidelity compatibility layer that allows applications written for Micriμm's μC/OS-III to run seamlessly on the RT-Thread RTOS. It supports μC/OS-III versions 3.00 through 3.08 and provides integration with the μC/Probe visualization tool and RT-Thread's FinSH console.
CCS811 Digital Gas Sensor Driver for RT-Thread
A comprehensive driver package for the CCS811 digital gas sensor designed for the RT-Thread RTOS. It enables monitoring of indoor air quality by measuring Total Volatile Organic Compounds (TVOC) and equivalent CO2 (eCO2) levels. The driver supports both standalone custom APIs and the standard RT-Thread sensor device framework.