Embedded Rust setup explained
Вставка
- Опубліковано 15 чер 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 - Наука та технологія
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.
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.
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?
Best video about embedded rust I've seen, please continue this awesome series!
Love your work, informative, interesting and professionally edited, hope the channel blows up!
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.
I consider this to be the missing Rust Embedded Tutorial. Great job!
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.
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 🔥
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.
You Absolutely Positively HAVE to continue this series!🔥
You just gave me the motivation to start learning rust. Trying it embedded will surely be a nice challenge!
As a system security researcher trying to dive into embedded systems, this video has been like music to my ears!
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 😃👍
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!
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
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'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 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.
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 :)
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.
The calmest rust development video I ever watched. Great Content!
Amazing content, this is the kind of video about Rust on bare metal that UA-cam was needing, this series will be Incredible! 🚀
Oh wow this is absolutely what I need to get started with embedded Rust! Thank you so much for this awesome content!
The best "all in one place" tutorial I've seen for embedded Rust. I'm looking forward to future videos from you.
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
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
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!
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
I love how you write your scripts, the words you use, and your voiceovers/narration. Very easy to listen to!
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.
A very good start. Plus I love the jazz loops behind. Please go ahead !
Hands down my new favorite youtube channel!
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.
Loving the tempo and quality of production and content, really professional. Thanks @therustybits, looking forward to watching more content!
This video couldn't come at a better time. excited for the series!
You are good, very good! These videos are excellent, and how much effort and passion went into them SHOWS
this video is awesome and what's more it actually worked the first time. you earned a subscriber!
Woo! I've been waiting for the next video to hit my home page. Thanks for this!
I too like to justify my use of print for debugging but your explanation sounds so much more legit and elegant. I’ll be using it… I’m sure the wording applies to web servers. Cheers
I never thought I'd enjoy almost 30 minutes of programming-Kevin-Spacey teaching me embedded Rust. Great content, sir!
Always wanted to get into embedded programming and Rust... I love you!
great watch, rust is looking more attractive by the day
I was getting dizzy figuring rust on controllers like stm and esp because they would come with their own tooling etc.. Your video explains it so nicely! Thank you 🙏
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.
With this video you just jumped into the top 5 Rust channels, in my book. You take the time to explain what the problem is, how you scope it down, how you leverage a little bit of info to Google the rest. Rust isn’t easy, but you’re making it so someone can follow your trail.
(So many other popular Rust channels miss that, do show and tell, or try-too-hard at edgy entertainment)
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!
This video has been beyond merely educational for me, it helped me reduce errors with rust-analyzer with the check all targets and errors, it helped me find other extensions to help supplement my rust-analyzer, further immersed me in config.toml files, and finally taught me two new Linux commands. I'd just like to say thank you as a relatively novice Rust developer for your guidance kind sir.
Just starting out with Rust and I really like your teaching style. Keep up the good work.
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!
Great video! Great balance between new info and knowledge of Rust. I'm looking forward for next one.
Please keep these videos coming. Where have you been all along. You are great
Bought a board but didn't know how to start. Thank you. Might be the best intro to Rust on embedded devices on UA-cam right now
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
I’ve only been reading the Rust Book and not even interested in embedded software development, but this was a great video! Subscribed!
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
Ever since learning Rust, I've been heading closer and closer to embedded, but wasn't sure where entirely start. Thanks for the videos they're incredibly helpful!
Thank you for releasing these videos! I am looking forward to learn rust and microcontrollers might be the way to start.
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
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!
Thank you, looking forward to where you take this series.
I never wanted this video to end
Amazing video, just ordered the board and planning to follow along with this series. Please keep the awesomeness coming 🎉
this was very simple, straightforward, elegant, and actually got me excited to hear about Rust. Very easy and light to understand. Well done.
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 :)
This is amazing. From the content to the visuals, sound…you nailed it!
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.
I played around with embedded rust about 4 years ago and i have to say it's come a long way. Great tutorial
Best video I've seen on this topic. Well done.
this is the most useful embedded rust video i watched to date, thank you very much, please continue on this series, liked and subscribed!
Really great explanations, concise and not oversimplified. Also good editing work! Will definitely follow for more updates
I love that you share and point out all the issues you run into along the way. Very enjoyable format.
Insanely good resource. Covers many things I wouldn't have even guessed at. Thank you for this!
whoa, this was great. I'm going to have to watch a second time to absorb more.
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
Music and production is top notch. You're gonna crush it with this quality kudos!
You enjoy this work and it shows! Great listening and learning
Very slick presentation - well done !
Legitimately shared the entire world your windows 7 professional keys.
Very excited for the rest of this series! 🥳 Subscribed 💪
Finally, a proper tutorial for Rust on UA-cam. Keep posting 🔥
I really enjoyed the thorough explanation of the purpose of all the different packages and tooling.
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.
Absolutely incredible video. All other embedded rust videos are so clunky, but yours is so streamlined. Will recommend this video to people for sure.
such a nice and clear way to explain stuff! love your videos definetly will learn rust with this series ❤
I remember first learning about rust at university over 10 years ago. I was studying CS with Embdedded Systems and it looked totally ground breaking. However the language was still in alpha and the tooling and community wasn't nearly as polished or accessible.
Somebody else said it here, this may the resource that finally gets me to learn rust! Great channel!
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.
I'm a comp sci student and these videos are so helpful. Having someone with some personality teach is great!
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.
Apart from the content, I adore the quality, the style and the effort put into the video. Love it!
Enjoying the series so far, looking forward to what's to come.
This is the best introduction to embedded rust as you explain the deeds but without adding too much.
25 minutes of information dump i watched despite knowing it all, I just wish i had this years ago when i started embedded rust.
I guess next will come some cortex and register stuff? that then goes into a similar intro to project like RTIC and Embassy-RS?
also a spin off on how porperly set VScode's debusser would be nice, honesly i manged to make it work but im always afraid it will explode in my face
You’ve got my trajectory pretty well mapped out 😂
Tentatively: embedded rust layers of abstraction -> concurrency -> projects
Topic: on point ✅
Production: great ✅
fun: over 9000
Fantastic tutorial! Looking forward to your next video 🎉
Impressively explained!