4 ms·
A subset of Rust. You can’t just write ordinary Rust for microcontrollers.
by kaba0 3y ago
A subset of Rust. You can’t just write ordinary Rust for microcontrollers.
- deleted 3y ago[deleted]
- estebank 3y agoIt depends on what you call "ordinary Rust", I guess. You can use an allocator on embedded, but likely won't want to. There are static types that provide the same APIs as the allocating data structures you'd miss[1]. Granted, you're not gonna be able to take any random crate that isn't designed for such an environment, but that's a different problem, and there's a fledging ecosystem of no_std crates out there. Despite all those caveats, you can still write very high level code in embedded Rust, even async/await state machines![2] 1: https://docs.rust-embedded.org/book/collections/index.html https://docs.rust-embedded.org/book/collections/index.html 2: https://interrupt.memfault.com/blog/embedded-async-rust https://interrupt.memfault.com/blog/embedded-async-rust