Skip to content

Commit

Permalink
Fixup STM32-DFU (qmk#21447)
Browse files Browse the repository at this point in the history
  • Loading branch information
tzarc authored and autoferrit committed Dec 6, 2023
1 parent 1c89117 commit a601d5f
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions platforms/chibios/bootloaders/stm32_dfu.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ void enter_bootloader_mode_if_requested(void) {
if (bootloader_marker_active()) {
bootloader_marker_disable();

struct system_memory_vector_t {
uint32_t stack_top;
void (*entrypoint)(void);
};
const struct system_memory_vector_t *bootloader = (const struct system_memory_vector_t *)(STM32_BOOTLOADER_ADDRESS);

__disable_irq();

# if defined(QMK_MCU_ARCH_CORTEX_M7)
Expand All @@ -128,16 +134,11 @@ void enter_bootloader_mode_if_requested(void) {
NVIC->ICPR[i] = 0xFFFFFFFF;
}

__set_CONTROL(0);
__set_MSP(bootloader->stack_top);
__enable_irq();

struct system_memory_vector_t {
uint32_t stack_top;
void (*entrypoint)(void);
};
const struct system_memory_vector_t *bootloader = (const struct system_memory_vector_t *)(STM32_BOOTLOADER_ADDRESS);

// Jump to bootloader
__set_MSP(bootloader->stack_top);
bootloader->entrypoint();
while (true) {
}
Expand Down

0 comments on commit a601d5f

Please sign in to comment.