3 ms·
Yes it has and can be done with rust. But usually by writing “unsafe” code so what the hell is the point if the majority of the code isn’t gonna have the Rust m
by jdefr89 2y ago
Yes it has and can be done with rust. But usually by writing “unsafe” code so what the hell is the point if the majority of the code isn’t gonna have the Rust memory guarantees it would normally have? Furthermore, not all MCUs have a Rust compiler or tool chain to use. C is the defacto standard. Not saying it cannot be done, just that I am not sure it’s worth the extra effort and overhead.
- dralley 2y agoEntire kernels have been written in Rust with less than 10% unsafe code. The entire line of argument that "the majority of code" needs to be unsafe in such contexts is BS. Especially when the "Rust culture" suggests building safe abstractions on top of unsafe building blocks, which tends to keep the unsafe code pretty well-contained to a small section of the codebase. There's plenty of Rust frameworks for microcontroller programming (embassy, etc.) that don't involve much if any unsafe Rust at all.
- jdefr89 2y agoCan you link me to a viable/real world kernel rewritten in Rust? One that supports modern hardware? I am not talking about implementing a toy kernel here.
- Ar-Curunir 2y agohttps://www.redox-os.org/ https://www.redox-os.org/
- steveklabnik 2y agoThis is closer to an RTOS, but since we're also talking about embedded, we wrote https://hubris.oxide.computer/ https://hubris.oxide.computer/ for use in our products. Kernel is about 3% unsafe code last I checked, which was just a few months ago.