Embedded Rust setup explained
Vložit
- čas přidán 3. 06. 2024
- In this episode we get our development environment prepared for building bare-metal Rust projects. Follow along with your preferred editor & hardware as we begin our journey into the landscape of embedded Rust...
Chapters:
0:00 Intro
1:03 Tooling
3:00 Hardware
4:10 Cross compiling
6:07 Bare Metal Rust
8:13 Dependency Management
12:55 Don't panic!()
14:46 Build & Flash
17:30 Debugging with RTT
19:42 Debugging with gdb
22:29 Conclusion
22:54 The Rusty Bandit
References:
Install Rust | www.rust-lang.org/tools/install
Microbit v2 Product Spec | tech.microbit.org/hardware/
Rust Platform Support | doc.rust-lang.org/beta/rustc/...
nRF52833 Data Sheet | infocenter.nordicsemi.com/pdf...
Crates Registry | crates.io/
Arm GNU Toolchain | developer.arm.com/downloads/-...
"The Book" | doc.rust-lang.org/book/index....
FAQ:
Terminal setup:
- JetBrainsMono Nerd Font : www.nerdfonts.com/font-downloads
- Oh-My-Z : ohmyz.sh/
- alias ls='colorls'
- Powerlevel10k theme : github.com/romkatv/powerlevel10k
- zsh-autosuggestions : github.com/zsh-users/zsh-auto...
- zsh-syntax-highlighting : github.com/zsh-users/zsh-synt...
See @typecraft_dev : • How to setup your Mac ...
Playlist:
(All via Epidemic Sound)
Chasing Snakes - Martin Landstrom
Revving - Martin Landstrom
Before Chill - Yomoti
Still on My Mind - Sarah, the Illstrumentalist
Rich and Thick - spring gang
Sorvete de Limao - Martin Landstrom
Will of Minds - Magnus Ringblom
Disc Me Bro - Basixx
Simple Pleasantries - Arthur Benson
Deep Space Samurai - Forever Sunset - Věda a technologie
VIDEO ERRATA
Forgive me audience, for I have erred...
ERRORS
- 13:52 : The compiler is not actually inserting the panic during the array-access-by-index bounds checking... It's actually the `Index` trait implementation on arrays and slices that will perform the bounds-check logic and invoke the panic macro if necessary. Thanks to @werecatOmega for pointing this out!
- 16:07 : The standalone `cargo-embed` crate is no longer being updated, as this tool is now part of `probe-rs`. Once `probe-rs` is installed, `cargo embed` should work as shown in the video, with the exception that the `--list-chips` option is now available via `probe-rs chip list`. Apologies for the confusion, and thanks to @12rjig13gb and @therealjpster for the heads up! See `probe-rs` installation: probe.rs/docs/getting-started/installation/
OF NOTE
- 5:19 : This series will primarily focus on the 'microcontroller' subset of bare-metal hardware, but for those working with application-class SoCs, @pppgggr notes that the 64-bit Arm v8-A architecture is listed on the Rust platform support page under the `aarch64` target arch.
OMISSIONS
- 5:00 : The nRF52833 has a floating-point unit (FPU), and this is why we opted for the "hard-float" bare-metal target variant of the Arm v7E-M core architecture (thumbv7em-none-eabihf)
- Linux folk : I forgot to include a step prior to connecting your hardware to modify udev rules so you don't need to use sudo to access it.. Please check out: docs.rust-embedded.org/discovery/microbit/03-setup/linux.html#udev-rules
- Yes, I am aware of the probe-rs VS Code plugin, and it does look great! I was somewhat conflicted when making the video whether to present the probe-rs + VS code plugin or the "half-way" solution of pairing `cargo embed` with GDB... I figured the `cargo embed`/GDB route might be more helpful for those using a different editor, and/or already used to debugging in GDB. The probe-rs VS Code plugin looks amazing, though by their own admission it's currently in a preproduction/alpha stage: I did try it out, but found the disassembly for my code was jumbled, with some instructions showing up out-of-order, which could leave a newcomer a bit confused... Regardless, I know the probe-rs team is working hard on it, and it definitely has the potential to be the best solution for embedded debugging (plus its Rust all the way down!), so there will be a dedicated video on getting it set up in the future.
22:35 "If you found anything in this video useful" - This is clearly wrong. EVERYTHING in this video is useful. It's disgustingly good. It's a very complicated subject that deserves many hours of explanation, but you've somehow managed to condense the important bit into a fantastic video!
This series will be where I finally learn rust
What I was also thinking. This type of application is closest to what I'm studying for
Yep, easy to tell this series is going to be an instant classic. Also looking forward to this series!
Same here I was ringing the same
I really like the easy and happy style of the video 🎉
This is the most concise and to-the-point embedded rust video I've ever watched. Bravo!
I have no use for this, I have never written for an embedded machine, but boy do I love your style of content. You go into just the right amount of detail to keep me engaged, and I love learning about this sort of thing.
please dont stop this series i want to learn rust for embedded rather than c++ because rust is future in next 10 yrs
Just like Go was the future
Go and rust complement each other very well.
@@alaamroue rust is literally endorsed by the white house, it's not going away buddy
@@alaamroue Go is a garage collected language, Rust is not. With the release of embedded HAL 1.0, I think it's justified to get excited about the prospect of embedded Rust going mainstream.
This series will be responsible for a next gen of Rust embedded developers . I Love this 🤖
The embedded Rust revolution will be televised 🦀🦾
It very well could be! Hoping to follow along for the ride. Who knows, might even be me
@@therustybitscould you help us to make a tutorial for raspberry cm4’s embedded?
This is incredible! I have been searching for this exact series for the last 2 years! No other embedded rust videos are anywhere near as accessible as this, and I'm very excited to see where this goes. Actually showing the "dumb" steps like how to look up the architecture for a basic microcontroller is super essential for not losing people like me who have only touched external-chip development through something like the Arduino IDE or PlatformIO in some primitive C-like language. I finally have a reason to dust off my bootleg Uno device without having to find out of date oversimplified tutorials, downloading sketchy firmware or going using giant vscode extensions.
The quality of this video is just insane. The editing is crisp. The writing makes it so clear. The pacing is quick, but not overwhelming. The scope of the topic allows going into the perfect amount of detail of each item for a beginner. The music... it's perfect. It's so clean and classy. It matches the tone of the vocals and topic so well. The most obvious sub I've ever made.
Love your work, informative, interesting and professionally edited, hope the channel blows up!
I consider this to be the missing Rust Embedded Tutorial. Great job!
Best video about embedded rust I've seen, please continue this awesome series!
This channel is gonna be one of my favourites, keep hardworking on 🔥
8:50 Oh brother! Seriously though, really great and methodical walkthrough. Good for newbies too, I think a lot of us in embedded space assume everyone has intimate knowledge of linkers, memory maps, ISAs, vector tables, etc. thet you pick up along the way doing embedded dev. Its great to hear these things explained in context with Rust.
I was very lost between the concepts of embedded without knowing where to start and I came across this video. It's a revelation. And I skipped it at first because I can't stand those that appear on the screen for a long time, but luckily (because there are actually very few of them) I insisted again. Great exhibition. Thank you so much.
Amazing, This is beyond any tutorial / learning thing that I have ever came across, 20 mins felt like 2, I think am going to be a rust dev because of this series. Keep it up 🔥
You Absolutely Positively HAVE to continue this series!🔥
The calmest rust development video I ever watched. Great Content!
As a system security researcher trying to dive into embedded systems, this video has been like music to my ears!
You just gave me the motivation to start learning rust. Trying it embedded will surely be a nice challenge!
I have been eyeballing Rust for embedded systems for far too long. This is just what I need. Love that the information is so dense. Good format. Keep it up 😃👍
Incredible video! I am an electronics engineer student in Italy (with a focus on embedded systems) and have been taught the usual C and C++, which are very important to really understand what actually is going on under the hood (beside assembly). I was looking for tutorials for Rust in an embedded environment and your videos are the perfect match! Also the editing (AND MUSIC) are superb
I've been teaching myself rust for about a month now, and have heard that it is great for systems/embedded programming. This video made it clear to me that I'll have to get myself a few micro-controllers and play with them. Thanks for posting how to set things up. Subscribed!
This is fantastic. Anyone in this domain knows a good developer experience is a rarity. There are loads of great FOSS tools out there but learning and configuring them all is too much to ask of someone new to the field. The embedded Rust ecosystem makes it so much easier to get started. Great video!
Personally, I'd love to see a video on testing: local, emulator, and HIL.
I have been planning to get started with Rust for embedded systems for quite some time now. I am looking forward to the next video. I can't believe this is your second video and it is already top-notch. Keep up the good work!
This is an extremely useful tutorial. It's not just well-produced but you're really touching all the important points. Like making rust-analyzer stop trying to do automatic windows builds! Excellent. And subscribed.
Thank you. For including all the steps like how to identify the processor type. Small steps like these are often which cause a lot of problem for me when writing embedded code as lot of people skip these steps in video. Making it hard to follow through and implement for different processor type
You're probebly a movie director in a parallel universe. I've never coded Rust but I truly loved the way you explained everything. Keep it up.
I love the depth here. I've been programming in rust targeting Linux for awhile but I've been wanting to start an embedded project with an esp32 and wasn't sure where to start. I had no idea how much embedded specific tooling was out there so this is really helpful
As an old school industrial programmer, mainly in assembly, basic, c, and Fortran, I found this enlightening. It has been years since I have written code, but with the microcontrollers available now I have been considering recreating my earlier projects. Rust looks promising for that and I am setting up a system to work with it . Great video!
I love that you share and point out all the issues you run into along the way. Very enjoyable format.
Hands down my new favorite youtube channel!
Amazing content, this is the kind of video about Rust on bare metal that CZcams was needing, this series will be Incredible! 🚀
This is perfect! I read the rust embedded book and got up and running in a few hours, but this is so much better and concise. Please keep these quality videos coming :)
One suggestion: Like with documentation, it’s a good idea to specify upfront what assumptions you make about the person watching the video. “You should know about (x) and (y)”. That way people can Google any prerequisite knowledge beforehand.
Superb video! Can't heap more praise than the other comments already have!
The end left me hoping for just one more thing - VSCode integrated with GDB to set breakpoints using the editor, hover over variables to see their value, see the stacktrace in the side bar etc. I remember spending an afternoon setting up VSCode's launch.json to attach to a GDB server at IP:port to live debug a process (it was a userspace C app) that wasn't launched by VSCode's run/debug command (like you do with cargo in this case). Since you mentioned that you'll be using VSCode for all your projects on the channel, maybe this could lay a nice foundation.
Please keep making more of these! Cheers!
A very good start. Plus I love the jazz loops behind. Please go ahead !
This video couldn't come at a better time. excited for the series!
Great video! Great balance between new info and knowledge of Rust. I'm looking forward for next one.
Great video. Not too fast nor too slow. Very informative even for non rust dev like me. I will be learning it this year when my schedule opens up. I hope to learn more from you in the future. Thank you for sharing your knowledge.
Loved this video! It really gets me hyped for the series. You did an awesome job explaining things in a way that's super easy to follow. Keep it up!
Oh wow this is absolutely what I need to get started with embedded Rust! Thank you so much for this awesome content!
I love how you write your scripts, the words you use, and your voiceovers/narration. Very easy to listen to!
Amazing video, just ordered the board and planning to follow along with this series. Please keep the awesomeness coming 🎉
This is amazing. From the content to the visuals, sound…you nailed it!
Astounding. I was trying to search for this a couple months ago but could only find years-old articles that were impossible to follow. This is perfect
The best "all in one place" tutorial I've seen for embedded Rust. I'm looking forward to future videos from you.
Really great explanations, concise and not oversimplified. Also good editing work! Will definitely follow for more updates
Loving the tempo and quality of production and content, really professional. Thanks @therustybits, looking forward to watching more content!
I have only one criticism about your videos: you take too long to upload them. They are excellent.
I've already subscribed to the channel, turned on notifications, and liked.
You enjoy this work and it shows! Great listening and learning
Thank you, looking forward to where you take this series.
Insanely good resource. Covers many things I wouldn't have even guessed at. Thank you for this!
I really enjoyed the thorough explanation of the purpose of all the different packages and tooling.
You are good, very good! These videos are excellent, and how much effort and passion went into them SHOWS
Been on the hunt for Rust-embedded tutorials and it felt like a ghost town. Then I found your stuff - exactly what I was looking for. Huge thanks!
Fantastic tutorial! Looking forward to your next video 🎉
I played around with embedded rust about 4 years ago and i have to say it's come a long way. Great tutorial
Absolutely incredible video. All other embedded rust videos are so clunky, but yours is so streamlined. Will recommend this video to people for sure.
Thank you for releasing these videos! I am looking forward to learn rust and microcontrollers might be the way to start.
Music and production is top notch. You're gonna crush it with this quality kudos!
this is the most useful embedded rust video i watched to date, thank you very much, please continue on this series, liked and subscribed!
Enjoying the series so far, looking forward to what's to come.
Absolutely fantastic content. This is perfect.
Great tutorial, thanks a lot! So far I only used only C for my projects but now that I‘ve seen your two videos I’m exited to try out embedded rust. I’m looking forward to your next videos as they are well structured and generally super high in quality so far.
Apart from the content, I adore the quality, the style and the effort put into the video. Love it!
Very slick presentation - well done !
great watch, rust is looking more attractive by the day
Very excited for the rest of this series! 🥳 Subscribed 💪
such a nice and clear way to explain stuff! love your videos definetly will learn rust with this series ❤
Such an excellent guide, and timely! I had just started playing around with a Nordic microcontroller and had only figured out how to make it work with C. Thanks for helping me be able to Rustify this project!
Just came across your channel, and I love it. I already use Rust for applicaitons and webserver dev at work but I love the idea of learning Rust for the embedded space too. Keen to see where this series goes. You've got a great style already and balancing that sweet spot of engaging and informitive
Bought a board but didn't know how to start. Thank you. Might be the best intro to Rust on embedded devices on CZcams right now
this video is awesome and what's more it actually worked the first time. you earned a subscriber!
Clear and concise, yet thorough. Great guide that'll definitely help me out as im trying to move beyond Arruino.
Curious if you're intending to make some videos on using Rust with RISC-V chips.
Definitely
This is my new favorite channel. I might actually finally learn some rust but I also use esphome a lot
I started learning rust a few days ago, so I understood some of what was said. I feel exhausted just seeing how much more there is to learn. Should be fun, though :)
Wish this came out before i started my rust embedded journey, excellent video about setting up the basics requires, figuring this out on my own did teach me a lot about how a lot of this stuff truly works though, great vid mate❤
Quite literally ordered an ESP32-C3 a few days ago to get started with embedded Rust, and then youtube recommends this. Will be following along this series once I get it. Here's hoping I can keep up with the different hardware.
this was very simple, straightforward, elegant, and actually got me excited to hear about Rust. Very easy and light to understand. Well done.
Stellar video. Already had some basic embedded experience with Rust, but I can learn a lot from newer videos, and I got some clues about RTT an cargo embed which were under heavy development when I read about them. Thanks.
Good video.I'd love to see you go through the specifics for a Raspberry pi pico.
Wow thanks so much for making this! I haven’t followed along on a board of my own yet, I have a few things going on right now and can’t split my attention to far, but I will asap. I don’t have a portenta yet, but one of my designs would really benefit from a portenta h7 with its huge number of pins. I’m so excited for more of your videos. You are very clear and have a good mind for what subjects to cover. Can’t thank you enough.
Very nice and informative video, thank you. Please continue this series.
Always wanted to get into embedded programming and Rust... I love you!
sir you need to post more videos this was so awesome, the first video ive watched in 1x speed and enjoyed every bit of it ig time for me to deep dive into rust
Thanks so much. The content awesome, it is perfectly detailed and articulated, at a great pace. Looking forward your next videos.
This video teached me more about GDB than anything programming related I did in the last 5 years. Also love the content, absolutely precise, yet not too verbose, yet informative
Please make more of these great videos. Thank you.
Been looking for this kind of content for a while! Thanks much! Keep going strong!
As someone who works in 3 disciplines regularly, (Web, embedded, and electronics), I've been wanting to learn rust properly, for a while. I had no idea this build system was so mature. Sure, it's a lot of plugins, but it's tying together all the complexities of developing for bare metal.
Thanks for the video. Was trying to follow the Rust book for Embedded Development and was already having issues.
Your video helped a TON! Please keep up the good work.
Love this video! I have the microbit v2 and everything worked perfectly. Can't wait for more.
Woo! I've been waiting for the next video to hit my home page. Thanks for this!
I never thought I'd enjoy almost 30 minutes of programming-Kevin-Spacey teaching me embedded Rust. Great content, sir!
Amazing video, the first one everything works and with good explanation about the topics.
Please keep these videos coming. Where have you been all along. You are great
Wow! absolutely amazing! Great work.
Just starting out with Rust and I really like your teaching style. Keep up the good work.
Best video I've seen on this topic. Well done.
Great video! Can’t wait to watch more.