NVIC_SetVector resets the VTOR register

21 Aug 2012


Is some one seen this problem. I am relocating the vector table to 0x2007C000. I dump VTOR contenets it is 0x2007C000 After that I call NVIC_SetVector(TIMER0_IRQn, (uint32_t)&flip1);

now if I check VTOR register it is pointing to 0x10000000

Do anyone know why?

Regards, Shankar

21 Aug 2012

Hi shanker,

0x10... is our default location for dynamic vectors, and if you use SetVector then it ensure the switch/copy to dynamic vectors has been made, and forces it if not.

Just so happens the logic checks it is in the new ram location, not that it is not in the old flash location (of which implementation choice didn't mater given we only support those two locations). However, if we flipped that check (ie check not at flash location) then your manual manipulation of VTOR would be kept intact and give you your expected behaviour, so seems like a better choice.

We'll get that changed.

Thanks, Simon

21 Aug 2012

Thanks Simon,

Meanwhile I am trying to test the vector relocation thats when I found this issue. Will the following code works once you change the code? and when can I get the changed binary?

SCB->VTOR = (uint32_t)(&vectors2);

And after that line all my interrupts are only in new table and run from there?

Regards, Shankar