I have problems jumping to the main application from a secondary bootloader and I have read AN12604SW and several NXP threads such as: https://community.nxp.com/t5/i-MX-RT/Problem-with-exiting-the-second-bootloader-and-jumping-to-user/....
The jump to application only works if I am running with a debugger. The the application is running without the debugger it will not start.
I have a Embedded Artists imx-rt1062 developers kit with the version 2.9.3 of the SDK.
I have reproduced the problem with the iled-blinky SDK example with attached files.
I have split up the flash memory in 3 parts:
The BOOT_FLASH at 0x60000000 contains the boot and dcd data. The secondary bootloader is located in START_FLASH and the main application is located at 0x60006000.

The this a minimal version of my secondary bootloader (ota_bootloader_hdr.c) which makes a jump to the start-up code (ResetISR2) at location 0x6000631c for the main application.
#define BL_APP_VECTOR_TABLE_ADDRESS 0x60006000
#define APP_VECTOR_TABLE ((uint32_t *)BL_APP_VECTOR_TABLE_ADDRESS)
extern void ResetISR2();
void goToApp()
{
static void (*farewellBootloader)(void) = 0;
farewellBootloader = (void (*)(void))(0x6000631c);
SCB->VTOR = (uint32_t)APP_VECTOR_TABLE;
__set_MSP(APP_VECTOR_TABLE[0]);
__set_PSP(APP_VECTOR_TABLE[0]);
farewellBootloader();
for (int i = 33000; i >= 0; i--) {
__NOP();
}
}
// TODO(roberi) Cannot change name of the entry point in the MCUexpresso IDE for auto generated linker script.
void ResetISR(void) {
goToApp();
// ResetISR2(); // This call will work without the debugger
}
If I am running with the debugger attached the code will work fine. But If run the application without the debugger it will crash. The application also works fine if I call “ResetISR2” from the secondary bootloader.