diff options
Diffstat (limited to 'src/stm32/stm32h7.c')
-rw-r--r-- | src/stm32/stm32h7.c | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/src/stm32/stm32h7.c b/src/stm32/stm32h7.c index 43b7aa6e..dc9a29d1 100644 --- a/src/stm32/stm32h7.c +++ b/src/stm32/stm32h7.c @@ -208,38 +208,12 @@ clock_setup(void) * Bootloader ****************************************************************/ -#define USB_BOOT_FLAG_ADDR (0x24000000 + 0x8000) // Place flag in "AXI SRAM" -#define USB_BOOT_FLAG 0x55534220424f4f54 // "USB BOOT" - -// Flag that bootloader is desired and reboot -static void -usb_reboot_for_dfu_bootloader(void) -{ - irq_disable(); - uint64_t *bflag = (void*)USB_BOOT_FLAG_ADDR; - *bflag = USB_BOOT_FLAG; - SCB_CleanDCache_by_Addr((void*)bflag, sizeof(*bflag)); - NVIC_SystemReset(); -} - -// Check if rebooting into system DFU Bootloader -static void -check_usb_dfu_bootloader(void) -{ - if (!CONFIG_USB || *(uint64_t*)USB_BOOT_FLAG_ADDR != USB_BOOT_FLAG) - return; - *(uint64_t*)USB_BOOT_FLAG_ADDR = 0; - uint32_t *sysbase = (uint32_t*)0x1FF09800; - asm volatile("mov sp, %0\n bx %1" - : : "r"(sysbase[0]), "r"(sysbase[1])); -} - // Handle reboot requests void bootloader_request(void) { try_request_canboot(); - usb_reboot_for_dfu_bootloader(); + dfu_reboot(); } @@ -259,7 +233,7 @@ armcm_main(void) RCC->D3CCIPR = 0x00000000; SCB->VTOR = (uint32_t)VectorTable; - check_usb_dfu_bootloader(); + dfu_reboot_check(); clock_setup(); |