A 5-Step Guide For Learning Embedded Rust
Expand Your Embedded Knowledge
Embarking on the journey of mastering embedded Rust could initially seem like a formidable challenge. Yet, as you invest time and dedication into honing your skills, a remarkable transformation occurs. Gradually, embedded Rust becomes not just a language, but a profound passion that outshines its counterparts. So profound, in fact, that returning to other programming languages might appear lackluster in comparison. Amidst the vast array of resources scattered across the landscape of learning Rust, it might feel like a sense of direction and coherence might be missing. To bridge this gap, I've crafted this step-by-step guide - a guiding light, if you will - with the aspiration that it becomes an invaluable companion for anyone treading this new and exciting path.
Without further ado, the 5-step path recommended for learning embedded Rust is listed in what follows. A word of notice is that if you are already familiar with Rust and embedded systems, you probably would start around the third step.
The 5-Step Path 👣
1️⃣ Learn Embedded Systems Fundamentals 📟️
This might sound like a no-brainer, but if you are a beginner you need to get familiar with the basics of Embedded Systems. This includes microcontrollers, GPIO, and communication protocols like UART, SPI, and I2C. Note that this most likely includes you knowing C or C++ as most of the resources out there are based on those two languages. I think that’s a good thing as well since it allows one to draw differences and develop a deeper understanding of systems. It would be also helpful to develop some electronics background as you would need to interface those peripherals to the outer world. My favorite resources include:
“Wired World: A Beginners Guide to Embedded Electronic Interfaces” is a book that I created focusing on electronics essentials for embedded beginners.
The Embedded Systems Essentials with Arm on EdX - You can audit the courses for free with the option to obtain a professional certificate.
The Embedded Systems Engineering Roadmap Repository is a goldmine of guides and resources.
2️⃣ Start with Rust Basics 🦀
If you're new to Rust, it's essential to learn the language's fundamentals. There is no shortage of Rust resources and they just keep on increasing. You can find tutorials, online courses, or books that cover Rust syntax, ownership, borrowing, and lifetimes. If you are starting out, however, you probably do not need to dig deep into the language. You can delay concepts like lifetimes and smart pointers. For learning Rust, check out the 58 Rust Resources Every Learner Should Know in 2023 post.
3️⃣ Explore the Rust Embedded Ecosystem 🧭
This is an important step for the one that follows: choosing a board. The Rust-embedded ecosystem can be confusing to navigate. There are more options than one would think. Additionally, there are several libraries/crates supporting different levels of development abstractions and frameworks. Each one of those libraries is also at different completion levels. One can really get lost experimenting and trying to find the best fit. As such, you need to understand the differences between a HAL and a PAC and the different ones out there and how supported they are. You need to understand what are the embassy and RTIC frameworks and what they do. I reflect on that experience in the post 6 Things I Wish I Knew Starting with Embedded Rust. Consequently, here are some links that can help you navigate the ecosystem:
4️⃣ Choose a Development Board 🔍️
I personally learned with the ESP32 and STM32. The ESP32 was particularly unique since the company behind it, espressif, provides official support. They also have an awesome development team that you can find around official chat rooms for support and questions. Additionally, if you don’t want to splash out on hardware, there’s the Wokwi route which might be a good option for the curious. However, for the time being, Wokwi supports Rust only on ESP32 devices.
There is also good community involvement around nRF devices as Ferrous systems are maintainers of the nRF HAL. Some Ferrous training/workshops are centered around nRF devices. Also, there is quite an active community around the Rasberry Pi Pico. Finally, the Embedded Discovery book is based on the BBC micro-bit. For me, however, I did not find the discovery book to be sufficient on its own to absorb the Rust-embedded knowledge I needed.
To navigate the hardware space, here are some resources that might be helpful:
5️⃣ Learn Rust Hands-on 🧑💻
After choosing a board and an abstraction level you’d like to start with, you have to learn how to configure controllers and work with peripherals. As such, you need to start experimenting with simple projects and learn how to interface with various peripherals like GPIO, UART, Timers, SPI, I2C, ADC, etc. In the following you can find different series I’ve written to get started:
In all of the above series, I made a point of sticking to a single abstraction level. This is because I personally found that mixing abstraction levels could make things somewhat confusing for a beginner.
The above steps should be good enough to get one going with Rust and get a good grasp. Beyond that, one can delve into more advanced topics including, but not limited to, drivers, frameworks (ex. embassy and RTIC), data synchronization, RTOSs, and FFI.
Remember, hands-on practice is crucial for mastering Embedded Rust. Create small projects, tinker with real hardware, and join relevant communities like forums, Reddit, or Discord to ask questions and share experiences. Engaging in the Matrix channels is probably where one would find the most help. Click this link to view a full list of rooms related to embedded Rust on Matrix that you can join.
Most importantly, for more educational content and if you want to stay up to date on the latest resources and news related to embedded Rust, subscribe to our newsletter.
Embedded Rust learners that start out might often find themselves lost trying to find direction. Things become even more confusing as a learner starts seeing all the different ecosystem options that make their head spin. However, once there is a clear path, it all comes down to foundations and hands-on practice. In this post, I lay out a 5-step path for those interested in embarking on learning embedded Rust. Have any questions? Are there any other topics you think a learner should cover? Share your thoughts in the comments below 👇.