From 46110c0d320ffa55f6d65514ebd8791d957ac999 Mon Sep 17 00:00:00 2001 From: Jan Niehusmann Date: Mon, 25 Jul 2022 19:32:49 +0000 Subject: [PATCH 1/3] Update examples to defmt 0.3 Current version of probe-run is 0.3.3, which uses defmt 0.3.2. With a firmware using defmt 0.2, this causes the following error message: ``` Error: defmt wire format version mismatch: firmware is using 0.2, `probe-run` supports 3 suggestion: `cargo install` a different version of `probe-run` that supports defmt 0.2 ``` Therefore, upgrade defmt dependency, and also fix the linker script in .cargo/config. --- .cargo/config | 1 + boards/arduino_nano_connect/Cargo.toml | 2 +- boards/pimoroni-badger2040/Cargo.toml | 4 ++-- boards/pimoroni-plasma-2040/Cargo.toml | 4 ++-- boards/pimoroni-tiny2040/Cargo.toml | 4 ++-- boards/rp-pico/Cargo.toml | 4 ++-- boards/vcc-gnd-yd-rp2040/Cargo.toml | 4 ++-- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.cargo/config b/.cargo/config index ed10a10..4f2cc68 100644 --- a/.cargo/config +++ b/.cargo/config @@ -31,6 +31,7 @@ rustflags = [ "-C", "link-arg=-Tlink.x", "-C", "inline-threshold=5", "-C", "no-vectorize-loops", + "-C", "link-arg=-Tdefmt.x", ] # This runner will make a UF2 file and then copy it to a mounted RP2040 in USB diff --git a/boards/arduino_nano_connect/Cargo.toml b/boards/arduino_nano_connect/Cargo.toml index 8c8452d..8ecbbc9 100644 --- a/boards/arduino_nano_connect/Cargo.toml +++ b/boards/arduino_nano_connect/Cargo.toml @@ -16,7 +16,7 @@ rp2040-boot2 = { version = "0.2.0", optional = true } rp2040-hal = { path = "../../rp2040-hal", version = "0.5.0" } cortex-m-rt = { version = "0.7.0", optional = true } embedded-hal = { version = "0.2.4", features = ["unproven"] } -panic-probe = { version = "0.2.0", features = ["print-defmt"] } +panic-probe = { version = "0.3.0", features = ["print-defmt"] } embedded-time = "0.12.0" [dev-dependencies] diff --git a/boards/pimoroni-badger2040/Cargo.toml b/boards/pimoroni-badger2040/Cargo.toml index 3cbc237..2cba52b 100644 --- a/boards/pimoroni-badger2040/Cargo.toml +++ b/boards/pimoroni-badger2040/Cargo.toml @@ -23,8 +23,8 @@ panic-halt= "0.2.0" nb = "1.0" embedded-graphics = "0.7.1" -defmt = "0.2.0" -defmt-rtt = "0.2.0" +defmt = "0.3.0" +defmt-rtt = "0.3.0" [features] default = ["boot2", "rt"] diff --git a/boards/pimoroni-plasma-2040/Cargo.toml b/boards/pimoroni-plasma-2040/Cargo.toml index f40bf31..33278b5 100644 --- a/boards/pimoroni-plasma-2040/Cargo.toml +++ b/boards/pimoroni-plasma-2040/Cargo.toml @@ -23,8 +23,8 @@ embedded-hal ="0.2.5" smart-leds = "0.3.0" ws2812-pio = "0.3.0" -defmt = "0.2.0" -defmt-rtt = "0.2.0" +defmt = "0.3.0" +defmt-rtt = "0.3.0" [features] default = ["boot2", "rt"] diff --git a/boards/pimoroni-tiny2040/Cargo.toml b/boards/pimoroni-tiny2040/Cargo.toml index d8d4407..c743ea4 100644 --- a/boards/pimoroni-tiny2040/Cargo.toml +++ b/boards/pimoroni-tiny2040/Cargo.toml @@ -21,8 +21,8 @@ embedded-time = "0.12.0" panic-halt= "0.2.0" embedded-hal ="0.2.5" -defmt = "0.2.0" -defmt-rtt = "0.2.0" +defmt = "0.3.0" +defmt-rtt = "0.3.0" [features] default = ["boot2", "rt"] diff --git a/boards/rp-pico/Cargo.toml b/boards/rp-pico/Cargo.toml index 2637108..038066a 100644 --- a/boards/rp-pico/Cargo.toml +++ b/boards/rp-pico/Cargo.toml @@ -37,8 +37,8 @@ hd44780-driver = "0.4.0" pio = "0.2.0" pio-proc = "0.2.1" -defmt = "0.2.0" -defmt-rtt = "0.2.0" +defmt = "0.3.0" +defmt-rtt = "0.3.0" [features] default = ["boot2", "rt"] diff --git a/boards/vcc-gnd-yd-rp2040/Cargo.toml b/boards/vcc-gnd-yd-rp2040/Cargo.toml index 2e794d2..def470e 100644 --- a/boards/vcc-gnd-yd-rp2040/Cargo.toml +++ b/boards/vcc-gnd-yd-rp2040/Cargo.toml @@ -37,8 +37,8 @@ hd44780-driver = "0.4.0" pio = "0.2.0" pio-proc = "0.2.1" -defmt = "0.2.0" -defmt-rtt = "0.2.0" +defmt = "0.3.0" +defmt-rtt = "0.3.0" [features] default = ["boot2", "rt"] From 365ac70ae43792f42ac1f15c82ec3d09bba60bc2 Mon Sep 17 00:00:00 2001 From: Jan Niehusmann Date: Sun, 31 Jul 2022 15:23:36 +0000 Subject: [PATCH 2/3] Fix building of examples which do not use defmt Uses build.rs in board directories to set the linker options locally. The file .cargo/config can't be used for that, as in a workspace the local .cargo/config is ignored if the build is triggered from the workspace root. --- .cargo/config | 1 - boards/pimoroni-plasma-2040/build.rs | 6 ++++++ boards/pimoroni-tiny2040/build.rs | 6 ++++++ boards/rp-pico/build.rs | 6 ++++++ 4 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 boards/pimoroni-plasma-2040/build.rs create mode 100644 boards/pimoroni-tiny2040/build.rs create mode 100644 boards/rp-pico/build.rs diff --git a/.cargo/config b/.cargo/config index 4f2cc68..ed10a10 100644 --- a/.cargo/config +++ b/.cargo/config @@ -31,7 +31,6 @@ rustflags = [ "-C", "link-arg=-Tlink.x", "-C", "inline-threshold=5", "-C", "no-vectorize-loops", - "-C", "link-arg=-Tdefmt.x", ] # This runner will make a UF2 file and then copy it to a mounted RP2040 in USB diff --git a/boards/pimoroni-plasma-2040/build.rs b/boards/pimoroni-plasma-2040/build.rs new file mode 100644 index 0000000..dd9a371 --- /dev/null +++ b/boards/pimoroni-plasma-2040/build.rs @@ -0,0 +1,6 @@ +//! This build script makes sure the linker flag -Tdefmt.x is added +//! for the examples. + +fn main() { + println!("cargo:rustc-link-arg-examples=-Tdefmt.x"); +} diff --git a/boards/pimoroni-tiny2040/build.rs b/boards/pimoroni-tiny2040/build.rs new file mode 100644 index 0000000..dd9a371 --- /dev/null +++ b/boards/pimoroni-tiny2040/build.rs @@ -0,0 +1,6 @@ +//! This build script makes sure the linker flag -Tdefmt.x is added +//! for the examples. + +fn main() { + println!("cargo:rustc-link-arg-examples=-Tdefmt.x"); +} diff --git a/boards/rp-pico/build.rs b/boards/rp-pico/build.rs new file mode 100644 index 0000000..dd9a371 --- /dev/null +++ b/boards/rp-pico/build.rs @@ -0,0 +1,6 @@ +//! This build script makes sure the linker flag -Tdefmt.x is added +//! for the examples. + +fn main() { + println!("cargo:rustc-link-arg-examples=-Tdefmt.x"); +} From dfaeba5315670917dc551cdec98232ad0c482cd9 Mon Sep 17 00:00:00 2001 From: Jan Niehusmann Date: Sun, 31 Jul 2022 15:30:05 +0000 Subject: [PATCH 3/3] Remove defmt dependencies from boards/vcc-gnd-yd-rp2040/Cargo.toml Nothing in that crate depends on defmt --- boards/vcc-gnd-yd-rp2040/Cargo.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/boards/vcc-gnd-yd-rp2040/Cargo.toml b/boards/vcc-gnd-yd-rp2040/Cargo.toml index def470e..3b56632 100644 --- a/boards/vcc-gnd-yd-rp2040/Cargo.toml +++ b/boards/vcc-gnd-yd-rp2040/Cargo.toml @@ -37,9 +37,6 @@ hd44780-driver = "0.4.0" pio = "0.2.0" pio-proc = "0.2.1" -defmt = "0.3.0" -defmt-rtt = "0.3.0" - [features] default = ["boot2", "rt"] boot2 = ["rp2040-boot2"]