How to configure the vector table properly ?

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

How to configure the vector table properly ?

Jump to solution
1,304 Views
ganeshramachand
Contributor IV

I am designing a boot loader for MKE02z64VLD2 microcontroller in Kinetis Design Studio. I have configured the Flash Memory area as per the AN 4775 documentation (IIC Boot Loader Design on the Kinetis E series). In this document, in page number 9, I found this.

pastedImage_0.png

So I implemented the same for my boot loader.

Text and Interrupts.jpg

This is how my memory map looks like.

Bootloader Memory Map.jpg

But when I flashed this into my board using J link debugger, This message popped up. Semihosting process monitor job failed, Java.lang.IllegalThreadStateException .

After this failed flash job, I tried to debug a simple LED blink code, but it didn't get executed. It threw me these errors.

Hwtest1.jpg

When I inquired about my issues to experts in this field, they said I have not configure Vector Table properly, they said

Your vector table for the bootloader (at 0x00000000) is different from the application vector table. You need to set the VTOR to point to the application vector table.

Since I am an yet to be graduated Electronics Engineering student with NULL experience in Kinetis Controllers, Kinetis Design Studio or the Boot loader itself, I don't know how to configure VTOR properly. Can Someone help me configuring the Vector Table properly ? 

Thanks

1 Solution
933 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Ganesh,

I think maybe you have some mi@sunderstand about the bootloader code and the Application .

On the bootloder project, you needn't change the linker file and vector table , you need change the

linker file of APP project . For example , if the APP run from 0x1000, you need configure the linker file

m_interrupts area from 0x1000.

An important place is the jump code , when want to jump to the APP, please use the SCB_VTOR

point to the 0x1000.

There is a bootloader demo about KE02z64vll4, you can refer to the jump code :

pastedImage_0.png

Hope it helps


Have a great day,
Alice

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

View solution in original post

3 Replies
934 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Ganesh,

I think maybe you have some mi@sunderstand about the bootloader code and the Application .

On the bootloder project, you needn't change the linker file and vector table , you need change the

linker file of APP project . For example , if the APP run from 0x1000, you need configure the linker file

m_interrupts area from 0x1000.

An important place is the jump code , when want to jump to the APP, please use the SCB_VTOR

point to the 0x1000.

There is a bootloader demo about KE02z64vll4, you can refer to the jump code :

pastedImage_0.png

Hope it helps


Have a great day,
Alice

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

933 Views
ganeshramachand
Contributor IV

Hey Alice, in Cpu.c, there is this piece of code doubttozhang1.jpg

In your code you have used 'SCB->VTOR', whereas I have used 'startup' . Should I change the word 'startup'  to 'SCB->VTOR' in all instances of my code ??

void BL_CheckForUserApp(void) {

  uint32_t startup; /* assuming 32bit function pointers */

startup = ((uint32_t*)APP_FLASH_VECTOR_START)[1]; /* this is the reset vector */

  if (startup!=-1 && !BL_CheckBootloaderMode()) { /* Check for the presence of a valid application vector. -1 (or) 0xfffffff would mean flash erased */

    ((void(*)(void))startup)(); /* Jump to the application startup code */

#if 0

    uint32_t startup;

    *handled = TRUE;

    startup = ((uint32_t*)BL_FLASH_VECTOR_TABLE)[1];

    ((void(*)(void))startup)(); /* Jump to startup code */

#else

    KIN1_SoftwareReset();

#endif

Or is there any other way to make SCB_VTOR point to 0x1000

Thanks

Ganesh

0 Kudos
933 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Ganesh,

On my code , the SCB_VTOR is not one simple variable, it is a register Vector Table Offest Register,

you can find on the cortex-m0+ Devices Generic User Guide:

pastedImage_1.png

pastedImage_0.png

Hope it helps

ALice

0 Kudos