Merge #838
838: embassy-boot touchups r=lulf a=FrozenDroid Co-authored-by: Vincent Stakenburg <v.stakenburg@cosinuss.nl>
This commit is contained in:
commit
0ed4e57ea4
@ -587,22 +587,13 @@ impl FirmwareUpdater {
|
|||||||
) -> Result<(), F::Error> {
|
) -> Result<(), F::Error> {
|
||||||
flash.read(self.state.from as u32, aligned).await?;
|
flash.read(self.state.from as u32, aligned).await?;
|
||||||
|
|
||||||
let mut is_set = true;
|
if aligned.iter().find(|&&b| b != magic).is_some() {
|
||||||
for b in 0..aligned.len() {
|
aligned.fill(0);
|
||||||
if aligned[b] != magic {
|
|
||||||
is_set = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !is_set {
|
|
||||||
for i in 0..aligned.len() {
|
|
||||||
aligned[i] = 0;
|
|
||||||
}
|
|
||||||
flash.write(self.state.from as u32, aligned).await?;
|
flash.write(self.state.from as u32, aligned).await?;
|
||||||
flash.erase(self.state.from as u32, self.state.to as u32).await?;
|
flash.erase(self.state.from as u32, self.state.to as u32).await?;
|
||||||
|
|
||||||
for i in 0..aligned.len() {
|
aligned.fill(magic);
|
||||||
aligned[i] = magic;
|
|
||||||
}
|
|
||||||
flash.write(self.state.from as u32, aligned).await?;
|
flash.write(self.state.from as u32, aligned).await?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -9,6 +9,7 @@ description = "Bootloader lib for STM32 chips"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
defmt = { version = "0.3", optional = true }
|
defmt = { version = "0.3", optional = true }
|
||||||
defmt-rtt = { version = "0.3", optional = true }
|
defmt-rtt = { version = "0.3", optional = true }
|
||||||
|
log = { version = "0.4", optional = true }
|
||||||
|
|
||||||
embassy = { path = "../../embassy", default-features = false }
|
embassy = { path = "../../embassy", default-features = false }
|
||||||
embassy-stm32 = { path = "../../embassy-stm32", default-features = false, features = ["nightly"] }
|
embassy-stm32 = { path = "../../embassy-stm32", default-features = false, features = ["nightly"] }
|
||||||
@ -25,6 +26,11 @@ defmt = [
|
|||||||
"embassy-boot/defmt",
|
"embassy-boot/defmt",
|
||||||
"embassy-stm32/defmt",
|
"embassy-stm32/defmt",
|
||||||
]
|
]
|
||||||
|
log = [
|
||||||
|
"dep:log",
|
||||||
|
"embassy-boot/log",
|
||||||
|
"embassy-stm32/log",
|
||||||
|
]
|
||||||
debug = ["defmt-rtt"]
|
debug = ["defmt-rtt"]
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user