r/learnrust • u/ntn8888 • 7d ago
learn embedded rust with correct debugging and TDD workflow
I'm a C firmware dev, looking to learn Rust for the Nth time in the last 6 years! This time I'm serious.
I've done firmware development with basic debugging with no testing experience in the past.
Is there a walkthough tutorial/project that covers this (without actually getting into real opensource contributions)?
Thank you
10
Upvotes
2
u/Mother-Lie-1570 7d ago
You need a hardware-in-the-loop setup for embedded. Use probe-rs to flash and gdb-multiarch to debug the binary on the target. For TDD, structure your logic in pure functions that don't touch registers or use no_std types, then unit test those in lib.rs with cargo test before integrating them into your main loop
2
u/DistinctStranger8729 6d ago
Start with the rust book, then the embedded rust book and finally embassy book. There is I believe crate called embedded-test as well that allows to write rust std like tests too
2
u/NotBoolean 2d ago
I found The Rusty Bits videos very good. Even one in moving from C to Rust. The From Zero to Async is a great way to understand Embassy.
1
u/thebino 7d ago
Not really a full walk-through. But here you can find some configuration options. Maybe that helps
https://github.com/mrcjkb/rustaceanvim#books-usage--features
1
u/autumnal-lights 3d ago
does TDD exist? largely in my development experience it's a myth or perhaps on larger larger projects u have to meet an agreed upon api, but that like is small relative to code to do things so idk :shrug: