Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

embedded-battery-pack

A battery pack for embedded Rust — curates HALs, concurrency frameworks, drivers, and no_std utilities from the awesome-embedded-rust ecosystem.

Quick start

cargo bp new embedded

This scaffolds a project with your chosen HAL, concurrency model, and peripherals already wired up.

To add embedded crates to an existing project instead:

cargo bp add embedded -F stm32f4 -F embassy -F panic-probe -F defmt-logging

Learn more

This battery pack is inspired by and draws from the awesome-embedded-rust list. For more about the embedded Rust ecosystem and how to get involved, visit the Embedded Rust Working Group.

Battery pack contents

Concurrency Framework (pick at most one)

Pick your async/RTOS model (mutually exclusive)

NameDescription
embassyEmbassy — async/await runtime for embedded
Crates: embassy-executor, embassy-sync, embassy-time
rticRTIC — interrupt-driven real-time concurrency
Crates: cortex-m, cortex-m-rt, critical-section, rtic

Display & Graphics

Screens, LEDs, and 2D drawing

NameDescription
display-ssd1306SSD1306 OLED display (I2C/SPI, 128x64)
Crates: embedded-graphics, ssd1306
display-st7789ST7789 color LCD (SPI, used in PineTime)
Crates: embedded-graphics, st7789
embedded-graphics2D drawing library for any embedded display

Platform-agnostic peripheral/sensor drivers via embedded-hal

NameDescription
display-ssd1306SSD1306 OLED display (I2C/SPI, 128x64)
Crates: embedded-graphics, ssd1306
display-st7789ST7789 color LCD (SPI, used in PineTime)
Crates: embedded-graphics, st7789
sensor-bme280BME280 temperature/humidity/pressure (I2C/SPI)
sensor-lis3dhLIS3DH 3-axis accelerometer (I2C/SPI)
usb-deviceUSB device stack (CDC-ACM serial, HID)
Crates: usb-device, usbd-serial

Hardware Abstraction Layer (pick at most one)

Pick the HAL for your target chip family (mutually exclusive)

NameDescription
atsamdMicrochip SAMD (Cortex-M0+/M4, Adafruit boards)
Crates: atsamd-hal, cortex-m, cortex-m-rt, critical-section, embedded-hal
esp32ESP32 (Xtensa, WiFi + BT, via esp-hal no_std)
Crates: embedded-hal, esp-hal
esp32c3ESP32-C3 (RISC-V, WiFi + BLE, via esp-hal no_std)
Crates: embedded-hal, esp-hal
esp32s3ESP32-S3 (Xtensa, WiFi + BLE, via esp-hal no_std)
Crates: embedded-hal, esp-hal
nrf52832Nordic nRF52832 (Cortex-M4F, BLE)
Crates: cortex-m, cortex-m-rt, critical-section, embedded-hal, nrf52832-hal
nrf52840Nordic nRF52840 (Cortex-M4F, BLE + USB)
Crates: cortex-m, cortex-m-rt, critical-section, embedded-hal, nrf52840-hal
nrf9160Nordic nRF9160 (Cortex-M33, LTE-M/NB-IoT)
Crates: cortex-m, cortex-m-rt, critical-section, embedded-hal, nrf9160-hal
rp2040RP2040 (Dual Cortex-M0+, Raspberry Pi Pico)
Crates: cortex-m, cortex-m-rt, critical-section, embedded-hal, rp2040-hal
stm32f0STM32F0xx family (Cortex-M0)
Crates: cortex-m, cortex-m-rt, critical-section, embedded-hal, stm32f0xx-hal
stm32f1STM32F1xx family (Cortex-M3, e.g. Blue Pill)
Crates: cortex-m, cortex-m-rt, critical-section, embedded-hal, stm32f1xx-hal
stm32f3STM32F3xx family (Cortex-M4F)
Crates: cortex-m, cortex-m-rt, critical-section, embedded-hal, stm32f3xx-hal
stm32f4STM32F4xx family (Cortex-M4F, e.g. F4 Discovery)
Crates: cortex-m, cortex-m-rt, critical-section, embedded-hal, stm32f4xx-hal
stm32f7STM32F7xx family (Cortex-M7)
Crates: cortex-m, cortex-m-rt, critical-section, embedded-hal, stm32f7xx-hal
stm32h7STM32H7xx family (Cortex-M7, high-performance)
Crates: cortex-m, cortex-m-rt, critical-section, embedded-hal, stm32h7xx-hal
stm32l0STM32L0xx family (ultra-low-power Cortex-M0+)
Crates: cortex-m, cortex-m-rt, critical-section, embedded-hal, stm32l0xx-hal
stm32l4STM32L4xx family (low-power Cortex-M4F)
Crates: cortex-m, cortex-m-rt, critical-section, embedded-hal, stm32l4xx-hal

Logging & Debugging

Device logging and diagnostic tools

NameDescription
defmt-loggingdefmt — efficient deferred formatting for constrained devices
Crates: defmt, defmt-rtt
rtt-targetRTT (Real-Time Transfer) output channel

Networking

no_std networking stacks and protocols

NameDescription
smoltcp-stacksmoltcp — no_std TCP/IP stack

Panic Handler (pick at most one)

Choose how panics are surfaced on the device (mutually exclusive)

NameDescription
panic-haltHalt the processor on panic
Crates: defmt, defmt-rtt, panic-halt
panic-probeLog panic via probe-rs debugger
Crates: defmt, defmt-rtt, panic-probe
panic-rttLog panic via RTT (SEGGER/probe-rs)
Crates: defmt, defmt-rtt, panic-rtt-target
panic-semihostingPrint panic via semihosting (Cortex-M only)

Portable Ecosystem

Trait abstractions and utilities that work across any HAL

NameDescription
critical-section-implcritical-section — cross-platform mutex primitive
heapless-allocStatic-friendly Vec, String, and data structures (no heap)
embedded-halTrait abstractions for embedded I/O (v1.0)
embedded-ioRead/Write traits for embedded byte streams
embedded-storageTraits for NOR flash and other storage

Storage & Memory

Flash, EEPROM, and filesystem support

NameDescription
embedded-sdmmcSD/MMC card with FAT16/FAT32 filesystem
spi-flashGeneric SPI NOR flash driver

Dev Tools

Testing, flashing, and development utilities

NameDescription
embedded-hal-mockMock embedded-hal traits for host-side testing
embedded-testOn-device test harness (unit + integration tests)

Dependencies

Templates

NameDescription
blinkyMinimal blinky LED example for your chosen HAL + concurrency model