fix: Flasher otadata erase timeout — skip flash_end between sequences
The ROM accepts consecutive flash_begin calls without an intervening flash_end, so we no longer end+re-sync between the firmware write and the otadata erase. Single flash_end after both sequences. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3e54361d0d
commit
1420bbcc74
1 changed files with 11 additions and 12 deletions
|
|
@ -643,23 +643,17 @@ pub fn flash_firmware(
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------ //
|
// ------------------------------------------------------------------ //
|
||||||
// Step 8: FLASH_END //
|
// Step 8: Erase otadata when flashing factory //
|
||||||
// //
|
|
||||||
// We pass reboot=false here so the chip stays in bootloader mode for //
|
|
||||||
// the MD5 verification step that follows. A hard reset is done after. //
|
|
||||||
// ------------------------------------------------------------------ //
|
|
||||||
send_progress(0.92, "Finalizing write...".into());
|
|
||||||
flash_end(&mut port, false)?;
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------ //
|
|
||||||
// Step 8b: Erase otadata partition (0xF000, 8KB) when flashing factory //
|
|
||||||
// //
|
// //
|
||||||
// If we just wrote to the factory partition, the bootloader might //
|
// If we just wrote to the factory partition, the bootloader might //
|
||||||
// still have otadata pointing to ota_0. We erase otadata to force //
|
// still have otadata pointing to ota_0. We erase otadata to force //
|
||||||
// the bootloader to fall back to factory on next boot. //
|
// the bootloader to fall back to factory on next boot. //
|
||||||
|
// //
|
||||||
|
// The ROM accepts consecutive flash_begin calls without flash_end in //
|
||||||
|
// between — no need to end+re-sync between the two flash sequences. //
|
||||||
// ------------------------------------------------------------------ //
|
// ------------------------------------------------------------------ //
|
||||||
if offset == 0x20000 {
|
if offset == 0x20000 {
|
||||||
send_progress(0.93, "Erasing otadata (force factory boot)...".into());
|
send_progress(0.92, "Erasing otadata (force factory boot)...".into());
|
||||||
const OTADATA_OFFSET: u32 = 0xF000;
|
const OTADATA_OFFSET: u32 = 0xF000;
|
||||||
const OTADATA_SIZE: u32 = 0x2000; // 8 KB
|
const OTADATA_SIZE: u32 = 0x2000; // 8 KB
|
||||||
flash_begin(&mut port, OTADATA_OFFSET, OTADATA_SIZE, FLASH_BLOCK_SIZE)?;
|
flash_begin(&mut port, OTADATA_OFFSET, OTADATA_SIZE, FLASH_BLOCK_SIZE)?;
|
||||||
|
|
@ -668,9 +662,14 @@ pub fn flash_firmware(
|
||||||
for i in 0..otadata_blocks {
|
for i in 0..otadata_blocks {
|
||||||
flash_data(&mut port, i, &empty_block)?;
|
flash_data(&mut port, i, &empty_block)?;
|
||||||
}
|
}
|
||||||
flash_end(&mut port, false)?;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------ //
|
||||||
|
// Step 9: FLASH_END — stay in bootloader for MD5 verification //
|
||||||
|
// ------------------------------------------------------------------ //
|
||||||
|
send_progress(0.93, "Finalizing write...".into());
|
||||||
|
flash_end(&mut port, false)?;
|
||||||
|
|
||||||
// ------------------------------------------------------------------ //
|
// ------------------------------------------------------------------ //
|
||||||
// Step 9: MD5 post-write verification //
|
// Step 9: MD5 post-write verification //
|
||||||
// //
|
// //
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue