AnsweredAssumed Answered

vector table relocation VTOR

Question asked by Peter Lissenburg on Jun 29, 2016
Latest reply on Jun 30, 2016 by Peter Lissenburg
Hi there,
I'm implementing a bootloader. And have created an application vector table that is different to the bootloader vector table
Boot Vectors at 0x08000000
App Vectors  at 0x08010400

volatile const void (*vectortable[71])(void)={
  (const void*)0x20010000, // just something, won't be used except as a place holder
  (const void*)0x08010179, // just something, won't be used except as a place holder
  (const void*)NMI_Handler               ,
  (const void*)HardFault_Handler         ,

After the boot loader has done it's CRC/check_for_update/etc
And before I jump to the application start I need to relocate or rather redirect the processor to the application vector table at 0x08010400
SBC->VTOR = 0x08010400;
This seems to be OK, bit 29 is clear, the least significant 9 bits are clear and the offset from 0x00 AKA 0x08000000 is 0x00010400 (Have tried both 0x08010400 and 0x00010400)
My understanding, (which I hope is wrong in some way) is that upon reset the CPU will get the vector from the 0x08000004 location and start up. Then I change the vector location to be 0x08010400 and all other interrupt vectors 0x08010408 etc, are fetched from there. Until the next reset where is starts all afresh again.
However, it's not happening!
I can see the vectors at both 0x08000000 and 0x08010400. I can see the SBC->VTOR contains either 0x00000000 or 0x08000000 (makes no difference, both work fine) and then it is changed to 0x08010400 and no interrupts are fetched. I can manually (Using debugger) change the VTOR back to the 0x08000000 vector set and it all starts/continues OK.
I do admit to being very confused by the statement;
"you must align the offset to the number of exception entries in the vector
table. The minimum alignment is 128 words". It does not seem to fit into my concept of how it all works.
Could someone point me in the right direction?
Many thanks.
Pete L.