Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to relocate vector table and change starting addressin cortexm3 using uvision(Keil)?

I'm using a STM32F107 cortex m3 microcontroller. I'm using the Keil uvision IDE for the project. I have an application which is running properly at the starting location i.e 0x0800 0000. If I change the starting location to 0x0800 4000 the application is not working properly. I made changes to the vector table location using this function as such:

NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x8004000)

i.e changed SCB->VTOR = 0x8004000 to this location.

But even after doing this interrupt is not happening. Should I do anything more to make this project work?

like image 880
suraj Avatar asked Feb 07 '13 12:02

suraj


People also ask

How do I move a vector table?

This is a three-step process that involves: Setting the starting address of your program (in the startup file), Setting the offset for interrupt vectors (using a compiler directive), and Setting the address range for program code (using a linker directive).

What is VTOR?

Vector Table Offset Register. The VTOR indicates the offset of the vector table base address from memory address 0x00000000 . See System control block registers summary for the VTOR attributes. In an implementation with the Security Extension, this register is not banked between Security states.

How many exceptions does the Cortex M4 processor have?

Exception numbers 1 to 15 are classified as system exceptions, and exceptions 16 and above are for interrupts. The design of the NVIC in the Cortex-M3 and Cortex-M4 processors can support up to 240 interrupt inputs.


1 Answers

You should not use NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x8004000), use NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x4000). The second argument is the "offset", not the absolute address.

like image 118
Grissiom Avatar answered Dec 20 '22 22:12

Grissiom