profile
viewpoint
Jorge Aparicio japaric @ferrous-systems Berlin, Germany https://blog.japaric.io/ @ferrous-systems engineer. @rust-embedded WG core member. He/they

bheisler/criterion.rs 1496

Statistics-driven benchmarking library for Rust

japaric/cargo-call-stack 315

Whole program static stack analysis

japaric/cast.rs 55

Machine scalar casting that meets your expectations

iqlusioninc/usbarmory.rs 49

Bare metal Rust support for USB armory MkII devices

japaric/embedded-in-rust 48

A blog about Rust and embedded stuff

japaric/embedded2020 33

A fresh look at embedded Rust development

japaric/cty 20

Type aliases to C types like c_int for use with bindgen

japaric/enc28j60 17

A platform agnostic driver to interface with the ENC28J60 (Ethernet controller)

japaric/aligned 13

A newtype with alignment of at least `A` bytes

japaric/cortex-m-funnel 12

[Experiment] A lock-free, wait-free, block-free logger for the ARM Cortex-M architecture

issue openedknurling-rs/defmt

defmt-test: Allow use in test module

Hey, I'd like to propose a feature request:

Support use statements in the #[defmt_test::tests] macro. It is pretty common to import the output scope via use super::*;. But this is currently not possible:

 testsuite/tests/test.rs | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/testsuite/tests/test.rs b/testsuite/tests/test.rs
