AnsweredAssumed Answered

how bootloader jumping to application

Question asked by Jxun LIU on Feb 23, 2020
Latest reply on Feb 27, 2020 by Jxun LIU

Hello everybody,

     I am new to NXP S32K1xx, I have a bootloader project with S32K116 now. the memory map is:

bootloader : 0 ~ 3FFF

application: 4000 ~ flash end.

   

    in debug mode memory view, I see that application is programmed."Jump_To_Application" is called after programming is done.

  Jump_To_Application(*((uint32_t*)APP_START_ADDRESS),*((uint32_t*)(APP_START_ADDRESS+4))); 

/* APP_START_ADDRESS = 0x4000 */

 

but seems it doesn't work because I never see the application is running.

 

below is the implement of "Jump_To_Application"

void Jump_To_Application(uint32_t userSP, uint32_t userStartup)
{
 if(userSP == 0xFFFFFFFF)
 {
  return;
 }
 else
 {
  /* Set up stack pointer */
  __asm("msr msp, r0");
  __asm("msr psp, r0");

  /* Relocate vector table */
  S32_SCB->VTOR = (uint32_t)APP_START_ADDRESS;
  /* Jump to application PC (r1) */
  __asm("mov pc, r1");
 }
}

 

I set a breakpoint at the beginning of "Jump_To_Application", I check the register "r0" , and "r1",

 "r0" is 0x20003800

"r1"  is 0x4411.

I don't find any problem, am I missing anything.

Any comment is welcome.

Outcomes