A FreeRTOS API for embedded Rust

A safe Rust wrapper providing ergonomic APIs for features such as tasks, delays, queues, mutexes, signals and timers.
Rust crate freertos_rs
Crates.io Documentation Travis CI Star

Read the introduction article.


  • Enables integration with vendor-provided code generators and platform drivers, such as STM32CubeMX
  • Implements a safe Rust API using a C shim for FreeRTOS
  • Handles every possible failure from the FreeRTOS API using Rust’s error handling
  • Requires nightly Rust and a platform with dynamic memory allocation
  • Unit tested using a QEMU STM32F4 emulator, continously integrated with nightly Rust
  • Higher level primitives such as pub-sub and compute tasks

Spawning a new task

Task::new().name("hello").stack_size(128).start(|| {
    loop {
        println!("Hello world!");


let q = Queue::new(10).unwrap();
q.send(10, Duration::ms(5)).unwrap();


let m = Mutex::new(0).unwrap();
    let mut v = m.lock(Duration::infinite()).unwrap();
    *v += 1;