KEA128 bootloader:How to jump to user applicaiton

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

KEA128 bootloader:How to jump to user applicaiton

Jump to solution
2,893 Views
jason_zhang
Contributor III

Hi,

My bootloader cannot jump to user applicaiton.

 

1.The user applicaiton can work well when I flash to board derectly by Multilink.

    Pls refer to KEA128_APP_3.zip.

 

2. I flash the KEA128_APP_3 S19 by my bootloader , when the flashing complete,

    I use the code below to jump to user app, but it was failed.

    It always gose back to 

   void __thumb_startup(void)  // Setup registers

    __init_registers();

 

           typedef void(*JumpToPtr)(void);

           unsigned long int *pNewAppEntry = 0x4004;

          JumpToPtr pJumpTo;

 

           if(updata_end_flag)

          {                              

               EnterCritical();           /* Disable interrupts */         

               pJumpTo = *pNewAppEntry;

               pJumpTo();

               for(;;);

           }

3. I have checked the memory by Codewarrior 10.6 in the debug mode, it was ok.

    Pls refer to memory.s19 which export by codewarror.

 

4. When the flah programming was complete, the disassembly code is as below,

    How to check the monitor PC ?

               267               pJumpTo = *pNewAppEntry;

0000121e:   ldr r3,[pc,#68]

00001220:   ldr r3,[r3,#0]

00001222:   ldr r3,[r3,#0]

00001224:   mov r2,r3

00001226:   ldr r3,[pc,#64]

00001228:   str r2,[r3,#0]

268               pJumpTo();

0000122a:   ldr r3,[pc,#60]

0000122c:   ldr r3,[r3,#0]

0000122e:   blx r3

 

Thank you very much!

Original Attachment has been moved to: memory.s19.zip

Original Attachment has been moved to: KEA128_APP_3.zip

0 Kudos
Reply
1 Solution
1,584 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Jason,

    I already check your attachment, it is just the application sample code, it is correct, and already modify the m_interrupts and m_text address in the link file.

    What the CAN bus bootloader code you are using now? Write by yourself?

  Actually, we have the KEA128 canbootloader sample code and the document for your reference, please find it from the attachment.

  The attached DemoCAN_tool is the according PC software.

Wish it helps you!

If you still have question, please let me know!


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
10 Replies
1,584 Views
jason_zhang
Contributor III

Hi Jingjing

Finally my bootloader woks.

The reason is that I used the timer and wdog in my bootloader.

But is not used in KEA128_APP_3.

It woks when  I  disable the timer and wdog before jump to app.

I appriated  for your help.

Jason

0 Kudos
Reply
1,584 Views
jason_zhang
Contributor III

Hi Jingjing

The demo you sent to me works well.

I'll check the difference between demo code and my code.

Thanks.

Jason

0 Kudos
Reply
1,584 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Jason,

  That's very good, you can copy the code which I give you to your project.


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply
1,584 Views
jason_zhang
Contributor III

Hi Jingjing

Thank you ,I'll try to migration the code.

Could you find any problem when jump to app by the disassembly code below.

uint32_t *pNewAppEntry = 0x4004;

JumpToPtr pJumpTo;

typedef void(*JumpToPtr)(void);

My code:

0 Kudos
Reply
1,584 Views
jason_zhang
Contributor III

Hi Jingjing

PC software is also dedicated soft.

As I sent before, I have checked the MCU memory that the board had successfuly got the s19 data and

flashed into the memory. Refer to KEA128_APP_3.zip's S19 file, the memory data is the same.

--------------------------------------------------------------------------------------------------------------------

3. I have checked the memory by Codewarrior 10.6 in the debug mode, it was ok.

    Pls refer to memory.s19 which export by codewarror.

--------------------------------------------------------------------------------------------------------------------

I'll compare  the soft which you sent to me.

By the way, how could I send private mail to you?

Thank you .

Jason

0 Kudos
Reply
1,584 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Jason,

    Could you tell me which bootloader you are using? UART?

    About the bootloader code, you can refer to our KE application note AN4767:

http://cache.nxp.com/files/32bit/doc/app_note/AN4767.pdf?fsrch=1&sr=1&pageNum=1

  The sample code is:

http://cache.nxp.com/files/32bit/doc/app_note/AN4767SW.zip

  Please refer to the sample code, and check your jump to the app code at first.

If you still have question, please contact with me!


Have a great day,

Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply
1,584 Views
jason_zhang
Contributor III

Hi Jingjing

My bootloader is by CAN BUS.

I also changed the jumping code below refer to AN4767SW,but it did not work.

It is the same as before.

          if(updata_end_flag)

         {       

          EnterCritical();

        

          SCB_VTOR = 0x4000;//RELOCATION_VERTOR_ADDR;                                      

          JumpToUserApplication(0x4000);

         

          // pJumpTo = *pNewAppEntry;

          // pJumpTo();

            for(;;);

           }

Have you checked the file which I have attached?

Any problem?

Thank you!

0 Kudos
Reply
1,585 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Jason,

    I already check your attachment, it is just the application sample code, it is correct, and already modify the m_interrupts and m_text address in the link file.

    What the CAN bus bootloader code you are using now? Write by yourself?

  Actually, we have the KEA128 canbootloader sample code and the document for your reference, please find it from the attachment.

  The attached DemoCAN_tool is the according PC software.

Wish it helps you!

If you still have question, please let me know!


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply
1,584 Views
jason_zhang
Contributor III

Hi Jingjing

I appreciate for your instant reply.

I did the bootloader by myself.

Can I send my code to you for help? (Only for you)

Thank you!

Jason

0 Kudos
Reply
1,584 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Jason

    Of course, you can send your project to me!

    Now how do you send your app.s19 to your bootloader board? With which PC software, also write by yourself?

When you send your .s19 file, whether your bootloader can receive it successfully? Please check it at first.

    Besides,  please also check the KEA CAN bootloader code which I give you at the same time, this is the correct project and already test by our FAE.


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply