freertos-next

Crates.iofreertos-next
lib.rsfreertos-next
version0.12.0
created_at2025-12-14 03:26:05.376+00
updated_at2026-01-23 00:56:24.331535+00
descriptionCreate to use FreeRTOS in rust projects. The freertos-build crate can be used to build and link FreeRTOS from source inside build.rs.
homepagehttps://github.com/mcu-rust/FreeRTOS/tree/main/freertos
repository
max_upload_size
id1983730
size10,215,891
Jalon Wong (JalonWong)

documentation

https://docs.rs/freertos-next

README

FreeRTOS

CI Crates.io Docs.rs License Downloads

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 call b.freertos("path/to/your/kernel"); in your build.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

freertos-next works together with freertos-build.

  1. Add the dependencies to your application:
cargo add freertos-next
cargo add --build freertos-build
  1. Add the following snippet to your application's build.rs:
use freertos_build::prelude::*;

fn main() {
    let mut b = freertos_build::Builder::new();
    b.cpu_clock(72.MHz());
    b.heap_size(10 * 1024);
    b.minimal_stack_size(80);
    b.interrupt_priority_bits(4, 5, 15);
    b.compile().unwrap();
}
  1. For more Optional configuration, see 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
sudo apt-get install -y gcc-arm-none-eabi

# Windows (Scoop)
scoop install gcc-arm-none-eabi

See also the main repository.

Commit count: 0

cargo fmt