Hi, I'm not good at English, so please consider it.
I have a problem developing Bootloader and ask a question.
Using the debugger(Trace32), I checked that the contents of the User-App SREC file received from the serial terminal are stored well in Flash memory without any problems.
However, an error occurs when jumping to the User-App memory address.
The contents of the error are as follows.
I will explain my program code below.
The flash memory setting code of the Bootloader is as follows :
flash_rchw : org = 0x00FC0000, len = 0x4
cpu0_reset_vec : org = 0x00FC0000+0x10, len = 0x4
cpu1_reset_vec : org = 0x00FC0000+0x14, len = 0x4
cpu2_reset_vec : org = 0x00FC0000+0x04, len = 0x4
m_text : org = 0x00FC0400, len = 1854K
m_data : org = 0x40000000, len = 512K
The User-App jump code for the Bootloader is as follows :
#define APP_StartAddr 0x01000010
#define Bootloader_StartAddr 0x00FC0010
void app_entry(void)
{
unsigned long result = *(unsigned long *)APP_StartAddr;
//__asm("wrteei 0"); /* disable all interrupts. */
__asm("nop");
if(result != 0xFFFFFFFF)
{
(*(void(*)(void))(*(unsigned long*)APP_StartAddr))();
}
else
{
(*(void(*)(void))(*(unsigned long*)Bootloader_StartAddr))();
}
while(1);
}
The flash memory setting code of the User-App is as follows :
flash_rchw : org = 0x01000000, len = 0x4
cpu0_reset_vec : org = 0x01000000+0x10, len = 0x4
cpu1_reset_vec : org = 0x01000000+0x14, len = 0x4
cpu2_reset_vec : org = 0x01000000+0x04, len = 0x4
m_text : org = 0x01000400, len = 1856K
m_data : org = 0x40000000, len = 256K
I would appreciate it if you could help me run the User-App well.
Thanks:)
Hi @K_W_SEO
there's no problem with that code. It should jump to entry point at mentioned addresses.
First important thing - make sure that all interrupts are disabled on all levels - by MSR[EE], by priority registers, by local enable bits in peripherals. It's also good idea to put everything back to default state.
Next thing - did you try to step asm code of that call function? Can you see if correct address is loaded from flash? If you then step over jump instruction (there will be probably se_bctrl, I guess) does it jump to that address? Or does it crash later? You can check also address in SRR0 core registers when it reaches IVOR6. This register should contain address of instruction which caused the error.
Regards,
Lukas