KEA128 UART Bootloader

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

KEA128 UART Bootloader

1,835 Views
batts
Contributor I

I've found a few posts on a UART bootloader for the KEA128, they're all old posts though so I'd like to know what the best approach today would be.

  1. What I've gathered is I could port the example UART bootloader for E series (AN4767).
  2. There's also KBOOT, though I don't think there's support for the KEA128. 
  3. There's OpenSDA, but I'm not sure if that provides a UART bootloader over a COM port.

Are there other options? What's the best approach?

Thanks

Tags (2)
0 Kudos
8 Replies

1,143 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi batts,

    Of course, you can use the opensda COM port.

   I don't know what the IDE you are using, I porting a UART bootloader for TRK-KEA128 with MDK IDE, and it compatible with out KBOOT2.0, you can use the kinetisFlashTool to download the application code directly.

   Now, I attached my project for your reference.

  In the future, I will also port it to KDS and IAR project, and will share it in the community.

Wish it helps you!


Have a great day,
Kerry

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

0 Kudos

1,143 Views
batts
Contributor I

Hi Kerry, 

Thanks, that's very helpful. I've decided to write the bootloader, using yours as a reference. I'm having trouble understanding how to manage the vector tables. Could you please explain your approach?

Here's my understanding, the vector tables location is determined by hardware. While the bootloader is running I need it's vector table active, though when the device is flashed and the app is running, I'd like to redirect the vector table to the applications vector table. 

Cheers,

Sam

0 Kudos

1,143 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Batts,

   Please check this code at first:

pastedImage_1.png

If the application code is downloaded,  then the vector will relocate to the application address, and run the application code.


Have a great day,
Kerry

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

0 Kudos

1,143 Views
batts
Contributor I

Hi Kerry, 

Thanks, I see there you are reading the application vector table, retrieving the stack pointer and the program counter, though how does the hardware know the vector table has moved? This would work for applications that don't use interrupts, though interrupts would still fire in the bootloader code. 

I've read you can use the VTOR register (vector table redirection register), this is what I've tried but it's not working:

SCB->VTOR = APPLICATION_FLASH_START_ADDR;

I also tried

SCB->VTOR = (APPLICATION_FLASH_START_ADDR << SCB_VTOR_TBLOFF_Pos);

Any help is appreciated,

Thanks

0 Kudos

1,143 Views
batts
Contributor I

Hi Kerry, 

To be more specific, I can enter the target application though it quickly exits and gets caught in the "DefaultISR", my guess is that's due to the hardware pointing to the wrong vector table. Though I haven't solved it yet, so I'm not 100% sure. 

Cheers

0 Kudos

1,143 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi batts,

   Do you do the application code vector relocate? This is very important.

   As you know, in the bootloader, I define the application code in 0x2000UL, so you need to relocate your application code and vector to 0x2000.

   If you enable the interrupt in your application code, and after enter application code, you get defaultISR, it seems your app can't find the detail vector ISR, please check the application relocation at first.

  Any updated question, just let me know!


Have a great day,
Kerry

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

0 Kudos

1,143 Views
batts
Contributor I

Hi Kerry, thanks. 

Turns out I was managing the vector table redirection correctly. The issue was my bootloader uses interrupts and I wasn't disabling them before entering the app code, so when my app entered it was calling a UART interrupts, and no handler was defined so it called the defaultISR continuously (because the UART interrupt flag wasn't being cleared).

Thanks for your help. 

0 Kudos

1,143 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi batts,

   Thanks for your updated information.

    From your description, it should disables the bootloader interrupt before enter the application code.

    Thank you for your conclusion.


Have a great day,
Kerry

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

0 Kudos