Hi,
I am working on a bootloader in which all the steps are done but while jumping from boot to app there is an issue.
I am using the below mentioned boot to application jump code.
void goto_application(void)
{
void (*entry)(void);
uint32_t pc, sp;
INT_SYS_DisableIRQGlobal();
S32_SCB->VTOR=(uint32_t)(0xa000);
sp = *((volatile uint32_t*)0xa000);
__asm("ldr r0, =0xa000");
pc = *((volatile uint32_t *)(0xa000 + 4));
entry = (void (*)(void))pc;
entry();
}
The application base address is 0xA000.
I added the breakpoint in the code to check the register values are getting properly updated or not. And when the breakpoint hit the entry() in the code the register values got updated as you can see in the below screenshot.

But after entry() , program counter is jumped to 0xA33A location instead of 0xA004(pc value is given in the above code). Below screenshot refers to this point.
And also the application code is divided into 3 blocks.
1st block address starts from 0xA000 to 0xA2E5
2nd block address starts from 0xA400 to 0xA40F and
3rd block address starts from 0xA480 to 0x1FFFF.

Program counter is locating to the address which doesn't come in all 3 blocks .
So, could someone help me in fixing the issue with proper solution.
If working code is provided for boot to application jump would be highly appreciated.
Controller: MCU-S32K116
IDE-S32 DESIGN STUDIOS
COMPILER-IAR
Regards,
Ramsai