1
0
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:
Werner Almesberger
2011-03-11 17:40:51 -03:00
parent 2978afe92b
commit c265151d2b
3 changed files with 10 additions and 0 deletions

View File

@@ -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();
}