- 9
- 198 408
The Rusty Bits
United States
เข้าร่วมเมื่อ 16 ก.พ. 2023
Embedded software development in Rust 🦀
#rust #embedded #firmware
#rust #embedded #firmware
Blinking an LED: Embedded Rust ecosystem explored
Today we find several ways to blink an LED, and explore the various layers of abstraction within the embedded Rust ecosystem.
Chapters:
0:00 Intro
0:36 Peripheral Control
3:47 Unsafe Rust
6:13 Peripheral Access Crate
8:09 Hardware Abstraction Layer
10:56 Some(Rust)
14:00 Board Support Package
17:03 The Rusty.. Kit?
References:
th-cam.com/video/TOAynddiu5M/w-d-xo.html
@letsgetrusty th-cam.com/video/NDIU1GSBrVI/w-d-xo.html
"The Book" | doc.rust-lang.org/book/index.html
Special thanks to Patreon supporters!
- David King
Chapters:
0:00 Intro
0:36 Peripheral Control
3:47 Unsafe Rust
6:13 Peripheral Access Crate
8:09 Hardware Abstraction Layer
10:56 Some(Rust)
14:00 Board Support Package
17:03 The Rusty.. Kit?
References:
th-cam.com/video/TOAynddiu5M/w-d-xo.html
@letsgetrusty th-cam.com/video/NDIU1GSBrVI/w-d-xo.html
"The Book" | doc.rust-lang.org/book/index.html
Special thanks to Patreon supporters!
- David King
มุมมอง: 14 193
วีดีโอ
Embedded Rust setup explained
มุมมอง 72K2 หลายเดือนก่อน
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 1...
Moving from C to Rust for embedded software development
มุมมอง 77K4 หลายเดือนก่อน
Writing production-grade firmware is hard, but maybe we're making it harder than it needs to be. Join me in exploring some of the common pitfalls of embedded software development in C, and how Rust appears to be well-positioned to address these issues. Oh, and welcome to the channel! 👋 Resources: @letsgetrusty | th-cam.com/video/usJDUSrcwqI/w-d-xo.html @NoBoilerplate | th-cam.com/video/br3GIIQe...
I can't wait for the next tutorial, the are so great!
Does Rust have ranged integers? That’s the next level integer type. These were extremely useful when I looked at Ada many years back. Debug builds only, I suppose.
Kind of? Looks like it's currently only available in the nightly version of the compiler: docs.rs/ranged_integers/latest/ranged_integers/
That's the best kind of depends. [And I will admit that is one way that rust is better than C /C++]
Whenever I watch your videos. It always inspires me to continue studying Embedded Rust Programming.
why you askin me
Fantastic information! Thank you!
Great channel !
I like to call the Rust safety as conciseness, because of the correctness of the code results.
this is why rust sucks
Great Introduction, I followed your guide and the setup was a piece of cake. I would love to learn from you, how to structure a bigger embedded project. Hopefully some with unit tests, that could also run partly on the Host system.
That looked weird
You found too many ways of blinking an LED and I found a great channel to follow!
Simple and easy follow Tutorial: Please make a tutorial on Embedded Debugging , thank you
Thank you for this great tutorial 🎉
what are you using to edit your videos? great work not only on the embedded side but also on the editing wow
Thanks! Currently using Final Cut Pro for video editing.
Congrats on the video, well paced, well explained. A suggestion, to make a risc-v version of this video.
It is so impressive that you show me a way to make it and give me the passions of starting learn rust. And could you help to create a new tutorial for how to rust embedded with raspberry cm4 or pi? Or could you just explain any differences between micro bits board and RPI board in your new video or shorts?
For Gentoo Linux users: to use gdb with embedded devices - enable the multitarget flag for dev-debug/gdb, then re-install. Invoke simply with gdb, and follow along with the instructions in the video. Everything else works as explained in the video and the "Errata" post.
I feel like I'm getting a little bit clever with every video.
I like your style, informative and relaxed :) This is also a bit of a nitpick but you're not allowed to bypass the borrow checker even in unsafe. For example casting a shared reference to a mutable reference through raw pointers is UB. Same for having multiple mutable references to the same variable, it's just not enforced like in safe Rust.
Ahh that makes sense, thanks for the feedback!
always preferable to use rust over c 😅 also new mic is sounding good.
And then there's people like me who were drawn to rust thanks to cargo :)
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 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.
Thank you, looking forward to where you take this series.
Amazing
on windows, just do winget install rustlang.rustup
I really loved this video and I hope to see more from you soon :) One question: What is your workflow with music? Do you write it yourself or is there some nice software you use? Is it stock music that is just timed really well? Thanks!
All the music is from Epidemic Sound, for now at least.. I think I'm burning through some of their best content at an alarming rate 😅 I try to find songs that fit the mood of the chapter or just sound cool & help carry the story forward, and try not to reuse tracks between videos. Editing is done in Final Cut Pro. We'll see how long I can continue making videos this way, but for now I'm really enjoying how they turn out 😀
Thanks for sharing!! Id love to see async rust on embedded if possible
Hopefully next main channel video will cover async 😅
This is a masterful video, HIGHLY recommended if you want to start with embedded Rust.
Great content, and great production. The music is such a vibe
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.
Thanks to your introduction, I've been having fun in bare-metal rust
Have you heard of Zed by chance? It's made by the devs of Electron, Atom and tree-sitter, and it's written in Rust! They have a release version for Mac, but I'm still waiting on the Linux release. It's very new, so I would imagine there aren't as many third-party plug-ins available as vscode.
Yes Zed looks awesome! Going to have to give it a try some time..
@therustybits It would be really interesting to hear a little of your back story, like how you got interested in computers/programmers, what got you interested in embedded, that sort of stuff. It felt like I was kind of mindlessly learning programming without really knowing what I ultimately wanted to do. I'm still relatively new to programming. Once I discovered embedded, I absolutely fell in love with it. I'm now back in school for it and just finished my first semester while returning.
The production quality and the simple way you teach and explain things makes it such a great experience to watch and learn from your videos. This is too good 👌
I can't believe your earliest video is only 3 months old! The quality tells me you've been doing this for years, but I'm glad I caught this train just as it was leaving the station.
Good to know that crate to help on the stack overflow debugging
May be a question showing my ignorance with Rust and Microcontrollers but, if we have 1 pin for 25 leds, is it still possible to light them all at the same time? Not just to the naked eye, but in real time as well?
Generally speaking, if you want to independently control N LEDs, you’ll need N pins to control them, assuming you’re not using dedicated external hardware that is effectively doing this for you. In the case of the microbit, we only light up one row or 5 LEDs at a time, though we do use all 10 pins to do this: the row pin we are interested in is high (the others must be all low), then each column pin is either high (no voltage difference across LED, is off) or low (voltage difference across LED, is on). If you just want to light up all N LEDs at the same time and don’t need to individually control them, you can wire all their cathodes to ground (through resistors) and all their anodes to one pin, assuming it can handle the current requirements without dropping too much voltage. ⚡️🚨
There is a third way to handle error (thought it is much more niche). Certain invariant checks can be moved from runtime to compile time by adding panics that are evaluated at in a const context. This will cause the build to fail instead of asserting things at runtime. With the recently stabilized inline-const feature, this has gotten much easier to do!
Very interesting, gotta love all the compile-time correctness checks Rust offers! Thanks for sharing Tyler!
Thanks for the vids so far, here’s to getting a lot more people into embedded!
How does rust deal with that? Because like in rust you can't just write to arbitrary memory addresses like you can in C [speaking of which, someone really needs to propose a proposal to change C's name, it's impossible to speech to text]
To write to an arbitrary location in memory, you’ll need to use unsafe Rust: th-cam.com/video/A9wvA_S6m7Y/w-d-xo.html
You literally do not need any of that s***, except for a compiler I will admit that you do need a compiler if you want to produce a binary out of your code... And if you need to test your code, that's [in most cases] a skill issue. [By that, I mean if you need to write dedicated unit tests rather than specifically implementing your API to work on a specific application].. Also, why use c, C++ is better? It has all of the upsides of rust with literally none of the downsides ... Also, visual Studio, is the answer to all of those things except for maybe testing. I don't know if Visual Studio has testing built into it.
Cope
@@senbonzakura662 a little ... a little.
I am a competent enough C++ programmer to not do that [not that that's a particularly competent C++ programmer; all the language asks you to do is stay relatively up to date with your version].. That and coupled with a few other reasons I think I'm good.
Embedded systems will often forgo the use of a heap, leaving more that is either statically defined or placed on the stack. In these kinds of resource-constrained environments, you need to be very careful with memory usage. It’s a bit difficult to know at compile time what your peak stack depth will be without the use of specialized tools, so it can pay to have some cheap insurance in case you do run out of memory.
Where heap?
Often not used in embedded applications, but you could certainly squeeze it above the stack as well..
Very cool! Why do you need special hardware to place the stack below static memory?
For the general technique I don't think you do, though the `flip-link` tool mentioned is currently specific to Arm Cortex-M based microcontrollers.
You didn't mention the limitation that makes using fliplink infeasible in some situation.... and I'm afraid I don't even remember what it was offhand. I only know we had to stop using it. :-( Might have been when using the SoftDevice on nRF52.
Yessss! More of these!!
awesome!
This is so cool!!! I just ordered my microbit. I'm sure you're busy, but hopefully you'll keep making these videos.
Love your clear explanations!