Potentially wrong initial value of SCB->VTOR
Good day,
after troubleshooting some issues related to a bootloader, I have figured out that the address of the interrupt vector table (SCB->VTOR) is defined in a hard-coded, non linker aware way as "SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET". This means, if the FLASH region is relocated to make space for a bootloader, it requires manual changes to "VECT_TAB_OFFSET".
Is there any reason, why we don't use the address of "g_pfnVectors" (the actual vector table) instead? This would always point to the vector table as defined in the startup code.
Of course, I can simply add "SCB->VTOR = (uint32_t)&g_pfnVectors;" to the start of the main(), but I'm trying to understand, why the default value is hard-coded instead of using the actual table location.
Can someone explain that to me?
CubeMX Version: 6.12.0
Controller: STM32C031K6Tx
Also on STM32G431 with an older CubeMX version
