mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2025-04-21 12:27:27 +03:00
atusb/fw: introduced function flash_end_write to properly finish flashing
- dfu.h (flash_end_write), flash.c (flash_end_write): write any incomplete buffer - flash.c (flash_write, flash_end_write): call boot_rww_enable only at the very end, it won't erase our buffer in mid-page - usb/dfu.c (my_setup): call flash_end_write at the end of a download
This commit is contained in:
@@ -57,7 +57,15 @@ void flash_write(const uint8_t *buf, uint16_t size)
|
||||
boot_spm_busy_wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void flash_end_write(void)
|
||||
{
|
||||
if (payload & (SPM_PAGESIZE-1)) {
|
||||
boot_page_write(payload & ~(SPM_PAGESIZE-1));
|
||||
boot_spm_busy_wait();
|
||||
}
|
||||
boot_rww_enable();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user