I'm often working with bootloaders and one of the current shortcomings is that there's no automatic copy of the vectors table.
I'm currently using a copy loop in __early_init as a workaround.
Code: Select all
const uint32_t * tp = __vectors_load__;
uint32_t * const _vectors_dtcm = (uint32_t*)0x20000000;
uint32_t *p = _vectors_dtcm;
uint32_t *end = p + 0x2a0;
/* Copying initialization data.*/
while (p < end) {
*p = *tp;
p++;
tp++;
}
// Update vectors table address to start of DTCM
SCB->VTOR = (uint32_t)_vectors_dtcm;
This would be very practical when using RAM or even for the performance boost (TCM vs flash).