I use the Bootloader from the AN12218 example.
JumpToApplication function:
void JumpToUserApplication( unsigned int userSP, unsigned int userStartup)
{
/* Check if Entry address is erased and return if erased */
if(userSP == 0xFFFFFFFF){
return;
}
/* Set up stack pointer */
__asm("msr msp, r0");
__asm("msr psp, r0");
/* Relocate vector table */
S32_SCB->VTOR = (uint32_t)APP_CODE_ADDR_0;
/* Jump to application PC (r1) */
__asm("mov pc, r1");
}
call by;
__asm("cpsid i");
JumpToUserApplication(*((uint32_t*)0x0000E000), *((uint32_t*)(0x0000E000 + 4)));
Bootloader Linker file:
/* Entry Point */
ENTRY(Reset_Handler)
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x00000200;
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x00000200;
/* If symbol __flash_vector_table__=1 is defined at link time
* the interrupt vector will not be copied to RAM.
* Warning: Using the interrupt vector from Flash will not allow
* INT_SYS_InstallHandler because the section is Read Only.
*/
M_VECTOR_RAM_SIZE = DEFINED(__flash_vector_table__) ? 0x0 : 0x00C0;
/* Specify the memory areas */
MEMORY
{
/* Flash */
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x000000C0
m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x0000DBF0
/* SRAM_L */
m_custom (RW) : ORIGIN = 0x1FFFFC00, LENGTH = 0x00000400
/* SRAM_U */
m_data (RW) : ORIGIN = 0x20000000, LENGTH = 0x000030C0
m_data_2 (RW) : ORIGIN = 0x200030C0, LENGTH = 0x00002740
}
Application linker file:
/* Entry Point */
ENTRY(Reset_Handler)
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x00000200;
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x00000200;
/* If symbol __flash_vector_table__=1 is defined at link time
* the interrupt vector will not be copied to RAM.
* Warning: Using the interrupt vector from Flash will not allow
* INT_SYS_InstallHandler because the section is Read Only.
*/
M_VECTOR_RAM_SIZE = DEFINED(__flash_vector_table__) ? 0x0 : 0x00C0;
/* Specify the memory areas */
MEMORY
{
/* Flash */
m_interrupts (RX) : ORIGIN = 0x0000E000, LENGTH = 0x000000C0
m_flash_config (RX) : ORIGIN = 0x0000E400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x0000E410, LENGTH = 0x00019000
/* SRAM_L */
m_custom (RW) : ORIGIN = 0x1FFFFC00, LENGTH = 0x00000400
/* SRAM_U */
m_data (RW) : ORIGIN = 0x20000000, LENGTH = 0x000030C0
m_data_2 (RW) : ORIGIN = 0x200030C0, LENGTH = 0x00002740
}
But I can't jump to Application function:
How can I solve it?I hope somebody has an idea.