AnsweredAssumed Answered

Issue in Jumping from Bootloader to Application

Question asked by Lakshmi S on Mar 14, 2020
Latest reply on Mar 18, 2020 by Lukas Zadrapa

Hi 

I am using S32K144, i have custom Boot loader project and Application project separately which have separate linker file. My Application starts from 0x1000 to 0xC000. I am facing issue while jumping from bootloder to Application.  

#define APP_VECTOR_TABLE           0x1000

void JumpToUserApplication(void)
{

if(APP_RESET_ADDRESS == 0xFFFFFFFF){
return;
}

S32_SCB->VTOR = (uint32_t)APP_VECTOR_TABLE;
JumpApplication(*((uint32_t*)APP_VECTOR_TABLE), *((uint32_t*)(APP_VECTOR_TABLE + 4)));

}
void JumpApplication( unsigned int userSP, unsigned int userStartup)
{
/* Check if Entry address is erased and return if erased */

/* Set up stack pointer */
__asm("ldr r0,=0x1000");
__asm("msr msp, r0");
__asm("msr psp, r0");

 

/* Jump to application PC (r1) */
__asm("ldr r1,=0x1005");
__asm("blx r1");
}

 

Everything seems ok until right before the branch (blx r1) then it is jumping to 0x1478 and stucks here.

/* Disassembly */

0000146d: strb r0, [r0, #0]
0000146f: movs r0, #0
00001471: push {r0, r2, r6, r7}
00001473: movs r0, r0
00001475: cbz r1, 0x14de
00001477: movs r0, r0
00001479: b.w 0x1478          <------------   PC is not come out of this
0000147d: cbnz r3, 0x1494
0000147f: cbnz r2, 0x1494
00001481: cmp r1, #0
00001483: it eq
00001485: cmpeq r0, #0 

 

 

Where i Did Mistake?

Please help me to sort out this issue.

Thanks in Advance.

Outcomes