After jumping from boot loader application getting hang.

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

After jumping from boot loader application getting hang.

890 Views
sreevalsan_p
Contributor I

I am working on a CAN based bootloader for MPC 5748G. 

I am referring the application note AN5319 (Which is for serial boot loader).

I was able to download the application software in to the flash at address 0x01040000. My Boot loader application is placed at address 0x1000000. I used the jump method listed in application note.

asm("e_lis r12,0x104");
asm("e_or2i r12,0x1A20");
asm("mtlr r0");
asm("se_blrl");

the jump address is taken from the reset vector which is inside the BAF boot header (0xF94000).

The issue is that , i was able to jump to the __start() section of application. But it is getting hangs in between and the application fails. after this the MCU will not respond to any brake command.

I am using Lauterbach debugger and trace 32 for debugging. Find the attached ld files for application and boot loader.

Thanks in advance for any support.

Application Linker file:

pastedImage_3.png

Boot loader Linker file:

pastedImage_4.png

0 Kudos
3 Replies

745 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

because you use inline assembler, you do not jump to the application right after reset in startup file, right? In this case, have you disabled all interrupts? It's also good practice to configure everything back to default state. Or the application must be aware that not everything is in default state. If it is not done in this way, it usually causes troubles like described.

Regards,

Lukas

0 Kudos

745 Views
sreevalsan_p
Contributor I

Thanks Lukas,

Finally i am able to run the application after jumping from bootloader.

I has to edit the startup script of application. the flash start address in the SMPU register has modified and it works now.

But i don't know why ?.

Following are the address which was there by default.

/******************************************************************/
/* Freescale Guidance 4 - SMPU */
/******************************************************************/
/* Configure Flash region */
SMPU_0.RGD[0].WORD0.R = 0x00400000; /* Start Address */
/* change to 0x0040_0000 (UTEST, BAF, DataFlash) */
SMPU_0.RGD[0].WORD1.R = 0x02000000; /* End Address */

-------

-------

/* Configure Flash region */
SMPU_1.RGD[0].WORD0.R = 0x00400000; /* Start Address */
/* change to 0x0040_0000 (UTEST, BAF, DataFlash) */
SMPU_1.RGD[0].WORD1.R = 0x02000000; /* End Address */

------

------

I changed to

SMPU_0.RGD[0].WORD0.R = 0x00FC0000 ; /* Start Address */    // Old was  0x00400000

SMPU_0.RGD[0].WORD1.R = 0x0157FFFF ;  /* End Address */    // Old was   0x02000000

----

SMPU_1.RGD[0].WORD0.R = 0x00FC0000 ; /* Start Address */    // Old was  0x00400000

SMPU_1.RGD[0].WORD1.R = 0x0157FFFF ;  /* End Address */    // Old was   0x02000000

 

what is the relevance of SMPU register configuration.

0 Kudos

745 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

where does this code come from? If you use SMPU, you should know why it is used and how to configure it.

Generally, SMPU is used to protect memory resources against unintentional access. Different tasks can have different access rights. Important point is that if SMPU is enabled, all memory resources must be covered by SMPU descriptors. If you access memory which is not covered, it leads to bus error (machine check exception).

Regards,

Lukas

0 Kudos