I think both languages have their applications and I am really happy with both.
I hope both languages (and others!) will help us make quality and robust softwares in the long run.
I think both languages have their applications and I am really happy with both.
I hope both languages (and others!) will help us make quality and robust softwares in the long run.
I wrote a firmware in rust and I rewrote it in zig as my first real world exercice, I ended up with 90% less code. Rust has really great abstraction and I like it, but for some things it is overkill. In zig I didn't need much of the abstraction because I did not have to make the borrow checker happy. In rust you have to structure your code in a way each part of it will have access to what it needs. In zig you just access it, as a global if needed. And sometimes the ability that zig code have to fit in memory (mine) is a real productivity boost.
I don't know anything about Zig and should probably look into it, but I think Ada is underrated for MCU's.
Also, Rust is more than a borrow checker. My day job is working on an embedded system that has zero dynamic allocation, and Rust’s other features are still very valuable to us, independent of the borrow checker (which also does bring value, to be clear.)
For one firmware, I have some code that keep the MCU sleeping and it wakes with I2C address match. When the I2C code handles the match, it must change the configuration of the system registers related to sleep to stay awake when waiting for interrupt, this means my I2C controller must be the owner of that register so it can change it. But after I2C handled the request the I2C controller must pass the register to the other controller that will go back to sleep when done. In rust I do that by having an Option<TheRegister> in both controller, and when I2C is done, main controller do the_option.take() to grab the register, do its job, then put it back. The usual way to do that in rust is to use Arc<Mutex<T>> but that doesn't work in my MCU, so I use the Option trick.
The other hard thing is DMA, it requires a lot of fidling, while in zig it jus works.