aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Youren <[email protected]>2025-06-20 14:45:13 +0100
committerGitHub <[email protected]>2025-06-20 14:45:13 +0100
commit53fd571ddb4774d103340e1442efa671a3564567 (patch)
tree96a555f2385f2df2aa7cbb6459a48009f93304f7
parent206a324cf4d612122356fb350b4a3b56391d6f20 (diff)
Only write to the flash what was read from the file
The write method is given the full aligned buffer to write to flash even though it may not be fully populated. This change ensures only what has been read is written to flash. Preventing potential corrupted firmware and additional flash wear.
-rw-r--r--examples/boot/application/rp/src/bin/a.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/boot/application/rp/src/bin/a.rs b/examples/boot/application/rp/src/bin/a.rs
index ede0c07da..e6d7b3d4f 100644
--- a/examples/boot/application/rp/src/bin/a.rs
+++ b/examples/boot/application/rp/src/bin/a.rs
@@ -54,7 +54,7 @@ async fn main(_s: Spawner) {
54 for chunk in APP_B.chunks(4096) { 54 for chunk in APP_B.chunks(4096) {
55 buf.0[..chunk.len()].copy_from_slice(chunk); 55 buf.0[..chunk.len()].copy_from_slice(chunk);
56 defmt::info!("writing block at offset {}", offset); 56 defmt::info!("writing block at offset {}", offset);
57 writer.write(offset, &buf.0[..]).unwrap(); 57 writer.write(offset, &buf.0[..chunk.len()]).unwrap();
58 offset += chunk.len() as u32; 58 offset += chunk.len() as u32;
59 } 59 }
60 watchdog.feed(); 60 watchdog.feed();