defmt icon indicating copy to clipboard operation
defmt copied to clipboard

defmt-print: misleading error message on defmt version mismatch

Open japaric opened this issue 3 years ago • 4 comments

the error says to install probe-run instead of defmt-print

japaric avatar Feb 24 '21 17:02 japaric

$ defmt-print -e target/thumbv7em-none-eabihf/debug/hello
Error: defmt version mismatch: firmware is using 0.2, `probe-run` supports 0.1
suggestion: `cargo install` a different non-git version of `probe-run` that supports defmt 0.2

japaric avatar Feb 24 '21 17:02 japaric

I was hoping to get the name of the binary from a cargo env variable during compile time, but none of CARGO_PKG_NAME, CARGO_CRATE_NAME, CARGO_BIN_NAME, CARGO_PRIMARY_PACKAGE seems to yield the name of the binary, but only the name of the library or nothing.

Urhengulas avatar May 12 '21 16:05 Urhengulas

We can probably solve this by using a strongly-typed error type in defmt_decoder that has a variant that indicates a version mismatch. Then the calling binary can print its own message.

jonas-schievink avatar May 12 '21 17:05 jonas-schievink

We can probably solve this by using a strongly-typed error type in defmt_decoder that has a variant that indicates a version mismatch. Then the calling binary can print its own message.

Yes, I also though about this, but then I tried to be smart 😬 😆

Urhengulas avatar May 12 '21 17:05 Urhengulas