Remove DFU bootloader self protection.

It can still be enabled by building with -DDFU_SELF_PROTECT
This commit is contained in:
Gareth McMullin 2013-04-16 16:51:59 -07:00
parent 126df7bb35
commit 6659d87e9b
2 changed files with 4 additions and 0 deletions

View File

@ -61,6 +61,7 @@ uint32_t dfu_poll_timeout(uint8_t cmd, uint32_t addr, uint16_t blocknum)
void dfu_protect_enable(void)
{
#ifdef DFU_SELF_PROTECT
if ((FLASH_WRPR & 0x03) != 0x00) {
flash_unlock();
FLASH_CR = 0;
@ -70,6 +71,7 @@ void dfu_protect_enable(void)
/* MD Device: Protect 2 bits with (4 * 1k pages each)*/
flash_program_option_bytes(FLASH_OBP_WRP10, 0x03FC);
}
#endif
}
void dfu_jump_app_if_valid(void)

View File

@ -80,10 +80,12 @@ uint32_t dfu_poll_timeout(uint8_t cmd, uint32_t addr, uint16_t blocknum)
void dfu_protect_enable(void)
{
#ifdef DFU_SELF_PROTECT
if ((FLASH_OPTCR & 0x10000) != 0) {
flash_program_option_bytes(FLASH_OPTCR & ~0x10000);
flash_lock_option_bytes();
}
#endif
}
void dfu_jump_app_if_valid(void)