MPC5748G Bootloader Jump to User App Error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MPC5748G Bootloader Jump to User App Error

361 Views
K_W_SEO
Contributor II

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.

K_W_SEO_0-1678181103042.png

 

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:)

 

 

 

0 Kudos
2 Replies

350 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

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

0 Kudos

328 Views
K_W_SEO
Contributor II

It helped me a lot. Thank you!

0 Kudos