How to move vector table and change start address in cortexm3 using uvision (Keil)?

I am using STM32F107 Cortex M3 microcontroller. I am using Keil Uvision IDE for a project. I have an application that works correctly at the starting point, that is 0x0800 0000

. If I change the start location to the 0x0800 4000

app it doesn't work as expected. I made changes to the layout of the vectors table using this function as such:

NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x8004000)

      

those. changed SCB->VTOR = 0x8004000

at this location.

But even after that, no interruption occurs. Do I have to do anything else to make this project work?

+3


source to share


3 answers


You don't have to use NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x8004000)

, use NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x4000)

. The second argument is "offset", not an absolute address.



+5


source


Add the below statement right after HAL_Init ();

SCB-> VTOR = (FLASH_BASE | 0x4000);



You also need to update the interrupt vector address in the STM32F1xc_flash.icf file as shown below.

define symbol ICFEDIT_intvec_start = 0x08004000;

0


source


I did this for my STM32L496 and it was important to set a new vector table before calling HAL_Init () because it calls HAL_MspInit () which can use SysTick to measure timeouts when setting up some peripherals.

-1


source







All Articles