Blog coding article

Knurling-rs changelog #30

Johann
Article

Knurling-rs changelog #30

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

    This is the 30th 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 🎉

    user survey results

    Longed for. Whispered about. Finally ! The results of the Knurling-rs User Survey are here. 🎉🎉🎉

    The data we gathered is the first step to deepen our understanding of our users (that's you!). What's your context? What are your needs and wishes? What can we do to come closer to our goal of improving the embedded Rust experience?

    🥇 The most used tool is probe-run with 72%, slightly ahead of defmt with 65%. flip-link is used by 27% of the respondents.

    bar chart: usage of knurling tools

    Fig.1 Usage of tools self-reported by respondents

    Terms many people mention when getting asked for what they enjoy about knurling are "ease of use", "modern" and not very surprisingly "rust". Paving the way for people into embedded rust by providing easy to use and modern tooling is definitely a goal of us and we are happy that you think that we are getting there!

    While most people use the knurling tools for hobby projects, there is still a large share of 38% who are also using them at work. It is great to see defmt, probe-run and flip-link getting used in production!

    Some people reported that they are not using rust at work, but would like to do so. Some weeks ago, we have written a guide on how to find a good first project to take Rust for a test drive, so you can try before you buy. Read it here!

    The next steps for us are to talk to some of you in more detail and start implementing the learnings and suggestions we already got! 😁

    deterministic bitflag values

    A couple of days ago our testsuite started reporting failures on the nightly rust channel. In particular it was about the snapshot tests of the bitflags! macro. The order of the values of ::ALL attribute changed.

    🧪 qemu/snapshot
    bitflags (dev)
    -INFO LargeFlags::ALL: ALL | MSB | NON_LITERAL
    +INFO LargeFlags::ALL: MSB | ALL | NON_LITERAL
    bitflags (release)
    -INFO LargeFlags::ALL: ALL | MSB | NON_LITERAL
    +INFO LargeFlags::ALL: MSB | ALL | NON_LITERAL
    

    This was because each bitflags value is stored in its own symbol. Their order in the final executable is up to rustc/LLVM, or even the linker, which causes unreliable output that depends on toolchain details.

    defmt#564 fixes that by storing an index in the symbol for bitflags values, which indicates their order in the source code. The decoder sorts by this index to put the values back in definition order. We now exactly match the output of the bitflags crate.

    You might remember our effort to improve the build time of flip-link: https://ferrous-systems.com/blog/knurling-changelog-28/#non-default-flip-link. This continues now!

    Our goal is to make the experience of using flip-link as easy as possible, and also enable the usage in CI-systems, where building for a long time is especially annoying.

    While last time we gained a lot by disabling the default features of some of our dependencies, this time we've continued this effort by replacing the two dependencies anyhow (flip-link#55) and tempfile (flip-link#51) with custom code. This makes sense because we only need a subset of these dependencies functionality and by doing so avoid pulling in their sub-dependencies.

    Running our build-time benchmark (hyperfine -p "cargo clean" -m 5 "cargo build" "cargo build --release") before and after the two PRs we gained 17.6% on the dev and 17.3% on the release channel. Remember that these measurements are highly dependent on your hardware, but should still give a good estimation.

    measurements

    commit dev release
    6ff4b79 (before) 4.18s 5.07s
    514ffeb (after) 3.44s 4.19s

    Fig. 2 Build time of dev and release profile, before and after the patches

    Improvements 🦀

    defmt

    • #564 Make order of bitflags! values deterministic
    • #557 Add impl Format for TryFromSliceError. Thank you newAM!
    • #556 Add impl Format for TryFromIntError. Thank you newAM!

    Internal Improvements 🧽

    defmt

    • #561 Remove unused cortex-m-rt dependency in panic-probe. Thanks to Dirbaio!
    • #560 Update cortex-m-rt from 0.6 to 0.7. Thank you newAM!
    • #55 Drop anyhow
    • #54 update & upgrade dependencies
    • #53 xtest: Clear test-flip-link-apps target/-dir before each run
    • #52 xtest: Pass --force to cargo install
    • #51 Avoid the tempfile dependency

    Fixes 🔨

    probe-run

    • #246 Fix and enable deactivated tests for Windows

    Version Update Notification 🆙

    • flip-link v0.1.5

    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!