Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixup STM32-DFU #21447

Merged
merged 1 commit into from
Jul 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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