Remove DFU bootloader self protection.
It can still be enabled by building with -DDFU_SELF_PROTECT
This commit is contained in:
parent
126df7bb35
commit
6659d87e9b
|
@ -61,6 +61,7 @@ uint32_t dfu_poll_timeout(uint8_t cmd, uint32_t addr, uint16_t blocknum)
|
||||||
|
|
||||||
void dfu_protect_enable(void)
|
void dfu_protect_enable(void)
|
||||||
{
|
{
|
||||||
|
#ifdef DFU_SELF_PROTECT
|
||||||
if ((FLASH_WRPR & 0x03) != 0x00) {
|
if ((FLASH_WRPR & 0x03) != 0x00) {
|
||||||
flash_unlock();
|
flash_unlock();
|
||||||
FLASH_CR = 0;
|
FLASH_CR = 0;
|
||||||
|
@ -70,6 +71,7 @@ void dfu_protect_enable(void)
|
||||||
/* MD Device: Protect 2 bits with (4 * 1k pages each)*/
|
/* MD Device: Protect 2 bits with (4 * 1k pages each)*/
|
||||||
flash_program_option_bytes(FLASH_OBP_WRP10, 0x03FC);
|
flash_program_option_bytes(FLASH_OBP_WRP10, 0x03FC);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void dfu_jump_app_if_valid(void)
|
void dfu_jump_app_if_valid(void)
|
||||||
|
|
|
@ -80,10 +80,12 @@ uint32_t dfu_poll_timeout(uint8_t cmd, uint32_t addr, uint16_t blocknum)
|
||||||
|
|
||||||
void dfu_protect_enable(void)
|
void dfu_protect_enable(void)
|
||||||
{
|
{
|
||||||
|
#ifdef DFU_SELF_PROTECT
|
||||||
if ((FLASH_OPTCR & 0x10000) != 0) {
|
if ((FLASH_OPTCR & 0x10000) != 0) {
|
||||||
flash_program_option_bytes(FLASH_OPTCR & ~0x10000);
|
flash_program_option_bytes(FLASH_OPTCR & ~0x10000);
|
||||||
flash_lock_option_bytes();
|
flash_lock_option_bytes();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void dfu_jump_app_if_valid(void)
|
void dfu_jump_app_if_valid(void)
|
||||||
|
|
Loading…
Reference in New Issue