Embedded Rust for Concurrency, Embassy vs RTIC?

Hi everyone,
I’ve been diving into embedded Rust recently, working on a small IoT sensor node using an STM32 chip. I’ve got basic GPIO and UART working via the HAL crates, but I’m still trying to fully wrap my head around managing concurrency — especially when dealing with async tasks or interrupts.

Has anyone here built a project using embassy or RTIC for multitasking? I’d love to know which one you found more reliable or easier to scale. Also wondering how well async Rust really performs on lower-end MCUs and if there are tradeoffs I should be aware of.

Here are some links I’ve been referencing while experimenting:

@ariaj_1122, it's been a few years since I did any significant work with embedded Rust, so I'm a little out of date. I've never used embassy, but I did use RTIC when it was at v1.0. I really liked it. I would say it's a great choice if you need a hard real-time system or a system that is heavily interrupt-driven. For other projects, embassy might make more sense, but I'm not sure. I think it has a bigger ecosystem.

I can't really comment on the differences in usage of async. At first, RTIC had no async at all, but since then, they've added it as the new implementation of software tasks. The ability to mix real-time code with async seems like a big advantage for RTIC in my mind, but I've never used embassy, so I can't really compare them. However, I think async in general is a great fit for embedded. It lets you write straightforward code while delegating the generation of complex state machines to the compiler. People like to complain about async in Rust, but I think many of them don't fully understand just how useful it is in an embedded context. Many would probably be happy to simplify async for application software at the expense of embedded software. I'm happy the various Rust teams didn't do that.

Unfortunately, I think you've seen that there is not a huge embedded presence here. You might consider joining the respective Matrix channels for embassy and RTIC. You can also join the generic embedded channel. Those are a lot more active than here.

Where would I find the generic embedded channel?

The Rust Embedded working group has a link on their overview page. It's here.

1 Like