Embassy: Modern embedded framework, using Rust and async

github.com

292 points by birdculture 21 hours ago


hannesfur - 20 hours ago

I am a big fan of the embassy project and it’s a great example of why async Rust is so great: Because this is possible. It works without a heap, is a really low cost abstraction and you can do stuff concurrently on a single core chip (where you can’t just spawn a new “thread”) and you don’t have the complexity of an RTOS. I believe there is a great future for embassy ahead and it’s so great how far the team has come.

I also want to give a shoutout to reqwless (https://github.com/drogue-iot/reqwless) which is a HTTP client for embassy-net that even supports HTTPS!

Rust embedded was really never actually better then C or C++ but embassy for me is a big reason why I now make my buying decision based on how well I can use Rust on the MCU.

carlkcarlk - 5 hours ago

I’ve been enjoying Embassy most at the application pattern layer: long-lived device tasks that hide timing and coordination behind a small, typed async API. For example:

loop { let btn = ir.wait_for_press().await; // use btn }

Meanwhile the compiler builds the state machine for you.

I think this style is an emergent property of async + no-std that hasn’t really been collected or named yet. A lot of discussion focuses on HALs, bring-up, or executors, but less on how people structure applications once those pieces are in place.

Brad Gibson and I talked about some of these ideas in this (free) article on how Embassy shines on embedded devices: https://medium.com/@carlmkadie/how-rust-embassy-shine-on-emb...

I’ve also started an open repo to experiment with and document these patterns: https://github.com/carlkcarlk/device-kit

Would love links to other repos that use Embassy at this higher, application-oriented level.

unsolved73 - 5 hours ago

Embassy and async Rust are probably the best things that have happened to the embedded world in the past decade!

C RTOSes are conceptually nice, but such as pain to use in the real world, a lean framework like embassy is the natural evolution.

The best thing is that embassy can actually be considered as a real-time "OS" (you can read more here: https://kerkour.com/introduction-to-embedded-development-wit...).

jpgvm - 13 hours ago

I'm loving Embassy.

Coming from a lot of bare metal C and FreeRTOS it finally feels like embedded is getting a toolchain that is actually modern and better.

Some of that isn't just Embassy but the surrounding ecosystem, some highlights:

* probe-rs w/cargo run integration

* defmt logging (combined with probe-rs and rtt it's very nice)

* embedded_hal (and in my case stm32-rs)

I have also tried RTIC but I decided to keep going with Embassy because I like the async ergonomics more and the few times it's been a downside/missing functionality (no existing async driver for specific peripherals basically) it wasn't to hard to implement what I needed.

I was surprised it just works out of the box on OS X also, generally speaking I would always end up having to use Linux to develop for embedded. Being able to compile on fast Apple M hardware and then run immediately with zero friction is awesome.

It took a little bit to get my head around how to share access to peripherals etc but once I did it's been great and it's nice to know that locking semantics are essentially enforced at compile time so it's actually not possible to have 2 things stomping over the same bus etc which can sometimes be a very hard bug to track down when working with big and fast SOCs.

Other really big aspect Embassy has been good for is really high quality USB and networking stacks. I am using both the USB stack (for PLDM over USB) and Ethernet w/the TCP stack in embassy_net and both have been flawless.

Only real downsides I can think of are it can sometimes be hard to onboard folk that are used to copy/paste from vendor examples and sometimes communicating and debugging with vendors themselves when they aren't familar and won't engage unless you can reproduce on the vendor HAL.

So overall really happy with it and I highly recommend trying it out especially if you are in the STM ecosphere.

chaosprint - 2 hours ago

I'm rewriting glicol (https://glicol.org/) with no std, and embassy-rs + 2350 is my go-to choice. Highly recommand this stack if you're planning to start working with embedded systems in 2026.

stack_framer - 18 hours ago

Probably off topic, but what's the best way to get started with embedded development? I've been a web developer for over a decade, but I'd really love to try something much lower level, and I'm currently making my way through the Rust book. I've got a Raspberry Pi on the way, but I assume that's not truly embedded development.

mentar - 20 hours ago

Been using this to build a LoRa relay for the Bitchat app running on nrf52, it's actually very smooth for the most part. The only panics I seem to get are from the Nordic's SoftDevice, not for the ebasssy-rust code itself.

rhinoceraptor - 20 hours ago

I had been using this to try to build a Spark modeling guitar amp pedal controller, controlling the amp via BLE. It seemed pretty promising, and they have their own fully OSS Rust BLE stack. It seemed a little early days with that though, it seemed like the APIs were changing quite a bit and it required pinning git revisions in Cargo. I'm excited to see where the project goes!

kaspar030 - 20 hours ago

Also check out Ariel OS (https://ariel-os.org), which is built on top of Embassy.

bfrog - 18 hours ago

It's also being used by microsoft for EC https://opendevicepartnership.org/embedded-controller

the__alchemist - 20 hours ago

This is at the center of a friction point in embedded rust: most of the OSS ecosystem has shifted to this framework, and as a result, is incompatible with, or is high friction if you don't want to make your firmware and control flow Async. This is notable because Rust embedded is nascent and small, so I think splitting the ecosystem along with Async is not ideal. It's also confused some people new to embedded: I regularly hear this dichotomy: "Async vs blocking"; the assumption being if you are not using Embassy, your code blocks the CPU when waiting for I/O, etc.

If you enjoy Async PC rust programming, I think this will be a good starting point. I like how it has unified hardware access to different MCUs, and its hardware support for STM32, for example, is a step up from the initial generation of Trait-based HALs. I seem to be the odd one out as an embedded rust programmer (Personally and professionally) for whom Async is not my cup of tea.

sgt - 9 hours ago

My only question is - is this tinker friendly? C is tinker friendly, it's not all about correctness and so on.

Not that I mind correctness, but I want to play with this and maybe do some minor hobby projects with limited cognitive load.

Otherwise I'd just do FreeRTOS, which is also a good option.

junon - 18 hours ago

Great to see this on HN front page. Have used embassy several times for projects and it's a beautiful work of art. Highly recommend.

k__ - 6 hours ago

I was pretty stoked to find this a month ago.

Sadly, I bought an nRF54L15 board to start my embedded journey, which isn't 100% supported yet :/

Now I have to wait. I'm not gonna go back to C :D

aomix - 7 hours ago

I haven't had a chance to do embedded work but people damn near fall to their knees and weep when talking about how nice the experience is using embassy. Which makes me want to give it a try.

roger_ - 7 hours ago

Async embedded is something that's always made sense to me and I've been awaiting a long time for it to happen.

But what's the overhead price with Embassy?

n8henrie - 17 hours ago

I never learned any C based languages, so it's been a challenge, but I've enjoyed learning the basics of bare-metal no_std rust on the esp32c3, with esp-rs and its support for embassy to help me get started!

My learning project -- using mqtt for HomeAssistant integration: <https://github.com/n8henrie/esp32c3-rust-mqtt>

Svoka - 18 hours ago

This channel contains videos of journey from setting up environment and busy wait embedded LED blinking, to basically re-inventing and then using Embassy. 4 oldest videos.

https://www.youtube.com/@therustybits/videos

speed_spread - 7 hours ago

Is there a USB host stack for embassy? I was writing my own and had bootkbd working-ish but never got further.

aitchnyu - 7 hours ago

Umm, is this an OS with scheduler and process manager etc thats running circles around their competitors?

mrdataesq - 19 hours ago

Another reason why async Rust is great: https://rtic.rs/

"The hardware accelerated Rust RTOS" -- it can use your interrupt controller as a scheduler.

brcmthrowaway - 18 hours ago

Any ESP8266 ports?

adastra22 - 18 hours ago

> It obsoletes the need for a traditional RTOS with kernel context switching

Uh, what does async have to do with hard real-time guarantees?

unit149 - 11 hours ago

[dead]

therecat - 12 hours ago

[flagged]