From 101cdf4d72457e42fa3a7223b97e28af3b660aa8 Mon Sep 17 00:00:00 2001 From: Andrey Zgarbul Date: Mon, 14 Oct 2024 10:05:38 +0300 Subject: [PATCH 1/2] update deps, fix flashing --- .cargo/config.toml | 6 +++++- Cargo.toml | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 34ba36c6..691e60c3 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,8 +1,12 @@ [target.thumbv7m-none-eabi] -runner = 'arm-none-eabi-gdb' +runner = 'probe-rs run --chip STM32F103C8Tx' rustflags = [ "-C", "link-arg=-Tlink.x", + #"-C", "link-arg=-Tdefmt.x", ] [build] target = "thumbv7m-none-eabi" + +[env] +DEFMT_LOG = "info" diff --git a/Cargo.toml b/Cargo.toml index b2332c08..74f9ae7b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,8 +18,9 @@ features = ["stm32f103", "rtic", "high"] default-target = "x86_64-unknown-linux-gnu" [dependencies] -cortex-m = "0.7.6" -cortex-m-rt = "0.7.1" +defmt = { version = "0.3.8", optional = true } +cortex-m = { version = "0.7.7", features = ["critical-section-single-core"] } +cortex-m-rt = "0.7.3" nb = "1.1" embedded-dma = "0.2.0" bxcan = "0.8.0" @@ -73,7 +74,7 @@ stm32f103 = ["stm32f1/stm32f103", "has-can", "stm32-usbd"] stm32f105 = ["stm32f1/stm32f107", "connectivity"] stm32f107 = ["stm32f1/stm32f107", "connectivity"] -defmt = ["stm32f1/defmt"] +defmt = ["dep:defmt", "stm32f1/defmt"] # Devices with 64 or 128 Kb ROM medium = [] From 1df37039dafbb781ebfb189fe929cc7b83b1b2bf Mon Sep 17 00:00:00 2001 From: Andrey Zgarbul Date: Mon, 14 Oct 2024 10:51:58 +0300 Subject: [PATCH 2/2] fix gpio mode change --- src/gpio.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gpio.rs b/src/gpio.rs index bd1b62af..613e359a 100644 --- a/src/gpio.rs +++ b/src/gpio.rs @@ -845,7 +845,7 @@ where } 8..=15 => { gpio.crh() - .modify(|_, w| unsafe { w.mode(N - 16).bits(speed as u8) }); + .modify(|_, w| unsafe { w.mode(N - 8).bits(speed as u8) }); } _ => unreachable!(), } @@ -979,8 +979,8 @@ where } 8..=15 => { gpio.crh().modify(|_, w| unsafe { - w.mode(N - 16).bits(MODE::MODE as u8); - w.cnf(N - 16).bits(MODE::CNF as u8) + w.mode(N - 8).bits(MODE::MODE as u8); + w.cnf(N - 8).bits(MODE::CNF as u8) }); } _ => unreachable!(),