7 // symbol from picolibc stored in flash memory
9 extern const void *__interrupt_vector[];
11 // Reference manual for STM32F411xC/E
14 // The full vector table takes 0x198=408 bytes, with each entry requiring four
17 // Arm®v7-M Architecture Reference Manual
20 // The Vector table must be naturally aligned to a power of two whose alignment
21 // value is greater than or equal to (Number of Exceptions supported x 4), with
22 // a minimum alignment of 128 bytes.
25 void (*sram_vectors[408/4])(void)
26 __attribute__((aligned(512)));
28 void NVIC_Relocate_VTOR(void)
30 // sanity-check that the memory alignment is such that no bits of the
31 // address fall outside the VTOR register's bector table base offset field
33 // assert( 0U == (((uintptr_t)sram_vectors) & ~SCB_VTOR_TBLOFF_Msk) );
35 // picolibc arm/interrupt.c assigns vectors up through systick (0x40
36 // bytes), which we'll relocate to the new sram location
37 memcpy(sram_vectors, __interrupt_vector, 0x40);
38 __DSB(); // ensure all memory is written before pointing VTOR at it
39 SCB->VTOR = (uintptr_t)sram_vectors;