dfu_f1/dfu_upgrade: Do not set read protection.

As the first 4 pages of the bootloader will always keep write protection
once read protection is applied, with the second update of the bootloader
only the higher pages where updated effectivly.
In most cases this resulted in an inaccessible device!
This commit is contained in:
Uwe Bonnes 2017-04-28 17:39:23 +02:00
parent b10971b19b
commit 5af76a1b74
1 changed files with 15 additions and 1 deletions

View File

@ -77,11 +77,25 @@ void dfu_protect(dfu_mode_t mode)
}
#endif
}
else if (mode == UPD_MODE) {
/* There is no way we can update the bootloader with a programm running
* on the same device when the bootloader pages are write
* protected or the device is read protected!
*
* Erasing option bytes to remove write protection will make the
* device read protected. Read protection means that the first pages
* get write protected again (PM0075, 2.4.1 Read protection.)
*
* Removing read protection after option erase results in device mass
* erase, crashing the update (PM0075, 2.4.2, Unprotection, Case 1).
*/
#if 0
else if ((mode == UPD_MODE) && ((FLASH_WRPR & 0x03) != 0x03)) {
flash_unlock();
FLASH_CR = 0;
flash_erase_option_bytes();
flash_program_option_bytes(FLASH_OBP_RDP, FLASH_OBP_RDP_KEY);
}
#endif
}
void dfu_jump_app_if_valid(void)