MPC5744P second stage bootloader

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

MPC5744P second stage bootloader

跳至解决方案
1,062 次查看
VladiKn
Contributor III

Hello,

I am trying to develop a second stage bootloader for the MPC5744P that would perform some checks and then load the actual application and start it. Is there some kind of example that shows how this could be done? Maybe someone already did something similar and can give me some hits.
Also any documentation that could help with this would be great!

Thanks in advance. Cheers!

0 项奖励
1 解答
1,008 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi Vladimir,

program counter can be accessed by means of jump instructions, not directly. There's an example in startup file of the bootloader:

...\AN5319SW.zip\MPC5748G-Serial_Bootloader-GHS614\ghs\tgt\libstartup\crt0.ppc

;if the boot header is valid, execute application
;load address of reset vector to r12
e_lis r12,0x00F9
e_or2i r12,0x4010

;load reset vector to r0
e_lwz r0,0(r12)
;move reset vector to link register
mtlr r0
;branch to address in link register
se_blrl

 

Regards,

Lukas

 

在原帖中查看解决方案

0 项奖励
4 回复数
1,044 次查看
VladiKn
Contributor III

Thank you very much for the information. I will check it out!

0 项奖励
1,047 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

we have this application note written for MPC5748G:

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

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

However, the principles are still the same, so it can be a nice starting point.

Regards,

Lukas

 

0 项奖励
1,029 次查看
VladiKn
Contributor III

Hi Lukas,

As I've seen, this application loads the new image over the serial to the flash and then restarts with the new application. In my case, I would like to have the application already on some location in the flash. Then, I would perform some checks in the bootloader and jump to the location of the application to execute it.
I had the idea just to put the address of the application into the program counter register with an assembly command but I haven't been able to find a way to access the program counter. Do you have any idea how to do that?

Cheers,
Vladimir

0 项奖励
1,009 次查看
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi Vladimir,

program counter can be accessed by means of jump instructions, not directly. There's an example in startup file of the bootloader:

...\AN5319SW.zip\MPC5748G-Serial_Bootloader-GHS614\ghs\tgt\libstartup\crt0.ppc

;if the boot header is valid, execute application
;load address of reset vector to r12
e_lis r12,0x00F9
e_or2i r12,0x4010

;load reset vector to r0
e_lwz r0,0(r12)
;move reset vector to link register
mtlr r0
;branch to address in link register
se_blrl

 

Regards,

Lukas

 

0 项奖励