Hello Team,
Currently I'm working in bootloader development activity for i.MXRT1064, I received the new firmware image from the file system and write into the internal flash memory. After write the new firmware image, I want jump from custom bootloader to application, custom bootloader's address range from 0x70000000 to 0x70080400, rest of address space allocated for application. I've referred the SDK of mcuboot_opensource source and I took jump to application code from this SDK example, there I've updated the ivt, disabled the vector and I tried to execute jump, but unfortunately it is not happening. Please refer my following jump to application code.
#define APP_VECTOR_TABLE_ADDRESS 0x70080400
#define STACK_POINTER_SIZE 0x20001FFFUL
struct arm_vector_table
{
uint32_t msp;
uint32_t reset;
};
//! @brief Exits bootloader and jumps to the user application.
void jump_to_application(void)
{
/*LED*/
gpio_pin_config_t led_config = {kGPIO_DigitalOutput, 0, kGPIO_NoIntmode};
GPIO_PinInit(GPIO3, 4U, &led_config);
GPIO_PinWrite(GPIO3, 4U, 1U); // 6th LED //
/*LED*/
//Jump Implementation//
PRINTF("\nStart Jump process\n");
__asm volatile ("cpsid i");
SCB_DisableDCache();
vt = (struct arm_vector_table *)(APP_VECTOR_TABLE_ADDRESS);
vt->msp = STACK_POINTER_SIZE;
//cleanup();
SCB_DisableICache();
SCB_DisableDCache();
ARM_MPU_Disable();
DbgConsole_Deinit();
//bspstop();
for (long delay = 0; delay < 1000000; delay++)
{
// Do nothing..
for (long delay1 = 0; delay1 < 1000; delay1++)
{
// Do nothing..
}
}
//!<Experimental part>
//PRINTF("\nBefore VTOR init\n");
// Set the VTOR to the application vector table address.
//SCB->VTOR = (uint32_t *)(0x70080400);
//!<Experiment part>
__set_CONTROL(0);
__set_MSP(vt->msp);
__ISB();
((void (*)(void))vt->reset)();
//Should never print this statement//
PRINTF("\nJUMP SUCCESSFUL\n");
//Jump Implementation - END//
//Boot loader end //
}
Please find the attached application's hex file snap for your reference. Please let me know, what I'm missing in the code and give me solution to jump.