Welcome to The Embedded Rust Book: An introductory book about using the RustProgramming Language on "Bare Metal" embedded systems, such as Microcontrollers.
Embedded Rust is for everyone who wants to do embedded programming while taking advantage of the higher-level concepts and safety guarantees the Rust language provides.(See also Who Rust Is For)
The goals of this book are:
Get developers up to speed with embedded Rust development. i.e. How to setup a development environment.
Share current best practices about using Rust for embedded development. i.e.How to best use Rust language features to write more correct embeddedsoftware.
Serve as a cookbook in some cases. e.g. How do I do mix C and Rust in a singleproject?
This book tries to be as general as possible but to make things easier for boththe readers and the writers it uses the ARM Cortex-M architecture in all itsexamples. However, the book doesn't assume that the reader is familiar with thisparticular architecture and explains details particular to this architecturewhere required.
This book caters towards people with either some embedded background or some Rust background, however we believeeverybody curious about embedded Rust programming can get something out of this book. For those without any prior knowledgewe suggest you read the "Assumptions and Prerequisites" section and catch up on missing knowledge to get more out of the bookand improve your reading experience. You can check out the "Other Resources" section to find resources on topicsyou might want to catch up on.
- You are comfortable using the Rust Programming Language, and have written,run, and debugged Rust applications on a desktop environment. You should alsobe familiar with the idioms of the 2018 edition as this book targetsRust 2018.
- You are comfortable developing and debugging embedded systems in anotherlanguage such as C, C++, or Ada, and are familiar with concepts such as:
- Cross Compilation
- Memory Mapped Peripherals
- Common interfaces such as I2C, SPI, Serial, etc.
If you are unfamiliar with anything mentioned above or if you want more information about a specific topic mentioned in this book you might find some of these resources helpful.
|Rust||Rust Book||If you are not yet comfortable with Rust, we highly suggest reading this book.|
|Rust, Embedded||Discovery Book||If you have never done any embedded programming, this book might be a better start|
|Rust, Embedded||Embedded Rust Bookshelf||Here you can find several other resources provided by Rust's Embedded Working Group.|
|Rust, Embedded||Embedonomicon||The nitty gritty details when doing embedded programming in Rust.|
|Rust, Embedded||embedded FAQ||Frequently asked questions about Rust in an embedded context.|
|Memory-mapped IO/Peripherals||Memory-mapped I/O||-|
|SPI, UART, RS232, USB, I2C, TTL||Stack Exchange about SPI, UART, and other interfaces||-|
This book generally assumes that you’re reading it front-to-back. Laterchapters build on concepts in earlier chapters, and earlier chapters maynot dig into details on a topic, revisiting the topic in a later chapter.
This book will be using the STM32F3DISCOVERY development board fromSTMicroelectronics for the majority of the examples contained within. This boardis based on the ARM Cortex-M architecture, and while basic functionality isthe same across most CPUs based on this architecture, peripherals and otherimplementation details of Microcontrollers are different between differentvendors, and often even different between Microcontroller families from the samevendor.
For this reason, we suggest purchasing the STM32F3DISCOVERY development boardfor the purpose of following the examples in this book.
If you have trouble following the instructions in this book or find that somesection of the book is not clear enough or hard to follow then that's a bug andit should be reported in the issue tracker of this book.
Pull requests fixing typos and adding new content are very welcome!