Hacker News new | ask | show | jobs
by drrotmos 715 days ago
Personally, I've begun switching over my RP2040 projects to Rust using Embassy. Rust did take some getting used to, but I quite like it. Not an RTOS, but it satisfies a lot of the same requirements that'd lead you to an RTOS.
6 comments

If you go this route, I would recommend starting off with the rp2040-hal crate and once you hit a pain point of managing multiple tasks, look into embassy or RTIC.

Rust and Cargo take the pain out of building and flashing to the RP2040 (or STM32, for that matter) - it's the most pleasant embedded setup I've ever used.

That is what I've observed too. My impression is that people go to RTOS for libraries and dependency management, which you kinda just get out of the box with Rust, cargo and crates.io.

A lot of applications simply don't use the MPU. And then consider what you get from Rust memory safety and the reduction in overall complexity of the firmware without the RTOS.

I can totally second this. Embedded rust in general has been an excellent experience for me. And async with embassy-executor works really well and takes a lot of pain off the whole rtos design process.
100%, Embassy is great and I'm in love with it. If you add the PIO interface for RP2040 the setup makes code super simple and beatiful and difficult to achieve with another processor.
Wow that looks cool. Thanks for the mention!
I believe this has come up before but what are some of the differences between RTIC and Embassy?
RTIC is really simple and doesn't use it's own HALs. Also it's macro system makes it hard to modularize your code since all tasks need to be in one module. I've played around with it a bit and it seems like it could be great in the future, but currently not really.

Embassy has it's own HALs which makes it better at async and has also nicer ergonomic IMO

Importantly for RP2040 users, RTIC 2.0.0 is currently single-core only.

I’m using RTIC for the firmware on my STM32H7 based product (https://umi.engineering) and it has been a joy.

> Embassy has it's own HALs which makes it better at async and has also nicer ergonomic IMO

Worth noting, you don't HAVE to use the embassy HALs with the embassy executor. However, AFAIK, the only mainstream non-embassy HALs that supports async is the ESP32 HALs.

There's no technical lock in, it's just that everyone I've seen implementing async support (outside ESP32) tends to do it within the Embassy project today. That may change over time.

The Atsamd-rs dev has been working on async support without embassy as far as I know but I don't know if it's usable yet
One of the things not immediately apparent for people coming to Embassy is that you can mix and match RTIC with the Embassy HALs. So the more appropriate comparison is RTIC vs the Embassy async executors.