Relocating Vector Table to AXISRAM in STM32H743
Hi,
I am using the Nucleo-H743ZI development board and trying to make an Interrupt driver for it. The driver has to support changing the vector table contents at runtime. So I made a copy of the vector table in the AXI SRAM at its first address (0x24000000)typedef void(*voidPFn_t)(void);
static volatile voidPFn_t newVectorTable[_VECTOR_TABLE_SIZE] __attribute__ ((section('.sram_d1')));
void interruptInit() {
volatile voidPFn_t* origVectorTable = (voidPFn_t*) SCB->VTOR;
// copy the content of the original vector table into the new vector table
for(uint32_t i = 0; i < _VECTOR_TABLE_SIZE; i++)
newVectorTable[i] = origVectorTable[i];
// install the new interrupt vector table
SCB->VTOR = ((uint32_t) &newVectorTable);
}
I succeeded to copy the content of the original vector table and I could see that through the memory window of my IDE. Also I set the VTOR register to 0x24000000 and modified my new vector table correctly.
But the problem is when I fire an interrupt in my test example the cpu goes to execute the interrupt handler of the original vector table not my new vector table. I don't know why that happens.
#interrupt #stm32h743 #nucleo-h743zi #stm32h7 #vector-table #axi-sram