This is the 25th 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 🎉
New impl Format
s from the community
In the last two weeks a couple of PRs landed, which implement the trait defmt::Format
for various new types. There is #473 adding support for the clone-on-write smart pointer alloc::borrow::Cow
, #464 for the raw pointer primitives *const T
and *mut T
and #472 implementing it for many types from core::{iter, ops, slice}
.
The great thing about this is, that most of these contributions come from some community members, who wanted to use these types together with defmt
and just went forward and created a PR for this! 🎉
The process of how to do this yourself is detailed in the defmt-book.
backtrace improvements by japaric
Our wonderful team member japaric spend some time on enhancing the backtrace experience of probe-run
. Firstly backtraces now additionally to the file and line also show the column information of your exception. This enables you to click on them in many terminals in order to open them in your editor. Also frames that point to your local code are getting highlighted, because these likely are the ones you are going to find your errors at 😉
You can find both of these beautiful new changes in the screenshot below.
Secondly probe-run
now always prints a backtrace when being halted with Ctrl+C
.
Our final cool new feature, you probably already spotted in the screenshot above, is the new --shorten-paths
command-line option. It will compress paths to rustc
, rust-std
and crates-io
dependencies. So following paths:
# crates-io
/home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/cortex-m-rt-0.6.13/src/lib.rs:547:26
# rustc
/rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/core/src/panicking.rs:92:14
are getting shortened to:
# crates-io
[cortex-m-rt-0.6.13]/src/lib.rs:547:26
# rustc
[rust]/library/core/src/panicking.rs:92:14
This helps with figuring out where you exception is coming from 🕵️
zero padding by derekdreery
Our final highlight of this issue is zero padding, which got contributed by the community member derekdreery!
You are now able to add a display hint to your logging statements, to pad your numbers with leading zeroes:
defmt::info!("{=u16:08X}", 42);
defmt::info!("{=u16:08}", 42);
which will look like:
(HOST) INFO flashing program (6.63 KiB)
(HOST) INFO success!
────────────────────────────────────────────────────────────────────────────────
0 INFO 0x00002A
└─ hello::__cortex_m_rt_main @ src/bin/hello.rs:8
1 INFO 00000042
└─ hello::__cortex_m_rt_main @ src/bin/hello.rs:9
────────────────────────────────────────────────────────────────────────────────
(HOST) INFO device halted without error
Improvements 🦀
defmt
- #481 Snapshot tests for
core::{iter, ops, slice}
- #478 Add
defmt::dbg!
macro - #477 Disable logging calls via conditional compilation when all defmt features are disabled. Thanks to WasabiFan!
- #473
Impl Format for
allCow
s 🐮. Thanks to mattico! - #472
Impl Format for
thecore::{iter, ops, slice}
structs - #465 Add zero padding display hint. Thanks to derekdreery!
- #464
impl<T> Format for {*const, *mut} T where T: Format + ?Sized
probe-run
- #210 + #209 + #203 Add and improve
--shorten-paths
cli-option - #207 Read as little stacked registers as possible during unwinding
- #204 Make 'stopped due to signal' force a backtrace
- #200 Highlight frames that point to local code in backtrace
- #199 Add column info to backtrace
- #194 + #192 Add ubuntu and fedora installation instructions
- #193 Check
PROBE_RUN_IGNORE_VERSION
on runtime
flip-link
- #38 Handle numbers without units in linker script parser
knurling-session-20q4
- #16 Link more prominently to GitHub repo
- #15 Upgrade example code to
defmt 0.2
- #13 Updates in first block. Thanks to nkanderson!
Fixes 🔨
probe-run
- #211
mv backtrace.rs backtrace/mod.rs
- #206 Fix unwinding exceptions that push FPU registers onto the stack
defmt
app-template
- #50 Fix formatting in
README
Internal Improvements 🧽
defmt
- #475 + #474 + #471 + #470 + #469 Refactor
xtask
- #448 Don't run CI on .md changes in PRs, except it's the book
probe-run
- #197 Refactor "print backtrace" code
flip-link
- #36 Bump
object
to0.24.0
Version Update Notification 🆙
Last friday defmt-test 0.2.3
, defmt-test-macros 0.2.1
, defmt 0.2.2
, defmt-macros 0.2.1
, defmt-parser 0.2.1
, defmt-decoder 0.2.1
, defmt-print 0.2.1
and probe-run 0.2.3
did release.
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!