Skip to content
0:00 / 0:00

#rust#async-await#embassy

From Zero to Async in Embedded Rust

The Rusty Bits

33K subscribers • 5 videos on Hallway

YouTube

Intermediate. Assumes working knowledge.

63K views2 years ago3 recommendations

Systems programmingHardwareRustEmbedded systemsConcurrency and parallelism

How to build an asynchronous runtime from scratch in embedded Rust to understand async/await, futures, and interrupts.

Today we learn about async/await and how it works in an embedded environment by... building an async runtime from scratch in embedded Rust! We also cover time-keeping, state-machines, interrupts and futures.. and a smidge of embassy, which we'll use extensively in future videos. Subscribe : youtube.com/@therustybits?sub_confirmation=1 Patreon : patreon.com/therustybits Chapters: Intro Project Setup Timekeeping State Machines Interrupts Futures async/await embassy Awaiting the end Special thanks to `word` and `long`Patreon supporters! - David King - Julian Bolivar - Χάρης Αμαράντηγος References: youtu.be/TOAynddiu5M youtu.be/A9wvA_S6m7Y github.com/therustybits/zero-to-async microbit schematic | github.com/microbit-foundation/microbit-v2-hardware nRF52833 datasheet | infocenter.nordicsemi.com/pdf/nRF52833_PS_v1.6.pdf Rust core::pin docs | doc.rust-lang.org/core/pin/index.html embassy | embassy.dev/ youtu.be/H7NtzyP9q8E lilos | github.com/cbiffle/lilos/ Cliff Biffle's 2023 OSFC talk introducing lilos | osfc.io/2023/talks/turn-your-code-inside-out-programming-and… Cliff Biffle's blog | cliffle.com/blog without boats blog | without.boats/blog/ The Embedded Rust book | docs.rust-embedded.org/book/ "The Book" | doc.rust-lang.org/book/index.html

Why it's here

3 people recommend this

What people say. Highly recommended for explaining how async runtimes, executors, and state machines work in embedded Rust.

u/hak8orin r/rust • Recommends

On “From Zero to Async in Embedded Rust”

This is a youtube series that started up a few months ago, which in my opinion is exceptional at teaching rust in an embedded context. - link to this video - link to this video - link to this video - link to this video I honestly wouldn't be surprised if the presenter works in education or does such presentations for a living, because it's genuinely very well put together. This specific one goes over how async looks in an embedded context. Huge fan, and goes into proper depth of how things actually work, instead of solely a very high level overview.

u/juanfnavarrorin r/rust • Recommends

On “How do you build your state machines?”

You can use async rust and convey your state machines as asynchronous functions. link to this video After watching this video and implementing a runtime, I realized pretty much any state machine can be represented as linear code flow by using futures.

u/RadiantHueOfBeigein r/rust • Recommends

On “Hi everyone! What's your take on whether Rust is ready to power production-level embedded systems? I'm really curious to know what everyone thinks and why!”

I think the educational aspect is well taken care of: I grew up back when 32-bit micros were considered overkill and way too expensive, I'm currently teaching a batch of students (well, employees) who all started embedded with Rust, and don't see any issues with their understanding. The async runtimes are well documented *and* explained, executors and wakers are an elegant concept that's (in my experience) immediately clear to most novices, unlike traditional task switching with stacks, register files, copying stuff around... We wrote an async runtime from scratch as part of the "boot camp", mostly following this series on YouTube.

u/RadiantHueOfBeigein r/rust • Recommends

On “Hi everyone! What's your take on whether Rust is ready to power production-level embedded systems? I'm really curious to know what everyone thinks and why!”

I think the educational aspect is well taken care of: I grew up back when 32-bit micros were considered overkill and way too expensive, I'm currently teaching a batch of students (well, employees) who all started embedded with Rust, and don't see any issues with their understanding. The async runtimes are well documented *and* explained, executors and wakers are an elegant concept that's (in my experience) immediately clear to most novices, unlike traditional task switching with stacks, register files, copying stuff around... We wrote an async runtime from scratch as part of the "boot camp", mostly following this series on YouTube.

u/MerrimanIndustriesin r/rust • Mentions

On “Embassy... rtic... Something else?”

In my opinion, RTIC, RTOS' (Tock or maybe Hubris if you want to stay Rusty), Embassy, and no runtime are all good options for different projects. So it really depends what you want to do. Embassy might be better for an event-driven project with a lot of IO-bound tasks. RTIC and RTOS for a project that's very hardware-driven with highly specific timing requirements. Not bringing a runtime at all would be fine for a mostly single-purpose device. Starting without a runtime wouldn't be a bad idea if you're not quite sure what you need and you're new to embedded. The Rusty Bits has a good new video where he goes from bare metal to Embassy in progressively higher steps of abstraction.