Kinetis relocated vector table program counter

cancel
Showing results for 
Search instead for 
Did you mean: 

Kinetis relocated vector table program counter

Jump to solution
511 Views
ZdenoQC
Contributor III

Hi there,

I'm using a TRK-KEA128 evalboard and I have made a bootloader. Usually on S08/S12 family of microcontroller, I use the reset vector to start my application since this vector is not redirected. I was planning to do the same with the program counter with the Kinetis, but I don't know if a reset will cause the micro to restart directly at the application instead of the bootloader.

Ex:

Boot vector table

/* Interrupt vector table */

__attribute__ ((section (".isr_vector_boot"))) const tVectorTable __vect_table =

{ (uint32_t *) 0x1FFFF400,           // 0x00 0x00000000 -  Initial Stack Pointer

        {

        //        ISR name                         num    address     source

                (typ_ISRfunc) EntryPoint_Boot, // 0x01 0x00000004 -  Initial Program Counter

...

Appl vector table

/* Interrupt vector table */

__attribute__ ((section (".isr_vector_appl"))) const tVectorTable __vect_table =

{ (uint32_t *) 0x1FFFF400,           // 0x00 0x00004000 -  Initial Stack Pointer

        {

        //        ISR name                         num    address     source

                (typ_ISRfunc) EntryPoint_Appl, // 0x01 0x00004004 -  Initial Program Counter

...

I will than jump to address written in 0x00004004 when in boot to go to the application and than redirect the vector table.

My question, if I do that, when a reset occur, do the micro will restart in the boot or the appl?

Thanks

Labels (1)
1 Solution
143 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello William Deshaies:

After reset the KEA MCU always takes the entry point from flash address 0x00000004. For your case, after reset the MCU would always jump to EntryPoint_Boot and in the code there could be a decision to stay in bootloader or jump immediately to the application (e.g. by reading an external button).

In the startup of the application make sure to update the SCB_VTOR register to point to the application's vector table.

I hope this helps!


Regards!,
Jorge Gonzalez

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

View solution in original post

2 Replies
144 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello William Deshaies:

After reset the KEA MCU always takes the entry point from flash address 0x00000004. For your case, after reset the MCU would always jump to EntryPoint_Boot and in the code there could be a decision to stay in bootloader or jump immediately to the application (e.g. by reading an external button).

In the startup of the application make sure to update the SCB_VTOR register to point to the application's vector table.

I hope this helps!


Regards!,
Jorge Gonzalez

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

View solution in original post

143 Views
vignesh_vb_7
Contributor IV

Hi,

    How do i do that In the startup of the application to update the SCB_VTOR,  Can you give me a code snipet for this?

And if you can give an example code for blinky with changed linker file to be flashed with bootloader, it will be great?

0 Kudos