diff options
Diffstat (limited to 'src/stm32/stm32f4.c')
-rw-r--r-- | src/stm32/stm32f4.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/stm32/stm32f4.c b/src/stm32/stm32f4.c index f8b5ab2d..9b5433af 100644 --- a/src/stm32/stm32f4.c +++ b/src/stm32/stm32f4.c @@ -98,7 +98,18 @@ void usb_request_bootloader(void) { irq_disable(); - *(uint64_t*)USB_BOOT_FLAG_ADDR = USB_BOOT_FLAG; + if (CONFIG_STM32_FLASH_START_4000) { + // HID Bootloader + RCC->APB1ENR |= RCC_APB1ENR_PWREN; + RCC->APB1ENR; + PWR->CR |= PWR_CR_DBP; + // HID Bootloader magic key + RTC->BKP4R = 0x424C; + PWR->CR &= ~PWR_CR_DBP; + } else { + // System DFU Bootloader + *(uint64_t*)USB_BOOT_FLAG_ADDR = USB_BOOT_FLAG; + } NVIC_SystemReset(); } |