index d1002ce..7a8d75b 100644
--- a/testsuite/tests/test.rs
+++ b/testsuite/tests/test.rs
@@ -7,6 +7,8 @@ use {{crate_name}} as _; // memory layout + panic handler
 // feature)
 #[defmt_test::tests]
 mod tests {
+    use super::*;
+
     #[test]
     fn assert_true() {
         assert!(true)
$ cargo test
   ...
   Compiling use-test v0.1.0 (/tmp/use-test)
   Compiling testsuite v0.1.0 (/tmp/use-test/testsuite)
error: only function items are allowed
  --> testsuite/tests/test.rs:10:5
   |
10 |     use super::*;
   |     ^^^

error: aborting due to previous error

error: could not compile `testsuite`

As we can see, this case is currently just not taken into consideration:

https://github.com/knurling-rs/defmt/blob/2657a8db30a67c7f225611e2c14cb2759df876da/firmware/defmt-test/macros/src/lib.rs#L133-L138

The current workaround I use, it to declare the use statement in the function scope, e.g.

 #[defmt_test::tests]
 mod tests {
-    use super::*;
-
     #[test]
     fn assert_true() {
+        use super::*;
+         
         assert!(true)

If you point me into the right directions I could try to implement this feature myself. But I've no experience writing procedural macros, so any help is appreciated :)

created time in 5 hours

startedjaparic/rust-cross

started time in 5 hours

pull request commentknurling-rs/probe-run

Added option to specify probe clock frequency

@jacobrosenthal That works great, thanks for the heads up!

eboskma

comment created time in 7 hours

startedjaparic/heapless

started time in 11 hours

pull request commentknurling-rs/probe-run

Added option to specify probe clock frequency

Hey @eboskma Can you try cargo flash from git? I think it has the fix for your speed issue https://github.com/probe-rs/probe-rs/pull/450 cargo install --git https://github.com/probe-rs/cargo-flash.git and if so would soon make its way into probe-run as well

Please let me know, were trying to track down anyone using reduced speed and get fixes in

eboskma

comment created time in 17 hours

PR opened knurling-rs/defmt

Book: Link to defmt-rtt and defmt-semihosting crates

Makes it easier to get started if I can directly view the crate details :slightly_smiling_face:

+5 -2

0 comment

1 changed file

pr created time in 18 hours

startedjaparic/rust-cross

started time in 2 days

issue commentknurling-rs/defmt

Performance - raw cycle count of an info! call

FWIW I like the idea of a fixed buffer size that can be manually increased if necessary. To me, it seems reasonable to heavily optimize the primary use cases, as long as there is an escape hatch.

bradleyharden

comment created time in 2 days

issue commentknurling-rs/defmt

Separate "crate version" from "wire format version"

This was a pain for me when trying to use a branch from @jacobrosenthal to get ATSAMD51 support. I would appreciate it.

Dirbaio

comment created time in 2 days

startedjaparic/heapless

started time in 2 days

startedjaparic/heapless

started time in 2 days

issue openedknurling-rs/defmt

Separate "crate version" from "wire format version"

Currently the defmt crate version is embedded in the ELF, and is used by the decode to check compatibility of the wire format. The version is the crates.io version or the Git commit hash if building from a git clone.

Probe-run refuses to run when the version doesn't match exactly. You have to clone it, patch it to use the right defmt version, rebuild it. This is quite painful in these scenarios:

  • When developing defmt, trying to run a firmware using the WIP modified version.
  • When releasing a lib / project that depends on git defmt, for people trying to use it.

Many (most?) changes don't break wire format. Even API-breaking changes like #258 can not-break the wire format.

Why not separate the "wire format version" concept from the "crate version"?

  • defmt crate has a WIRE_FORMAT_VERSION const.
  • defmt-decoder crate has a WIRE_FORMAT_VERSION const.
  • defmt-decoder checks the WIRE_FORMAT_VERSION from the ELF matches its const, fails if not.
  • the comparison can be a simple string equality, no need for semver stuff I think.
  • When doing wire-format breaking changes, the wire format version gets bumped

Advantages:

  • No need for build.rs magic at all.
  • Easier hacking, easier use of git defmt versions that are still compatible with released wire format version
  • possibility of doing a major version defmt crate release that doesn't bump the wire format version. (ie with API-breaking changes but not with wire-format-breaking changes)

created time in 2 days

issue commentknurling-rs/probe-run

Could not compile probe-run v0.1.6 on macOS 10.15.7

Should be fixed in hidapi 1.2.5: https://github.com/ruabmbua/hidapi-rs/commit/76e0f904e5151179d0c927b9d06a5600702d388f

andresv

comment created time in 2 days

issue openedknurling-rs/defmt

Git DEFMT_VERSION doesn't get updated when doing a Git commit.

  • In a firmware project, add a [patch.crates-io] pointing to a local checkout of the defmt repo
  • Modify some defmt .rs files
  • Build the firmware, it gets DEFMT_VERSION = <commit 1>.
  • The firmware runs great with the modified defmt, you decide to do a defmt commit to prepare a juicy PR
  • do git commit in the defmt repo
  • Now defmt HEAD is <commit 2>
  • Build the firmware, it STILL gets DEFMT_VERSION = <commit 1> because build.rs doesn't re-run because you didn't edit any .rs files since last build.

created time in 2 days

push eventknurling-rs/defmt

BriocheBerlin

commit sha b60c402bdfc343ce43246ad19972ed495fe43716

Test {:?} format specifier.

view details

push time in 2 days

issue commentknurling-rs/defmt

docs.rs fails to build defmt

I suppose we should not build for thumbv6m-none-eabi then, since it lacks atomics and thus alloc::sync.

Dirbaio

comment created time in 2 days

issue openedknurling-rs/defmt

docs.rs fails to build defmt

Currently you can't view defmt docs on docs.rs: https://docs.rs/crate/defmt/0.1.2 Here's the build failure https://docs.rs/crate/defmt/0.1.2/builds/319575

created time in 2 days

startedjaparic/rust-cross

started time in 2 days

startedjaparic/rust-cross

started time in 2 days

push eventknurling-rs/defmt

Sebastian Ziebell

commit sha 4d287b6f521de9398eb468c5abe425361436d15a

Test formatting char using `{:?}`

view details

push time in 2 days

push eventferrous-systems/teaching-material

matklad

commit sha 9774d446479072c8c50d2b96c05add1d350096a0

Automated deployment: Fri Nov 27 12:29:50 UTC 2020 a5d98b56b99bb106a543f142bd6158d27f7a4a44

view details

push time in 2 days

push eventferrous-systems/teaching-material

Aleksey Kladov

commit sha a5d98b56b99bb106a543f142bd6158d27f7a4a44

Show how to implement crates manually

view details

push time in 2 days

Pull request review commentknurling-rs/defmt

Implement Format for char argument

 fn main() -> ! {         defmt::info!("{:?}", Display2Format::<consts::U32>(&addr));     } +    defmt::info!("Hello {:char}", '💜');

Yes, good idea. :+1:

justahero

comment created time in 2 days

startedjaparic/syscall.rs

started time in 2 days

push eventknurling-rs/defmt

Sebastian Ziebell

commit sha 6831b1fe649a786493b979e42881affd8ed24acf

Add Format implementation for char

view details

push time in 2 days

PR opened knurling-rs/defmt

Implement i128 and u128.

Closes #199

+113 -1

0 comment

8 changed files

pr created time in 2 days

push eventknurling-rs/defmt

BriocheBerlin

commit sha 707a5202dc3b095caf51a84911174ce01119a533

Add impls for i128 and u128.

view details

push time in 2 days

push eventknurling-rs/defmt

BriocheBerlin

commit sha 4a1038cbbcaa29cd983d4867ff76007e3ef457d6

Add snapshots for u128.

view details

push time in 2 days

issue openedknurling-rs/probe-run

Check the selected processor and target for compatability.

After spending an inordinate amount of time trying to work out why RTT wasn't working, I discovered that I had set the wrong target.

As probe-run knows both the source target (through the path) and the target IC, it should be possible to show a warning if the two aren't compatible with each other.

created time in 2 days

issue commentknurling-rs/probe-run

Using probe-run with bootloader

Were seeing this with the samd boards which have a uf2 bootloader fitted as well. Cargo embed works fine. When I wipe out the bootloader and adjust memory location probe run works again

MathiasKoch

comment created time in 2 days

more