Article

Knurling-rs changelog #26

Published on 3 min read
Knurling icon
Knurling
A tool set to develop embedded applications faster.
❤️ Sponsor

    This is the 26th 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 diagram

    The defmt-README got a diagram showing the relationship among the various knurling crates. We use this internally during releases to make sure we correctly update all the packages and the ones depending on it.

    We hope it also helps you in case you want to dig into our tools and understand how they work with each other!

    What other parts of the defmt framework would you like to have visualized?

    defmt break and fix

    During defmt#477 we accidentally introduced a potential breakage of some code. It broke in particular if a user denies unused variables, but disabled defmt-logging and has some variables which are only given to a defmt logging macro.

    To make this more clear see following example:

    #![deny(unused)]
    let x = 1;
    defmt::info!("x={}", x);
    

    This errors with error: unused variable: 'x', if no "defmt-xxx" features are enabled. The reason that this doesn't work is, that after defmt#477 this code expands to following, which clearly doesn't use x:

    #![deny(unused)]
    let x = 1;
    {}
    

    The fix to this is to just match the logged variables, even if logging is disabled. This got implemented in defmt#497 and now our code snipped expands to:

    #![deny(unused)]
    let x = 1;
    {
        #[cfg(...)] // omitted
        match (&(x)) {
            _ => {}
        }
    };
    

    These were the highlights of this issue. Have a great week!

    Improvements 🦀

    defmt

    • #499 Illustrate structure of the defmt crates
    • #497 macros: Match unused vars if logging is disabled

    probe-run

    • #219 Add more explicit hint if elf path doesn't lead to an existing file

    app-template

    • #51 Disable test harness for lib target. Props to Sh3Rm4n!

    Fixes 🔨

    defmt

    • #500 book: Fix leftover old formatting syntax; typos

    probe-run

    • #216 Fix EXC_RETURN detection on thumbv8

    Internal Improvements 🧽

    defmt

    • #496 Bump build-dep semver to 1.0
    • #489 Structure lib
    • #488 Structure impl Formats into multiple files
    • #476 xtask: Improve error messages for failing snapshot tests

    probe-run

    • #212 Make unwind::target() infallible
    • #222 Refactor the huge "main" function into smaller functions + modules

    Version Update Notification 🆙

    • defmt-macros v0.2.2

    Sponsor this work

    Knurling-rs 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!