Description
This is a tracking issue for an official guide to using rustlang on microcontroller targets.
For now, these are the major steps:
- Add a
book/
folder to this repository (until a better home is found)- Populate the book folder with an MdBook project
- Add some kind of CI to render the book
- Determine where to host the book (possibly gh-pages of this repo for now?) -- https://book.rust-embedded.org/
- Populate the book with some kind of content (see below)
- Submit for official inclusion in The Rust Bookshelf
Audience
I think the first step is to decide the audience of this book. I think the major factors are:
- Do we expect that they already are relatively confident with microcontrollers?
- Do we expect that they already are relatively confident with Rust?
This gives us four possible target audiences. I will leave it up to discussion which of these four audiences we would like to initially target. We may extend the Book to cover all four eventually, but we may try and target some subset to get something going at first.
Content
Once we have decided who the (initial) audience is, it will be necessary to determine the content of the book.
Initially, I would suggest the following organization:
- The Rust Language itself, at least how developing microcontrollers differs from "regular" Rust applications
- The Rust Tooling and Ecosystem, particularly Cargo, Crates, and crates.io.
- This should include a full "getting started guide", getting to hello world/blinkenlights for at least one target
- We have to make this guide good, as it could be a big "falling off point" if people's first attempts fail
- Layers of developing embedded software in Rust:
- Writing/Integrating "Chip Support Crates" - i.e. register/peripheral level access and drivers
- Writing/Integrating "Board Support Crates" - i.e. constrained to a specific hardware configuration
- Writing/Integrating drivers for external components - i.e. sensors, radios, etc
- Writing/Integrating higher level applications
- Perhaps a more advanced guide, covering all the topics of
3
from start to finish, similar to the Guessing Game in the Rust Book - Interoperability with existing C/C++ codebases
- Should consider "a little Rust with your C", and "a little C with your Rust" experiences
- May cover more advanced topics, like integrating with common RTOSs.
Concerns
We must decide how existing documentation, guides, and tooling falls into the following categories:
- Required steps - these guides/tools cover MUST DO. For example, using rustc/cargo to produce a
#[no_std]
elf/hex that can run on a given target. We should expect these items to be officially supported by the Rust organization proper - Recommended steps - these guides/tools cover steps we expect MOST people to use. For example how to organize Chip/Board Support Crates, use of
embedded-hal
, etc. People should not expect these items to be officially supported or required. A parallel here would be nursery level crates like Futures, Tokio, Error Chain, etc. - Example steps - these guides/tools cover things that are community driven, but widely used. i.e. Tock-OS, RTFM, svd2rust, etc. A parallel here would be crates like Serde, Hyper, etc.
I say these items are a concern, because we must be careful to avoid "blessing" parts of the ecosystem that are not officially maintained, as it will cause us to update our documentation if these components fall out of maintenance or fashion (or expose our users to a "broken" experience).
Additionally, we must discuss what embedded targets we will use for these guides. Chips from different architectures and manufacturers have an extremely wide variance in how they act, and if the guide is only written for an STM32, developers may struggle with an nRF5x or AVR based chip. I think initially, we should at least cover the officially supported thumb* architectures, and if the MSP, AVR and/or RISC-V branches are merged upstream, we should expect to update the guide to cover them around the same time as they become officially supported by Rustlang (We could also cover them beforehand, but I would say we MUST cover them when officially supported).
Reuse of existing material
There are a lot of existing blog posts, projects, etc. that can be used. Care must be taken to make sure anything we integrate into the official guide must be up to date and correct. Additionally it may require editing to fit the "style" of the book, to make sure developers have a consistent experience.
Maintainers
We will need to have maintainers for the book. (@jamesmunns) is willing to take this up initially, but will absolutely need help. Additionally, we should probably reach out to the Docs working group for guidance here (CC @carols10cents @steveklabnik).