Hello,
I am having issue with my Jump to boot function. I have a bootloader located in flash code at address 0x00000000 to 0x00010000 and an application in flash code at address 0x00010000 to 0x00040000.
Here are my linker files
Boot
/* Specify the memory areas */
MEMORY
{
/* Flash */
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400
m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x0f000 - 0x410
/* programe_flash*/
m_boot_version (RWX) : ORIGIN = 0x0000f000, LENGTH = 0x00000040 /*version number */
/* SRAM_L */
m_data (RW) : ORIGIN = 0x1FFFC000, LENGTH = 0x00004000
/* SRAM_U */
m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00003000
}
Application
/* Specify the memory areas */
MEMORY
{
/* Flash */
m_interrupts (RXW) : ORIGIN = 0x00010000, LENGTH = 0x00000400
m_flash_config (RXW) : ORIGIN = 0x00010400, LENGTH = 0x00000010
m_text (RXW) : ORIGIN = 0x00010410, LENGTH = 0x00030000 - 0x410
/* programe_flash*/
ccp_code_sav (RWX) : ORIGIN = 0x00030000, LENGTH = 0x00002000 /*8k*/
ccp_code_tem (RWX) : ORIGIN = 0x00032000, LENGTH = 0x00002000 /*8k*/
m_app_version (RWX) : ORIGIN = 0x00034000, LENGTH = 0x00001000 /*version number 4k*/
ROM_writeflas (RWX) : ORIGIN = 0x00035000, LENGTH = 0x00001000 /* ROM_writeflash 4k*/
/* data_flash */
app_programe_dat (RW) : ORIGIN = 0x10000000, LENGTH = 0x00001000 /*8k*/
eeprom_dat (RW) : ORIGIN = 0x10002000, LENGTH = 0x00002000 /*8k*/
/* SRAM_L */
m_data (RW) : ORIGIN = 0x1FFFC000, LENGTH = 0X00001000 /*4K place have initialize global variable that not include 0*/
m_data_2 (RW) : ORIGIN = 0x1FFFD000, LENGTH = 0x00003000 /*12k heap and stack size*/
/* SRAM_U */
m_data_RAM0 (RW) : ORIGIN = 0X20000000, LENGTH = 0x00001000/* 4k gloab */
m_data_RAM1 (RW) : ORIGIN = 0x20001000, LENGTH = 0x00001000/* 4k app data*/
m_data_RAM3 (RW) : ORIGIN = 0x20002000, LENGTH = 0x00001000/* 4k CCP data*/
}
There is just an offset of 0x10000. And here is my code to jump to application :
void JumpToExecute(uint32_t SP, uint32_t Startup)
{
/* Mask interrupt */
DISABLE_INTERRUPTS()
__asm__("mov r0, #0x00");
__asm__("msr control, r0"); // nPRIV = 0
/* Set up Main and Process stack pointer (MSP, PSP)*/
__asm("ldr r0, =0x00010000");
__asm("msr msp, r0");
__asm("msr psp, r0");
/* Relocate Vector table */
S32_SCB->VTOR = (uint32_t)APP_IMAGE_START;// & S32_SCB_VTOR_TBLOFF_MASK;
/* Set program counter (PC) to the start of the reset handler */
__asm("ldr r1, =0x00010004");
__asm("mov pc, r1");
}
When i set a breakpoint on the last instruction i.e __asm("mov pc, r1"); it jump to unknown code:


But as you can see in the register view, i can see that sp is set to 0x10000 and pc is set to 0x10004.
I tried different addresses for setting PC, as 0x10410 but it doesn't jump at my start code application, i know it since i have set a Debug flag as in this article and a breakpoint with a condition on r11, and it never reach my flag..
Any ideas of what can be wrong ?
Best regards