r/programming • • 21h ago

Embedded Rust from Scratch

https://rodrigodd.github.io/2026/12/05/rust-embedded-from-scratch.html

I recently got a small microcontroller, and I thought it was a good opportunity to learn more about how ARM-based microcontrollers work under the hood and how Rust works on embedded devices. In this blog post, I go over how to implement a very basic example application in Rust from scratch, covering everything from runtime initialization to how to build memory-safe abstractions for peripherals.

Hopefully, preexisting knowledge of Rust or embedded development is not required to follow the post.

5 Upvotes

3 comments sorted by

2

u/suda50 18h ago

I skimmed your post and it looks great. I didn’t see any mention of the Embedded Rust Book. It looks like it goes over a lot of the same topics as your post. Did you use that as a reference?

2

u/Rodrigodd_ 16h ago

I mention it at the very end of the post, as well as the Embedonomicon, which also covers a good chunk of what I covered in the post, although I only found out about it halfway through writing the post.

I didn't use them as references, at least not directly. I wrote each section of the post as I researched and implemented it in code, focusing more on the microcontroller datasheet and the ARM Cortex-M0+ Manual as source, although I did read snippets of the book and the code for crates like cortex-m-rt.

1

u/polycratia 30m ago

I like the approach of building it from scratch instead of relying on layers of abstractions. Working directly with the hardware is probably one of the best ways to understand what Rust is actually doing under the hood. Great learning project!