diff --git a/flight/targets/boards/osd/bootloader/main.c b/flight/targets/boards/osd/bootloader/main.c index b6b8fe83f..82878dfbd 100644 --- a/flight/targets/boards/osd/bootloader/main.c +++ b/flight/targets/boards/osd/bootloader/main.c @@ -170,7 +170,11 @@ void jump_to_app() { const struct pios_board_info * bdinfo = &pios_board_info_blob; PIOS_LED_On(PIOS_LED_HEARTBEAT); - if (((*(__IO uint32_t*) bdinfo->fw_base) & 0x2FFE0000) == 0x20000000) { /* Jump to user application */ + // Look at cm3_vectors struct in startup. In a fw image the first uint32_t contains the address of the top of irqstack + uint32_t fwIrqStackBase = (*(__IO uint32_t*) bdinfo->fw_base) & 0xFFFE0000; + // Check for the two possible irqstack locations (sram or core coupled sram) + if ( fwIrqStackBase == 0x20000000 || fwIrqStackBase == 0x10000000) { + /* Jump to user application */ FLASH_Lock(); RCC_APB2PeriphResetCmd(0xffffffff, ENABLE); RCC_APB1PeriphResetCmd(0xffffffff, ENABLE); diff --git a/flight/targets/boards/revolution/bootloader/main.c b/flight/targets/boards/revolution/bootloader/main.c index 5689ede26..db02ff0ad 100644 --- a/flight/targets/boards/revolution/bootloader/main.c +++ b/flight/targets/boards/revolution/bootloader/main.c @@ -174,7 +174,11 @@ void jump_to_app() { const struct pios_board_info * bdinfo = &pios_board_info_blob; PIOS_LED_On(PIOS_LED_HEARTBEAT); - if (((*(__IO uint32_t*) bdinfo->fw_base) & 0x2FFE0000) == 0x20000000) { /* Jump to user application */ + // Look at cm3_vectors struct in startup. In a fw image the first uint32_t contains the address of the top of irqstack + uint32_t fwIrqStackBase = (*(__IO uint32_t*) bdinfo->fw_base) & 0xFFFE0000; + // Check for the two possible irqstack locations (sram or core coupled sram) + if ( fwIrqStackBase == 0x20000000 || fwIrqStackBase == 0x10000000) { + /* Jump to user application */ FLASH_Lock(); RCC_APB2PeriphResetCmd(0xffffffff, ENABLE); RCC_APB1PeriphResetCmd(0xffffffff, ENABLE); diff --git a/flight/targets/boards/revoproto/bootloader/main.c b/flight/targets/boards/revoproto/bootloader/main.c index 5689ede26..1f364abba 100644 --- a/flight/targets/boards/revoproto/bootloader/main.c +++ b/flight/targets/boards/revoproto/bootloader/main.c @@ -174,7 +174,11 @@ void jump_to_app() { const struct pios_board_info * bdinfo = &pios_board_info_blob; PIOS_LED_On(PIOS_LED_HEARTBEAT); - if (((*(__IO uint32_t*) bdinfo->fw_base) & 0x2FFE0000) == 0x20000000) { /* Jump to user application */ + // Look at cm3_vectors struct in startup. In a fw image the first uint32_t contains the address of the top of irqstack + uint32_t fwIrqStackBase = (*(__IO uint32_t*) bdinfo->fw_base) & 0xFFFE0000; + // Check for the two possible irqstack locations (sram or core coupled sram) + if ( fwIrqStackBase == 0x20000000 || fwIrqStackBase == 0x10000000) { + /* Jump to user application */ FLASH_Lock(); RCC_APB2PeriphResetCmd(0xffffffff, ENABLE); RCC_APB1PeriphResetCmd(0xffffffff, ENABLE);