Ability to copy vectors table from CRT0

Use this forum for requesting small changes in ChibiOS. Large changes should be discussed in the development forum. This forum is NOT for support.
mobyfab
Posts: 483
Joined: Sat Nov 19, 2011 6:47 pm
Location: Le Mans, France
Has thanked: 21 times
Been thanked: 30 times

Ability to copy vectors table from CRT0

Postby mobyfab » Tue Feb 09, 2021 1:31 am

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

mck1117
Posts: 28
Joined: Wed Nov 11, 2020 6:41 am
Has thanked: 1 time
Been thanked: 5 times

Re: Ability to copy vectors table from CRT0

Postby mck1117 » Tue Feb 16, 2021 3:29 am

I've always done the copy in the bootloader before the jump.


Return to “Small Change Requests”

Who is online

Users browsing this forum: No registered users and 3 guests