AnsweredAssumed Answered

Issue in Jumping Bootloader to Application

Question asked by Veeraju Hallikeri on Mar 16, 2020
Latest reply on Mar 18, 2020 by Lukas Zadrapa

hi 

i am using S32K144, i have separate custom boot loader and Application projects. I have Reset vector address in my boot loader project . so after some condition the control should go to Application project from bootloader..

I used this logic for jumping 

#define APP_START_ADDRESS           0x1000

main()

{

   if(Boot_flag) {

       if(userSP == 0xFFFFFFFF){
          disable_intterupts();

          S32_SCB->VTOR = (uint32_t)APP_START_ADDRESS;

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

      }

}

}

 

void JumpToUserApplication( unsigned int userSP, unsigned int userStartup)
{
/* Set up stack pointer */
__asm("msr msp, r0");
__asm("msr psp, r0");

/* Relocate vector table */

 

/* Jump to application PC (r1) */
__asm("mov pc, r1");
}

Using this it is jumping to ASW startup code but stucks in address 0x1478

Boot loader linker script :

MEMORY
{
/* Flash */
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400
m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x00000E000, LENGTH = 0x0001FFFF

/* SRAM_L */
m_data (RW) : ORIGIN = 0x1FFF8000, LENGTH = 0x00008000

/* SRAM_U */
m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00007000
}

 

Application linker :

MEMORY
{
/* Flash */
m_interrupts (RX) : ORIGIN = 0x00001000, LENGTH = 0x00000400
m_flash_config (RX) : ORIGIN = 0x00001400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x000001410, LENGTH = 0x0000CFFF

/* SRAM_L */
m_data (RW) : ORIGIN = 0x1FFF8000, LENGTH = 0x00008000

/* SRAM_U */
m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00007000
}

where i did the mistake ?

Please help me to sort out this issue.

Thanks in Advance.

Outcomes