How do I always start the code from the Bootloader?

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

How do I always start the code from the Bootloader?

1,101 Views
tgc-yilmaz
Contributor III

Hello,

 

I am using mpc5644a. I have two different projects: bootloader and user application. I am installing the user application with bootloader. But even if the user application is running, I want the code to start again from the bootloader every time the power is turned off and on. How can I do that?

Thank you for your help...

Labels (1)
0 Kudos
3 Replies

639 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

this is copied from the reference manual:

pastedImage_7.png

That means the RCHW of your bootloader must be at lower address than RCHW of the application. First valid RCHW is always taken.

So, if you place the bootloader at beginning of flash at 0x0 then it will be executed after each reset and then it can call the application.

Regards,

Lukas

0 Kudos

639 Views
tgc-yilmaz
Contributor III

Thank you for your answer...

So if I set the RCHW address the same in both my projects, can I not do this in the __startup () function? If I can, how can I do this, how should I change the __startup () function?

0 Kudos

639 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

you should not use the same RCHW address in both projects. Please read whole section 3 and section 4 in:

https://www.nxp.com/docs/en/application-note/AN5319.pdf 

https://www.nxp.com/docs/en/application-note-software/AN5319SW.zip 

This application note is written for MPC5748G but the principles are the same. I also shared draft of app note for MPC56xx devices but it was not finished. If you are interested:

https://community.nxp.com/servlet/JiveServlet/download/427962-1-279359/bootloader.zip

Regards,

Lukas

0 Kudos