stm32/mboot: Set VTOR on start up to ensure it has the correct value.
Commit 8675858465
switched to using the CMSIS
provided SystemInit function which sets VTOR to 0x00000000 (previously it
was 0x08000000). A VTOR of 0x00000000 will be correct on some MCUs but not
on others where the built-in bootloader is remapped to this address, via
__HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH().
To make sure mboot has the correct vector table, this commit explicitly
sets VTOR to the correct value of 0x08000000.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
13ad1a4f06
commit
81a7293ed6
|
@ -1285,6 +1285,9 @@ void stm32_main(int initial_r0) {
|
||||||
RCC->D3CCIPR = 0x00000000;
|
RCC->D3CCIPR = 0x00000000;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Make sure IRQ vector table points to flash where this bootloader lives.
|
||||||
|
SCB->VTOR = FLASH_BASE;
|
||||||
|
|
||||||
// Enable 8-byte stack alignment for IRQ handlers, in accord with EABI
|
// Enable 8-byte stack alignment for IRQ handlers, in accord with EABI
|
||||||
SCB->CCR |= SCB_CCR_STKALIGN_Msk;
|
SCB->CCR |= SCB_CCR_STKALIGN_Msk;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue