FreeRTOS
freertos-next is a Rust wrapper for the FreeRTOS API.
- It bundles the official FreeRTOS-Kernel sources (currently
V11.2.0). If you need a customized setup, you can prepare your own kernel source files and callb.freertos("path/to/your/kernel");in yourbuild.rs. - It implements several traits to ensure smooth integration with embedded projects:
The crate is published as freertos-next on crates.io because the more obvious names (freertos, freertos-rust) are already taken.
📦 Usage
- Add the dependencies to your application:
- Add the following snippet to your application's
build.rs:
- Optional configuration:
// Use your own FreeRTOS-Kernel source tree
b.freertos;
// Override the default port (relative to FreeRTOS-Kernel/portable)
b.freertos_port;
// Select the heap allocator from FreeRTOS-Kernel/portable/MemMang
// Default: heap_4.c
b.heap;
freertos-next works together with freertos-build. A complete example using freertos-next with stm32f1-hal is available here: stm32f1-FreeRTOS-example
📘 C Compiler
freertos-build uses the cc crate to compile the FreeRTOS kernel.
The C compiler can be configured via the CC environment variable, or it will fall back to the defaults provided by cc.
For ARM targets, the expected compiler is arm-none-eabi-gcc, which can be obtained from the ARM GNU toolchain.
Install
# Ubuntu
# Windows (Scoop)
See also the main repository.