The Embedded Rust Book logo

The Embedded Rust Book

Free

An introductory book about using the Rust Programming Language on "Bare Metal" embedded systems, such as Microcontrollers.

FreeFree tier
Type
Open Source

About The Embedded Rust Book

The Embedded Rust Book is an introductory guide to using the Rust programming language on bare-metal embedded systems, such as microcontrollers. It targets developers who are comfortable with Rust and have some embedded experience (e.g., with C/C++). The book covers how to set up an embedded development environment, shares current best practices for writing correct embedded software using Rust's safety features, and serves as a cookbook for common tasks like mixing C and Rust in a single project. All examples use the ARM Cortex-M architecture (specifically the STM32F3DISCOVERY board) but explain architecture-specific details where needed. The book is part of the Rust Embedded ecosystem and is available for free online under an open-source license.

Key Features

Step-by-step guide to setting up an embedded Rust development environment
Current best practices for using Rust in embedded contexts
Cookbook-style solutions (e.g., mixing C and Rust, using interrupts)
Examples based on the ARM Cortex-M architecture (STM32F3DISCOVERY board)
Targets Rust 2018 edition idioms
Assumes familiarity with Rust and embedded concepts like cross compilation, memory-mapped peripherals, and common interfaces

Pros & Cons

Pros
  • Comprehensive for those with basic Rust and embedded knowledge
  • Focuses on safety and best practices
  • Practical cookbook examples
  • Free and open-source
  • Available in multiple languages (Japanese, Chinese)
Cons
  • Assumes prior familiarity with Rust and embedded concepts; not for absolute beginners
  • Examples are specific to ARM Cortex-M (though architecture details are explained)
  • Not a full reference for all microcontrollers or architectures

Best For

Learning embedded Rust development from scratch with some backgroundSetting up a Rust toolchain for microcontrollersMixing Rust and C in a single embedded projectApplying Rust's safety guarantees to bare-metal programmingReferencing as a cookbook for common embedded tasks

FAQ

Who is this book for?
The book is for people with some embedded background or some Rust background. It assumes you are comfortable with Rust and have experience developing and debugging embedded systems in another language like C or C++.
What are the prerequisites?
You should be comfortable with Rust (2018 edition) and have experience with embedded concepts such as cross-compilation, memory-mapped peripherals, interrupts, and common interfaces like I2C, SPI, Serial.
Which hardware does the book use?
The book uses the STM32F3DISCOVERY development board from STMicroelectronics, based on the ARM Cortex-M architecture. Examples are general but specific to this board.