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
Solved! Go to Solution.
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!
-----------------------------------------------------------------------------------------------------------------------
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!
-----------------------------------------------------------------------------------------------------------------------
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?