Page 1 of 1

Ability to copy vectors table from CRT0

Posted: Tue Feb 09, 2021 1:31 am
by mobyfab
Hi,

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).

Re: Ability to copy vectors table from CRT0

Posted: Tue Feb 16, 2021 3:29 am
by mck1117
I've always done the copy in the bootloader before the jump.