This is the eighth changelog for Knurling-rs, our push to sustainably build better tooling for developing and debugging Rust software for embedded systems. Knurling-rs includes a suite of tools that make it easier to develop, log, debug, and test your embedded Rust libraries and applications!
Knurling-rs is supported by our sponsors on GitHub. If you're interested in seeing more projects like this, consider becoming a sponsor today!
Highlights
defmt::panic!, defmt::assert! and probe-run colorization
With #266, defmt now has its own version of panic!-like and assert!-like macros which will log the panic message using defmt and then call core::panic! (by default).
As of #110, the the output of defmt::assert_eq is also diff'ed and colorized based on the assertion result when using probe-run.

defmt::unwrap!
defmt now has an unwrap! macro which can be called on Result and Option types. #273
It behaves the same as the standard unwrap() but prints the result with defmt. You can also use it to emulate the behavior of expect().
However, the invocation looks a bit different:
let result = Ok::<(), ()>(());
-let x = result.unwrap();
+let x = defmt::unwrap!(result);
let value = result;
-let x = value.expect("text");
+let x = defmt::unwrap!(value, "text");
let arg = 42;
-let x = value.expect(&format!("text {:?}", arg));
// arg must implement `Format`
+let x = defmt::unwrap!(value, "text {:?}", arg);
Thanks to @Dirbaio for implementing this as well as reporting and fixing #257, #269 and #272!
probe-run 0.1.7
probe-run 0.1.7 (which uses probe-rs 0.10) has been published (see #108, #107).
This fixes flashing issues #15 and #29.
New knurling-sessions content
In this week's knurling-sessions we're adding a piezo buzzer to get an acoustic warning if the CO2 levels in your room are critically high.
Sponsors can check them out in the Red Alert! chapter of knurling-books (check the sponsors dashboard thread for credentials and discussions)
Improvements
defmt
- #257 code size optimizations
- #267, #280, #281
defmtnow hasDebug2FormatandDisplay2Formatadapters so that you can print values that only implDebugorDisplaytoo. Note that this disablesdefmt's parameter compression and should only be used if usingdefmt::Formatis not possible. - The
defmtbook is "rolling release", i.e. it contains all changes merged into thedefmtrepository. This means that it's already documenting features not yet in a crates.io release. We've started adding notes about feature availability (e.g. "defmt 0.1.2 and up") in #279. - #263, #276 it's now possible to add a custom
FormatTrait implementation, e.g. for astructthat you'd like to be displayed in a way that's more helpful to you
probe-run
- #108 bumps the
probe-rsdependency to0.10.0 - #109 removes
<exception entry>double-print - #112 defmt decode errors are now reported to the user
- #114 pins the
hidapito 1.2.3 to re-enable building on macOS
Fixes
defmt
- #269 fixes compiler error that was thrown when using
defmt::panicwithin e.g. a match expression - #272 braces in format args passed to the new
defmt::panic!anddefmt::assert!macros do not cause unexpected errors anymore - #261 update example output in README
flip-link
- #17 attributes in linker scripts do not cause parse errors anymore (they are ignored)
Version Update Notification
We've bumped the versions of our crates.io releases as a result of the changes listed above. They have changed as follows:
flip-linkhas been updated to v0.1.2defmthas been updated to v0.1.2probe-runhas been updated to v0.1.7
Internal Improvements
- #278 the CI now has a backwards compatibility check against
defmt-decoderv0.1.0 to catch regressions - #274 the CI now runs all tests on macOS. Previously, the
defmt-decodertests were unintentionally omitted.
Sponsor this work
Knurling is mainly funded through GitHub sponsors. Sponsors get early access to the tools we are building and help us to support and grow the knurling tools and courses. Thank you to all of the people already sponsoring our work through the Knurling project!