2019-03-29 16:10:31 +00:00
|
|
|
static void erase_storage_code_progress(void) {
|
2019-11-09 18:20:32 +00:00
|
|
|
flash_enter();
|
2019-03-29 16:10:31 +00:00
|
|
|
// erase storage area
|
|
|
|
for (int i = FLASH_STORAGE_SECTOR_FIRST; i <= FLASH_STORAGE_SECTOR_LAST;
|
|
|
|
i++) {
|
|
|
|
layoutProgress("WIPING ... Please wait",
|
|
|
|
1000 * (i - FLASH_STORAGE_SECTOR_FIRST) /
|
|
|
|
(FLASH_CODE_SECTOR_LAST - FLASH_STORAGE_SECTOR_FIRST));
|
|
|
|
flash_erase_sector(i, FLASH_CR_PROGRAM_X32);
|
|
|
|
}
|
|
|
|
// erase code area
|
|
|
|
for (int i = FLASH_CODE_SECTOR_FIRST; i <= FLASH_CODE_SECTOR_LAST; i++) {
|
|
|
|
layoutProgress("WIPING ... Please wait",
|
|
|
|
1000 * (i - FLASH_STORAGE_SECTOR_FIRST) /
|
|
|
|
(FLASH_CODE_SECTOR_LAST - FLASH_STORAGE_SECTOR_FIRST));
|
|
|
|
flash_erase_sector(i, FLASH_CR_PROGRAM_X32);
|
|
|
|
}
|
2019-11-09 18:20:32 +00:00
|
|
|
flash_exit();
|
2019-01-27 10:58:30 +00:00
|
|
|
}
|
|
|
|
|
2019-03-29 16:10:31 +00:00
|
|
|
static void erase_code_progress(void) {
|
2019-11-09 18:20:32 +00:00
|
|
|
flash_enter();
|
2019-03-29 16:10:31 +00:00
|
|
|
for (int i = FLASH_CODE_SECTOR_FIRST; i <= FLASH_CODE_SECTOR_LAST; i++) {
|
|
|
|
layoutProgress("PREPARING ... Please wait",
|
|
|
|
1000 * (i - FLASH_CODE_SECTOR_FIRST) /
|
|
|
|
(FLASH_CODE_SECTOR_LAST - FLASH_CODE_SECTOR_FIRST));
|
|
|
|
flash_erase_sector(i, FLASH_CR_PROGRAM_X32);
|
|
|
|
}
|
|
|
|
layoutProgress("INSTALLING ... Please wait", 0);
|
2019-11-09 18:20:32 +00:00
|
|
|
flash_exit();
|
2019-01-27 10:58:30 +00:00
|
|
|
}
|
|
|
|
|
2019-03-29 16:10:31 +00:00
|
|
|
static void erase_storage(void) {
|
2019-11-09 18:20:32 +00:00
|
|
|
flash_enter();
|
2019-03-29 16:10:31 +00:00
|
|
|
for (int i = FLASH_STORAGE_SECTOR_FIRST; i <= FLASH_STORAGE_SECTOR_LAST;
|
|
|
|
i++) {
|
|
|
|
flash_erase_sector(i, FLASH_CR_PROGRAM_X32);
|
|
|
|
}
|
2019-11-09 18:20:32 +00:00
|
|
|
flash_exit();
|
2019-01-27 10:58:30 +00:00
|
|
|
}
|