The Rusty Bits
The Rusty Bits
  • 9
  • 198 408
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
มุมมอง: 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...

ความคิดเห็น

  • @user-gp7sn4fh9t
    @user-gp7sn4fh9t 13 ชั่วโมงที่ผ่านมา

    I can't wait for the next tutorial, the are so great!

  • @lawrencemanning
    @lawrencemanning 13 ชั่วโมงที่ผ่านมา

    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.

    • @therustybits
      @therustybits 10 ชั่วโมงที่ผ่านมา

      Kind of? Looks like it's currently only available in the nightly version of the compiler: docs.rs/ranged_integers/latest/ranged_integers/

  • @skeleton_craftGaming
    @skeleton_craftGaming วันที่ผ่านมา

    That's the best kind of depends. [And I will admit that is one way that rust is better than C /C++]

  • @j-p-d-e-v
    @j-p-d-e-v วันที่ผ่านมา

    Whenever I watch your videos. It always inspires me to continue studying Embedded Rust Programming.

  • @zypheroq
    @zypheroq วันที่ผ่านมา

    why you askin me

  • @AndyDuplain
    @AndyDuplain วันที่ผ่านมา

    Fantastic information! Thank you!

  • @Alsteraib985
    @Alsteraib985 วันที่ผ่านมา

    Great channel !

  • @Alsteraib985
    @Alsteraib985 วันที่ผ่านมา

    I like to call the Rust safety as conciseness, because of the correctness of the code results.

  • @eter9nitysslut131
    @eter9nitysslut131 วันที่ผ่านมา

    this is why rust sucks

  • @jakobgegeniger6793
    @jakobgegeniger6793 2 วันที่ผ่านมา

    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.

  • @asumiluna9066
    @asumiluna9066 2 วันที่ผ่านมา

    That looked weird

  • @rammrras9683
    @rammrras9683 4 วันที่ผ่านมา

    You found too many ways of blinking an LED and I found a great channel to follow!

  • @utubercj
    @utubercj 4 วันที่ผ่านมา

    Simple and easy follow Tutorial: Please make a tutorial on Embedded Debugging , thank you

  • @0x_cromosomes
    @0x_cromosomes 6 วันที่ผ่านมา

    Thank you for this great tutorial 🎉

  • @chari_md2
    @chari_md2 6 วันที่ผ่านมา

    what are you using to edit your videos? great work not only on the embedded side but also on the editing wow

    • @therustybits
      @therustybits 6 วันที่ผ่านมา

      Thanks! Currently using Final Cut Pro for video editing.

  • @marcelocorrea7916
    @marcelocorrea7916 7 วันที่ผ่านมา

    Congrats on the video, well paced, well explained. A suggestion, to make a risc-v version of this video.

  • @TenderAI
    @TenderAI 8 วันที่ผ่านมา

    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?

  • @teuluPaul
    @teuluPaul 10 วันที่ผ่านมา

    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.

  • @ChidleyITCompute-ye7hc
    @ChidleyITCompute-ye7hc 13 วันที่ผ่านมา

    I feel like I'm getting a little bit clever with every video.

  • @i.8530
    @i.8530 13 วันที่ผ่านมา

    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.

    • @therustybits
      @therustybits 13 วันที่ผ่านมา

      Ahh that makes sense, thanks for the feedback!

  • @targaR32
    @targaR32 15 วันที่ผ่านมา

    always preferable to use rust over c 😅 also new mic is sounding good.

  • @paulroberto2286
    @paulroberto2286 16 วันที่ผ่านมา

    And then there's people like me who were drawn to rust thanks to cargo :)

  • @rohanpandey9957
    @rohanpandey9957 17 วันที่ผ่านมา

    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

  • @ignaciodelvalle158
    @ignaciodelvalle158 18 วันที่ผ่านมา

    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.

  • @vit4mint685
    @vit4mint685 20 วันที่ผ่านมา

    Thank you, looking forward to where you take this series.

  • @jesusvelasco4893
    @jesusvelasco4893 20 วันที่ผ่านมา

    Amazing

  • @HolarMusic
    @HolarMusic 20 วันที่ผ่านมา

    on windows, just do winget install rustlang.rustup

  • @arnetriesyoutube
    @arnetriesyoutube 21 วันที่ผ่านมา

    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!

    • @therustybits
      @therustybits 21 วันที่ผ่านมา

      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 😀

  • @debuti
    @debuti 22 วันที่ผ่านมา

    Thanks for sharing!! Id love to see async rust on embedded if possible

    • @therustybits
      @therustybits 21 วันที่ผ่านมา

      Hopefully next main channel video will cover async 😅

  • @TheEvertw
    @TheEvertw 22 วันที่ผ่านมา

    This is a masterful video, HIGHLY recommended if you want to start with embedded Rust.

  • @PauloLuisFranchiniCasaretto
    @PauloLuisFranchiniCasaretto 22 วันที่ผ่านมา

    Great content, and great production. The music is such a vibe

  • @timothymApps
    @timothymApps 23 วันที่ผ่านมา

    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.

  • @12rjig13gb
    @12rjig13gb 24 วันที่ผ่านมา

    Thanks to your introduction, I've been having fun in bare-metal rust

  • @Onyx-it8gk
    @Onyx-it8gk 24 วันที่ผ่านมา

    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.

    • @therustybits
      @therustybits 24 วันที่ผ่านมา

      Yes Zed looks awesome! Going to have to give it a try some time..

    • @Onyx-it8gk
      @Onyx-it8gk 24 วันที่ผ่านมา

      ​@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.

  • @weiSane
    @weiSane 24 วันที่ผ่านมา

    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 👌

  • @casper-3
    @casper-3 25 วันที่ผ่านมา

    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.

  • @JulianBolivarGaleno74
    @JulianBolivarGaleno74 26 วันที่ผ่านมา

    Good to know that crate to help on the stack overflow debugging

  • @johncoleman5666
    @johncoleman5666 26 วันที่ผ่านมา

    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?

    • @therustybits
      @therustybits 26 วันที่ผ่านมา

      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. ⚡️🚨

  • @tylerbloom4830
    @tylerbloom4830 26 วันที่ผ่านมา

    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!

    • @therustybits
      @therustybits 26 วันที่ผ่านมา

      Very interesting, gotta love all the compile-time correctness checks Rust offers! Thanks for sharing Tyler!

  • @yperboreus
    @yperboreus 26 วันที่ผ่านมา

    Thanks for the vids so far, here’s to getting a lot more people into embedded!

  • @skeleton_craftGaming
    @skeleton_craftGaming 27 วันที่ผ่านมา

    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]

    • @therustybits
      @therustybits 24 วันที่ผ่านมา

      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

  • @skeleton_craftGaming
    @skeleton_craftGaming 27 วันที่ผ่านมา

    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.

  • @skeleton_craftGaming
    @skeleton_craftGaming 27 วันที่ผ่านมา

    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.

    • @therustybits
      @therustybits 24 วันที่ผ่านมา

      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.

  • @aperson6389
    @aperson6389 27 วันที่ผ่านมา

    Where heap?

    • @therustybits
      @therustybits 26 วันที่ผ่านมา

      Often not used in embedded applications, but you could certainly squeeze it above the stack as well..

  • @thisisnotok2100
    @thisisnotok2100 27 วันที่ผ่านมา

    Very cool! Why do you need special hardware to place the stack below static memory?

    • @therustybits
      @therustybits 27 วันที่ผ่านมา

      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.

  • @peter9477
    @peter9477 27 วันที่ผ่านมา

    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.

  • @lefran229
    @lefran229 27 วันที่ผ่านมา

    Yessss! More of these!!

  • @panagiotischagias4119
    @panagiotischagias4119 27 วันที่ผ่านมา

    awesome!

  • @Onyx-it8gk
    @Onyx-it8gk 27 วันที่ผ่านมา

    This is so cool!!! I just ordered my microbit. I'm sure you're busy, but hopefully you'll keep making these videos.

  • @nathanleiby
    @nathanleiby 27 วันที่ผ่านมา

    Love your clear explanations!