diff --git a/Cargo.toml b/Cargo.toml index 4dd8ca1..fe68fa8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,11 +9,11 @@ version = "0.1.0" members = ["testsuite"] [dependencies] -cortex-m = "0.6.4" +cortex-m = "0.7.1" cortex-m-rt = "0.6.13" -defmt = "0.1.2" -defmt-rtt = "0.1.0" -panic-probe = { version = "0.1.0", features = ["print-defmt"] } +defmt = "0.2.0" +defmt-rtt = "0.2.0" +panic-probe = { version = "0.2.0", features = ["print-defmt"] } # TODO(4) enter your HAL here # some-hal = "1.2.3" diff --git a/README.md b/README.md index 3b0c16d..1942983 100644 --- a/README.md +++ b/README.md @@ -17,12 +17,13 @@ $ cargo install flip-link #### 2. `probe-run`: ``` console +$ # make sure to install v0.2.0 or later $ cargo install probe-run ``` #### 3. [`cargo-generate`]: -``` +``` console $ cargo install cargo-generate ``` @@ -152,11 +153,11 @@ $ cargo install --git https://github.com/knurling-rs/probe-run --branch main ``` console $ probe-run --version -probe-run 0.1.4 (3521a42 2020-11-12) -supported defmt version: 3db6b41f08a5c866e6d6ed7103d01b0b0fe5a1f4 +0.2.0 (aa585f2 2021-02-22) +supported defmt version: 60c6447f8ecbc4ff023378ba6905bcd0de1e679f ``` -In the example output, the supported version is `3db6b41f08a5c866e6d6ed7103d01b0b0fe5a1f4` +In the example output, the supported version is `60c6447f8ecbc4ff023378ba6905bcd0de1e679f` 3. Switch defmt dependencies to git: uncomment the last part of the root `Cargo.toml` and enter the hash reported by `probe-run --version`: @@ -167,10 +168,10 @@ In the example output, the supported version is `3db6b41f08a5c866e6d6ed7103d01b0 -# defmt-test = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" } -# panic-probe = { git = "https://github.com/knurling-rs/defmt", rev = "use defmt version reported by `probe-run --version`" } +[patch.crates-io] -+defmt = { git = "https://github.com/knurling-rs/defmt", rev = "3db6b41f08a5c866e6d6ed7103d01b0b0fe5a1f4" } -+defmt-rtt = { git = "https://github.com/knurling-rs/defmt", rev = "3db6b41f08a5c866e6d6ed7103d01b0b0fe5a1f4" } -+defmt-test = { git = "https://github.com/knurling-rs/defmt", rev = "3db6b41f08a5c866e6d6ed7103d01b0b0fe5a1f4" } -+panic-probe = { git = "https://github.com/knurling-rs/defmt", rev = "3db6b41f08a5c866e6d6ed7103d01b0b0fe5a1f4" } ++defmt = { git = "https://github.com/knurling-rs/defmt", rev = "60c6447f8ecbc4ff023378ba6905bcd0de1e679f" } ++defmt-rtt = { git = "https://github.com/knurling-rs/defmt", rev = "60c6447f8ecbc4ff023378ba6905bcd0de1e679f" } ++defmt-test = { git = "https://github.com/knurling-rs/defmt", rev = "60c6447f8ecbc4ff023378ba6905bcd0de1e679f" } ++panic-probe = { git = "https://github.com/knurling-rs/defmt", rev = "60c6447f8ecbc4ff023378ba6905bcd0de1e679f" } ``` You are now using the git version of `defmt`! diff --git a/src/bin/bitfield.rs b/src/bin/bitfield.rs index f82c2a2..d9889b1 100644 --- a/src/bin/bitfield.rs +++ b/src/bin/bitfield.rs @@ -7,7 +7,7 @@ use {{crate_name}} as _; // global logger + panicking-behavior + memory layout fn main() -> ! { // value of the FREQUENCY register (nRF52840 device; RADIO peripheral) let frequency: u32 = 276; - defmt::debug!("FREQUENCY: {0:0..7}, MAP: {0:8..9}", frequency); + defmt::debug!("FREQUENCY: {0=0..7}, MAP: {0=8..9}", frequency); {{crate_name}}::exit() } diff --git a/src/bin/format.rs b/src/bin/format.rs index aa8c35f..30476f6 100644 --- a/src/bin/format.rs +++ b/src/bin/format.rs @@ -20,7 +20,7 @@ fn main() -> ! { let s = S1 { x: 42, y: S2 { z: 43 } }; defmt::info!("s={:?}", s); let x = 42; - defmt::info!("x={:u8}", x); + defmt::info!("x={=u8}", x); {{crate_name}}::exit() } diff --git a/src/bin/overflow.rs b/src/bin/overflow.rs index 03c2a47..4e85b95 100644 --- a/src/bin/overflow.rs +++ b/src/bin/overflow.rs @@ -10,7 +10,7 @@ fn main() -> ! { } fn ack(m: u32, n: u32) -> u32 { - defmt::info!("ack(m={:u32}, n={:u32})", m, n); + defmt::info!("ack(m={=u32}, n={=u32})", m, n); let mut big = [2; 512]; if m == 0 { n + 1 diff --git a/src/lib.rs b/src/lib.rs index 2905d1c..8b34265 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -15,14 +15,13 @@ fn panic() -> ! { cortex_m::asm::udf() } -#[defmt::timestamp] -fn timestamp() -> u64 { - static COUNT: AtomicUsize = AtomicUsize::new(0); +static COUNT: AtomicUsize = AtomicUsize::new(0); +defmt::timestamp!("{=usize}", { // NOTE(no-CAS) `timestamps` runs with interrupts disabled let n = COUNT.load(Ordering::Relaxed); COUNT.store(n + 1, Ordering::Relaxed); - n as u64 -} + n +}); /// Terminates the application and makes `probe-run` exit with exit-code = 0 pub fn exit() -> ! { diff --git a/testsuite/Cargo.toml b/testsuite/Cargo.toml index 5a7766d..5078a98 100644 --- a/testsuite/Cargo.toml +++ b/testsuite/Cargo.toml @@ -12,12 +12,12 @@ harness = false [dependencies] {{project-name}} = { path = ".." } -cortex-m = "0.6.3" +cortex-m = "0.7.1" cortex-m-rt = "0.6.12" -defmt = "0.1.0" -defmt-rtt = "0.1.0" -defmt-test = "0.1.1" -panic-probe = { version = "0.1.0", features = ["print-defmt" ] } +defmt = "0.2.0" +defmt-rtt = "0.2.0" +defmt-test = "0.2.0" +panic-probe = { version = "0.2.0", features = ["print-defmt"] } [features] # set logging levels here