aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-boot/boot/src/lib.rs17
-rw-r--r--embassy-boot/stm32/Cargo.toml6
2 files changed, 10 insertions, 13 deletions
diff --git a/embassy-boot/boot/src/lib.rs b/embassy-boot/boot/src/lib.rs
index b18c88a6b..51e1056cf 100644
--- a/embassy-boot/boot/src/lib.rs
+++ b/embassy-boot/boot/src/lib.rs
@@ -587,22 +587,13 @@ impl FirmwareUpdater {
587 ) -> Result<(), F::Error> { 587 ) -> Result<(), F::Error> {
588 flash.read(self.state.from as u32, aligned).await?; 588 flash.read(self.state.from as u32, aligned).await?;
589 589
590 let mut is_set = true; 590 if aligned.iter().find(|&&b| b != magic).is_some() {
591 for b in 0..aligned.len() { 591 aligned.fill(0);
592 if aligned[b] != magic { 592
593 is_set = false;
594 }
595 }
596 if !is_set {
597 for i in 0..aligned.len() {
598 aligned[i] = 0;
599 }
600 flash.write(self.state.from as u32, aligned).await?; 593 flash.write(self.state.from as u32, aligned).await?;
601 flash.erase(self.state.from as u32, self.state.to as u32).await?; 594 flash.erase(self.state.from as u32, self.state.to as u32).await?;
602 595
603 for i in 0..aligned.len() { 596 aligned.fill(magic);
604 aligned[i] = magic;
605 }
606 flash.write(self.state.from as u32, aligned).await?; 597 flash.write(self.state.from as u32, aligned).await?;
607 } 598 }
608 Ok(()) 599 Ok(())
diff --git a/embassy-boot/stm32/Cargo.toml b/embassy-boot/stm32/Cargo.toml
index 1b6eeef93..13ae54b31 100644
--- a/embassy-boot/stm32/Cargo.toml
+++ b/embassy-boot/stm32/Cargo.toml
@@ -9,6 +9,7 @@ description = "Bootloader lib for STM32 chips"
9[dependencies] 9[dependencies]
10defmt = { version = "0.3", optional = true } 10defmt = { version = "0.3", optional = true }
11defmt-rtt = { version = "0.3", optional = true } 11defmt-rtt = { version = "0.3", optional = true }
12log = { version = "0.4", optional = true }
12 13
13embassy = { path = "../../embassy", default-features = false } 14embassy = { path = "../../embassy", default-features = false }
14embassy-stm32 = { path = "../../embassy-stm32", default-features = false, features = ["nightly"] } 15embassy-stm32 = { path = "../../embassy-stm32", default-features = false, features = ["nightly"] }
@@ -25,6 +26,11 @@ defmt = [
25 "embassy-boot/defmt", 26 "embassy-boot/defmt",
26 "embassy-stm32/defmt", 27 "embassy-stm32/defmt",
27] 28]
29log = [
30 "dep:log",
31 "embassy-boot/log",
32 "embassy-stm32/log",
33]
28debug = ["defmt-rtt"] 34debug = ["defmt-rtt"]
29 35
30[profile.dev] 36[profile.dev]