diff --git a/advanced/firmware/Cargo.toml b/advanced/firmware/Cargo.toml index 2938341..6e72cfd 100644 --- a/advanced/firmware/Cargo.toml +++ b/advanced/firmware/Cargo.toml @@ -12,18 +12,18 @@ usb2 = "0.0.1" [dependencies] consts = { path = "../common/consts" } -cortex-m = "0.7.3" -cortex-m-rt = "0.7.1" -cortex-m-rtic = "1.0.0" -defmt = "0.3.0" -defmt-rtt = "0.3.1" +cortex-m = "0.7.6" +cortex-m-rt = "0.7.2" +cortex-m-rtic = "1.1.3" +defmt = "0.3.2" +defmt-rtt = "0.3.2" dk = { path = "../../boards/dk", features = ["advanced"] } panic-probe = { version = "0.3.0", features = ["print-defmt"] } usb = { path = "../common/usb" } usb2 = "0.0.1" [dependencies.heapless] -version = "0.7.9" +version = "0.7.16" features = ["defmt-impl"] # optimize code in both profiles diff --git a/beginner/apps/Cargo.toml b/beginner/apps/Cargo.toml index 633f9b2..61ee794 100644 --- a/beginner/apps/Cargo.toml +++ b/beginner/apps/Cargo.toml @@ -6,13 +6,13 @@ name = "apps" version = "0.0.0" [dependencies] -cortex-m = "0.7.3" -cortex-m-rt = "0.7.1" +cortex-m = {version = "0.7.6", features = ["critical-section-single-core"]} +cortex-m-rt = "0.7.2" dk = { path = "../../boards/dk", features = ["beginner"] } -heapless = "0.7.9" +heapless = "0.7.16" panic-probe = { version = "0.3.0", features = ["print-defmt"] } -defmt = "0.3.0" -defmt-rtt = "0.3.1" +defmt = "0.3.2" +defmt-rtt = "0.3.2" # optimize code in both profiles [profile.dev] @@ -34,12 +34,11 @@ opt-level = 3 overflow-checks = false [features] -# set defmt logging levels here -default = [ - "defmt-default", - # "dependency-a/defmt-trace", -] +default = [ + "other-feature" +] +other-feature = [] # do NOT modify these features defmt-default = [] defmt-trace = [] diff --git a/beginner/apps/src/bin/radio-puzzle-3.rs b/beginner/apps/src/bin/radio-puzzle-3.rs index 10529f4..a5041ae 100644 --- a/beginner/apps/src/bin/radio-puzzle-3.rs +++ b/beginner/apps/src/bin/radio-puzzle-3.rs @@ -20,7 +20,7 @@ fn main() -> ! { radio.set_channel(Channel::_25); // capacity (128) should be large enough for the ASCII range - let mut dict = LinearMap::::new(); + let dict = LinearMap::::new(); let mut packet = Packet::new(); // TODO do the whole ASCII range [0, 127] diff --git a/boards/dk/Cargo.toml b/boards/dk/Cargo.toml index a4213f6..aebbd62 100644 --- a/boards/dk/Cargo.toml +++ b/boards/dk/Cargo.toml @@ -6,23 +6,22 @@ name = "dk" version = "0.0.0" [dependencies] -cortex-m = "0.7.3" -cortex-m-rt = "0.7.1" -embedded-hal = "0.2.6" +cortex-m = {version = "0.7.6", features = ["critical-section-single-core"]} +cortex-m-rt = "0.7.2" +embedded-hal = "0.2.7" hal = { package = "nrf52840-hal", version = "0.14.0" } panic-probe = { version = "0.3.0", features = ["print-defmt"] } -defmt = "0.3.0" -defmt-rtt = "0.3.1" +defmt = "0.3.2" +defmt-rtt = "0.3.2" [features] advanced = [] beginner = [] -# set defmt logging levels here default = [ - "defmt-info", - # "dependency-a/defmt-trace", + "other-feature" ] +other-feature = [] # do NOT modify these features defmt-default = [] diff --git a/common/panic-log/Cargo.toml b/common/panic-log/Cargo.toml index 5b61b67..b182e53 100644 --- a/common/panic-log/Cargo.toml +++ b/common/panic-log/Cargo.toml @@ -6,16 +6,16 @@ name = "panic-log" version = "0.0.0" [dependencies] -cortex-m = "0.6.4" -defmt = "0.2.1" +cortex-m = "0.7.6" +defmt = "0.3.2" [features] -# set defmt logging levels here + default = [ - "defmt-debug", - # "dependency-a/defmt-trace", + "other-feature" ] +other-feature = [] # do NOT modify these features defmt-default = [] diff --git a/embedded-workshop-book/src/panicking.md b/embedded-workshop-book/src/panicking.md index 72cba13..2d0665e 100644 --- a/embedded-workshop-book/src/panicking.md +++ b/embedded-workshop-book/src/panicking.md @@ -37,12 +37,13 @@ stack backtrace: In `no_std` programs the behavior of panic is defined using the `#[panic_handler]` attribute. In the example, the *panic handler* is defined in the `panic_log` crate but we can also implement it manually: -✅ Comment out the `panic_probe` import and add the following function to the example: +✅ Comment out the `use apps as _;` import and add the following function to the example: ``` rust #[panic_handler] fn panic(info: &core::panic::PanicInfo) -> ! { - defmt::panic!("{}", info); + defmt::error!("{}", defmt::Debug2Format(info)); + asm::udf(); } ``` diff --git a/embedded-workshop-book/src/using-hal.md b/embedded-workshop-book/src/using-hal.md index 1537497..67e5f1c 100644 --- a/embedded-workshop-book/src/using-hal.md +++ b/embedded-workshop-book/src/using-hal.md @@ -28,15 +28,10 @@ $ cargo doc -p dk --open ✅ Check the API docs of the `Led` abstraction. Change the `led` program, so that the bottom two LEDs are turned on, and the top two are turned off. -🔎 If you want to see logs from Led API of the `dk` Hardware Abstraction Layer, go to `boards/dk/Cargo.toml` and change the log level of the `dk` crate: +🔎 If you want to see logs from Led API of the `dk` Hardware Abstraction Layer, flash the dk with the following environment variable: -```diff -# set defmt logging levels here -default = [ -- "defmt-debug", -+ "defmt-trace", - # "dependency-a/defmt-trace", -] +```console +$ DEFMT_LOG=trace cargo run --bin led ``` Among the logs you'll find the line "I/O pins have been configured for digital output". At this point the electrical pins of the nRF52840 microcontroller have been configured to drive the 4 LEDs on the board.