I’m doing some C on esp32 currently, and wondered about switching to rust, and I understand that simple cases with Rust are solid. I’m definitely interested in trying it out.
However we need to work with a lot of the hardware apis like twai, ble, lte, ota, etc. It seems like support is spotty or it’s DIY.
It’s also worth keeping mind the remark about developer availability. I can generally answer questions about the C to someone who’s not experienced in C, while Rust might be another story.
I can somewhat attest to this! I have a pretty extensive prototype of using Rust on ESP32 in production. I wrote a reference implementation for ESP32 platforms deployed via BRSKI, a secure remote key bootstrapping protocol which builds upon attestation keys and public key infrastructure.
I'm largely using `esp-idf-svc` for most things, which is a Rust-native wrapper around ESP-IDF code. For anything closer to the hardware, I'm using `esp-idf-sys` which is just a thin wrapper around the the `ESP-IDF` SDK.
Hi! Thanks for your reply. First time hearing about Brski, I’ll have a look
I guess your takeaway is that despite spotty support, the benefits of rust are net positive? I guess learning to call C from Rust is gonna be part of it too right ?
I would say that the benefits are definitely worth it. I make a point to only never use `unwrap` or even `expect` because the panic handler can be a bit spotty on uncommon hardware. I throw an `anyhow` error (a common crate) to a top level handler, log the error there and then crash. Saves extensive logging and I never get the seemingly random crashes I got with C hardware. I almost never use the debugger anymore. The only system crash I get are when I accidentally flood the stack space.
> I guess learning to call C from Rust is gonna be part of it too right
Depends on the platform, but for ESP32, all native C SDK functions have thin Rust wrappers.
However we need to work with a lot of the hardware apis like twai, ble, lte, ota, etc. It seems like support is spotty or it’s DIY.
It’s also worth keeping mind the remark about developer availability. I can generally answer questions about the C to someone who’s not experienced in C, while Rust might be another story.