cancel
Showing results for 
Search instead for 
Did you mean: 

Relocating Vector Table to AXISRAM in STM32H743

Ahmed Elzoughby
Associate II
Posted on June 24, 2018 at 13:03

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
12 REPLIES 12
Posted on June 29, 2018 at 03:18

Ok, so having cycled the power on the STM32H743I-EVAL, changing the RAM at 0x24000000, resulted in the failure of SCB_InvalidateDCache_by_Addr() to achieve the goal, and the SysTick vectors off to some to some random junk.

SCB_InvalidateDCache_by_Addr((uint32_t*)newVectorTable, VECSIZE);

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
204077CGIL4
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on June 29, 2018 at 19:18

Hi

Turvey.Clive.002

Sorry, I was too fast, I c/c the incorrect fonction, we need to use the cache clean by address. Invalidating the cache will result in losing uncommited data.

SCB_InvalidateDCache_by_Addr  -->  SCB_CleanDCache_by_Addr

Br,

Abdel