Merge pull request #219 from UweBonnes/dfu_update

dfu_f1/dfu_upgrade: Do not set read protection.
This commit is contained in:
Gareth McMullin 2017-05-03 10:39:13 -07:00 committed by GitHub
commit bfce31f26a

View File

@ -77,11 +77,25 @@ void dfu_protect(dfu_mode_t mode)
} }
#endif #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_unlock();
FLASH_CR = 0; FLASH_CR = 0;
flash_erase_option_bytes(); flash_erase_option_bytes();
flash_program_option_bytes(FLASH_OBP_RDP, FLASH_OBP_RDP_KEY);
} }
#endif
} }
void dfu_jump_app_if_valid(void) void dfu_jump_app_if_valid(void)