problem of MPC5746R Bootloader jump to APP

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

problem of MPC5746R Bootloader jump to APP

Jump to solution
1,528 Views
flyskyr丶
Contributor III

configration: 

bootloader:

pastedImage_3.png

APP:

pastedImage_8.png

My jumping code :

__asm__("e_lis %r12,0x0100");
__asm__("e_or2i %r12,0x0000"); //JUMP_ADDRESS
__asm__("mtlr %r12");
__asm__("se_blrl");

After debug, I found correct address was loaded in LR executing "mtlr %r12".(referance debug picture). But it's not runing step by step with instruction after executing "se_blrl". When I stop it, it jump to a error address(referance stop picture).

debug:

pastedImage_1.png

stop:

pastedImage_2.png

.......................

So I change the code  :

__asm__("e_lis %r12,0x0100");
__asm__("e_or2i %r12,0x0000"); //JUMP_ADDRESS
__asm__("mtlr %r12");
__asm__("se_blr");

It can jump to correct address,also can go ahead step by step. But when running ,also not good. Stop in 0x10;.....

So,I want to know the different of "se_blrl" with "se_blr". And how to jump to APP correctly.

Thanks~

0 Kudos
1 Solution
1,149 Views
petervlna
NXP TechSupport
NXP TechSupport

Hi,

here is the description of both blr and lbrl

pastedImage_1.png

and here is example of blr:

pastedImage_2.png

pastedImage_3.png

and lbrl: -> on branch update linker with next address for easier return.

pastedImage_5.png

pastedImage_4.png

But, all this is clear from VLE programming reference manual which is available on our web page:

https://www.nxp.com/docs/en/reference-manual/VLEPEM.pdf 

hope it is clear now :smileyhappy:

Peter

View solution in original post

7 Replies
1,150 Views
petervlna
NXP TechSupport
NXP TechSupport

Hi,

here is the description of both blr and lbrl

pastedImage_1.png

and here is example of blr:

pastedImage_2.png

pastedImage_3.png

and lbrl: -> on branch update linker with next address for easier return.

pastedImage_5.png

pastedImage_4.png

But, all this is clear from VLE programming reference manual which is available on our web page:

https://www.nxp.com/docs/en/reference-manual/VLEPEM.pdf 

hope it is clear now :smileyhappy:

Peter

1,149 Views
flyskyr丶
Contributor III

Hi , Peter.

Thanks for your reply !

I know the difference through your answer. But there is still a question you didn't answer.

pastedImage_1.png

When My program jump to APP start address, both of these invocation methods do not work. My application can't run correctly...

So , I also want to know how to jump to APP and run it correctly . Thank you !

0 Kudos
1,150 Views
petervlna
NXP TechSupport
NXP TechSupport

Hi,

On my above 4 screenshots from Lauterbach debugger I have shown you how to jump to any address (application core) with blrl or blr.

I was in intention that it is clear when I present on on screen loading of jump address 0x10000000 to link register via R12 and executing branch. On the next screen you can see the debugger pointer on address 0x10000000 which means I have successfully jumped on address in link register.

Could you specify what confuse you?

Peter

0 Kudos
1,150 Views
flyskyr丶
Contributor III

Hi Peter.

   Thanks for your reply !

   I have already seen the screenshot.My program is also able to jump to this address.

   I am puzzled that the program does not run at full speed after the jump.My application can run alone, but it can't run after a jump by BootLoader.This is where I am wondering.

     Does the program need to do something else before jumping?

   Thank you !

Lei

0 Kudos
1,150 Views
petervlna
NXP TechSupport
NXP TechSupport

As you do not share any information how is your bootloader and applicaiton configured, its hard to judge.

Description of issue like : It can run alone but cant run with bootloader is not really helping here.

It can be anything from watchdog, to clocks, uninitialized memory, incorrect code, etc...

Does the program need to do something else before jumping?

Sure, depending on project requirements.

So original issue is solved. the jump from bootloader to application.

Now you have to tell me what is wrong with application. Does it crash, stops, IVOR is called, reset?

Peter

0 Kudos
1,150 Views
flyskyr丶
Contributor III

Hi peter.

Now , It's fine~

Because of my bootloader using RT interrupt and it'snot disable before jumping.

Thanks for your help!

0 Kudos
1,150 Views
flyskyr丶
Contributor III

Hi Peter.

My two .ld file of configuration is display in fist question. And my application use many modules, so I test another simple one,just using CAN and PIT module. It's not work also.

Application file is in the attachment of first question, you can test it and I will also explain it. The Bootloader just use CAN,PIT interrupt, DSPI.

I'm using S32DS V1.2. I change the chonfiguration to protect the flash area of APP in bootloader project.

OK. Now I begin to test~

Run bootloader and suspend before jump operation:

Then using "Stepping Mode", will see the asm clearly.

Jump to APP:

And I can click the "Step Over" to run the program step by step in "Stepping Mode" now.

Then I set a breakpoint in the address of 0x010000ba. But when I click the "Resume" , the program will go and not stopped.

So,I click "Suspend" button. It goes into IVOR1_Vector();

  I don't know what caused this, please help analyze it.

Thank you!

Lei

0 Kudos