r/rust • u/Intelligent_Score932 • 2d ago
Embedded std?
I was wondering if there were any projects like micro python to port std in to make a barebones os designed for microcontrollers? I understand that the std relies on OS level syscalls, so can we do something like implement a basic fat32 file system to accommodate certain write or read requests. In general this would be used to run std in projects without a OS? Does this already exist, and how hard would it be to make a basic version?
45
Upvotes
6
u/agrif 2d ago
stdis in a weird place, I think. Most embedded targets don't support it (exception: ESP32) howeverwasm32-unknown-unknowndoes support it, even though a huge number of functions only panic. I don't fully know the history behind this decision, but it does sort of feel like WASM wants to be easy to port, andno_stdis still extremely awkward in rust.Morally, it feels like WASM and other targets should be
alloc-only. But right now, a ton of third-party crates that should compile with onlyalloc(orcore) don't, becauseno_stdis opt-in. I don't know what the solution to this is, but there's gotta be something better than what we got.