Live data from Hacker News

Embassy: Modern embedded framework, using Rust and async

github.com

71–80 of 167 posts

Re: Embassy: Modern embedded framework, using Rust and async

#71

Earlier quoted context omitted.

I agree. the type safety that it brings to the HAL. it's a like cushion for people entering this space. never understood what a watchdog is tho...

A watchdog is a piece of hardware that will automatically restart the chip if it detects the code as being stuck. The way it detects this is that you have to poke a register of the watchdog every so often, and if the register hasn't been poked for a certain timeout (usually configurable), the chip is restarted. Watchdogs exist on MCUs but also on some "proper" computers. The Raspberry Pi has one for example.

>Watchdogs exist on MCUs but also on some "proper" computers

All modern computers have watchdog. You can check your logs

`journalctl -b | grep watchdog`

https://access.redhat.com/articles/7129255

Re: Embassy: Modern embedded framework, using Rust and async

#72
post #43

Earlier quoted context omitted.

If you had to pick a MCU to try this out on, do you have a preference for a devkit to test this with?

STM is popular because their lineup is cheap, offers a lot of features, and the documentation is readily available. The flip side is that their errata is lengthy, the Rust HAL is complex to support lots of different designs under the same product names, the documentation from STM is poorly organized and spread out over a zillion different documents, and Mac compatibility needs a gigantic asterisk. You can also get a…

> The flip side is that their errata is lengthy

Just like security bugs, lengthy errata doesn't mean anything. A popular MCU will have bigger errata sheet because it gets more eyes on it.

>documentation from STM is poorly organized and spread out over a zillion different documents

The spreading out over multiple documents is good organization. You don't want to combine your datasheet, reference manual and appnotes into one.

Re: Embassy: Modern embedded framework, using Rust and async

#73
post #66

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 kee…

>it finally feels like embedded is getting a toolchain that is actually modern and better

Last time i tried embassy, it pulled over 100 dependencies just to build a blinky. Its great for hobbyist programming but i doubt its going to be used in any industrial application any time soon.

Re: Embassy: Modern embedded framework, using Rust and async

#75
post #66

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 kee…

>it finally feels like embedded is getting a toolchain that is actually modern and better Last time i tried embassy, it pulled over 100 dependencies just to build a blinky. Its great for hobbyist programming but i doubt its going to be used in any industrial application any time soon.

It's already in use at least it automotive. If you are not working with safety critical systems (ADAS type) Rust and to some extent embassy is already in the wild. Companies like ETAS (https://www.etas.com/ww/en/) or Ferrous (https://ferrous-systems.com) are working to certify Rust and some crates (embassy is there) to be used with safety critical components. It's not question if but when it will be used. Volvo, Renault and some Chinese brands already ship cars with Rust embedded components in non safety critical path.

Re: Embassy: Modern embedded framework, using Rust and async

#76

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.

I would recommend getting a ST nucleo board over raspberry PICO or ESP32. The nucleo boards have integrated SWD programmer which makes flashing easier. You can also use it to debug your code. Try to get one with onboard USB port (like https://www.st.com/en/evaluation-tools/nucleo-f767zi.html) so that you can build USB projects.

Re: Embassy: Modern embedded framework, using Rust and async

#77
post #56

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.

I bought one of these on Amazon last week for $25: https://www.waveshare.com/esp32-c6-touch-lcd-1.47.htm I've been really impressed. It's basically a hackable Fitbit with no strap or battery. Full wifi, BLE, 6-axis motion. It's was really easy to get the C demos running. LVGL is awesome. Can't speak to Rust. I get enough of that complexity in my day job. Other brands that look good for beginners are Elecrow and Maker…

https://www.waveshare.com/esp32-s3-touch-lcd-4b.htm

This one is nice too, it has an enclosure. You could use this for a smart home dashboard. Be careful with the boards with two USB ports, they will backfeed power.

Re: Embassy: Modern embedded framework, using Rust and async

#78
post #61

Earlier quoted context omitted.

The README should be corrected then. It is currently making a very false claim.

The claim is you can get embedded concurrency without an OS. Do you disagree? I prefer C for embedded but must admit that's pretty compelling.

If it has async and concurrency isnt this an OS?

Re: Embassy: Modern embedded framework, using Rust and async

#79
post #66

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 kee…

>it finally feels like embedded is getting a toolchain that is actually modern and better Last time i tried embassy, it pulled over 100 dependencies just to build a blinky. Its great for hobbyist programming but i doubt its going to be used in any industrial application any time soon.

In all seriousness, why is that a problem? Surely for embedded, the size and hardware usage of the resultant binary is what matters, not the size/number of tools used to build it? I get that a lot of people worry about supply chain attacks right now (and that's fine, everyone should be thinking about how to mitigate that problem/reduce it) - but going back to a world where code re-use is significantly less usable isn't likely to magically make everything better, that has trade-offs too - particularly if (as plenty of people clearly do) they want a modern dev experience for embedded hardware.

Re: Embassy: Modern embedded framework, using Rust and async

#80
post #30

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 regu…

On the flip side, the stm32 firmware hello world from cubeide caused temperature spikes due to spinning. Embassy uses power states efficiently to reduce power draw and temp when nothing is scheduled. It is a huge tangible benefit to use async executors for firmware and I hold the strong belief that it should become the norm for general purpose uC firmware.

>the stm32 firmware hello world from cubeide caused temperature spikes due to spinning

That should never happen unless you are using a high end 1GHz+ MPUs.Check your GPIOs to make sure there are no shorts.

Post reply on HN