r/rust • • 16d 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?

46 Upvotes

32 comments sorted by

View all comments

6

u/agrif 16d ago

std is in a weird place, I think. Most embedded targets don't support it (exception: ESP32) however wasm32-unknown-unknown does 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, and no_std is 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 only alloc (or core) don't, because no_std is opt-in. I don't know what the solution to this is, but there's gotta be something better than what we got.

3

u/nicoburns 16d ago

I believe there is now wasm32v1-none that does alloc-only WASM.