# RT-Thread — Small and Fast Real-Time Operating System for IoT > A compact open-source RTOS born in China with a rich middleware ecosystem, supporting ARM, RISC-V, MIPS and more for IoT and embedded applications. ## Install Save as a script file and run: # RT-Thread — Small and Fast Real-Time Operating System for IoT ## Quick Use ```bash # Clone RT-Thread git clone https://github.com/RT-Thread/rt-thread.git cd rt-thread/bsp/stm32/stm32f407-atk-explorer # Install env tool and build pip install scons scons --exec-path=/path/to/arm-gcc/bin ``` ## Introduction RT-Thread is a small, fast open-source real-time operating system originally developed in China and now used globally. It provides a complete embedded software platform with kernel, middleware components, and IoT connectivity, supporting over 200 BSPs across multiple chip architectures. ## What RT-Thread Does - Provides a preemptive real-time kernel with thread, timer, and IPC primitives - Includes a modular component system (filesystem, network, GUI, USB, audio) - Supports 200+ board support packages for STM32, ESP32, RISC-V, and more - Offers RT-Thread Smart, a microkernel variant for MPU-class processors - Provides online package management for adding community components ## Architecture Overview RT-Thread has a layered architecture: a real-time kernel at the base, a device framework providing unified driver APIs, and optional middleware components on top. The kernel supports 256 priority levels, round-robin scheduling within same priority, and inter-thread communication via mailbox, message queue, and event mechanisms. The FinSH interactive shell enables runtime debugging through a serial console. ## Self-Hosting & Configuration - Build with SCons, CMake, or IDE integration (Keil, IAR, RT-Thread Studio) - Use menuconfig (Kconfig-based) to select kernel options and packages - BSP templates provided for all supported boards - env tool manages packages and build environment on Windows and Linux - RT-Thread Studio IDE provides integrated project setup and debugging ## Key Features - Extremely small footprint: kernel uses only 3KB ROM and 1.2KB RAM minimum - FinSH command-line shell for runtime inspection and debugging - POSIX-compatible layer (pthreads, filesystem, sockets) for porting Linux apps - Online package ecosystem with 400+ community software packages - RT-Thread Smart variant brings user/kernel space separation for complex applications ## Comparison with Similar Tools - **FreeRTOS** — Simpler kernel; RT-Thread includes richer built-in middleware - **Zephyr** — Better Western ecosystem; RT-Thread has stronger Chinese hardware support - **LiteOS** — Huawei-focused; RT-Thread is vendor-neutral and community-governed - **uC/OS** — Now open source but less actively developed; RT-Thread has growing ecosystem - **NuttX** — POSIX-heavy; RT-Thread offers more beginner-friendly tooling ## FAQ **Q: How small can an RT-Thread application be?** A: The nano version runs in 3KB ROM and 1.2KB RAM, suitable for Cortex-M0 devices. **Q: Does RT-Thread support POSIX?** A: Yes. The POSIX compatibility layer supports pthreads, filesystem operations, and BSD sockets for porting existing code. **Q: What is RT-Thread Smart?** A: RT-Thread Smart is a microkernel variant that separates user space from kernel space, targeting application processors like Cortex-A. **Q: Is there IDE support?** A: Yes. RT-Thread Studio (Eclipse-based) provides project generation, configuration, debugging, and package management in one tool. ## Sources - https://github.com/RT-Thread/rt-thread - https://www.rt-thread.io/document/site/ --- Source: https://tokrepo.com/en/workflows/asset-eb8a830c Author: Script Depot