From a4c692bd419ab41c932df9999cbc011994182a6c Mon Sep 17 00:00:00 2001 From: Veijo Pesonen Date: Mon, 11 May 2020 16:31:10 +0300 Subject: [PATCH] Fix VTOR bug when using bootloader on STM32WB The address of the vector table is hardcoded to the start of flash in many, if not all, ST targets. This causes a crash in applications that are using a bootloader. This patch updates the board STM32WB55 so it properly handle updating the VTOR with a bootloader. Solution has been copied from the PR #3798. --- .../TARGET_STM/TARGET_STM32WB/STM32Cube_FW/system_stm32wbxx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/targets/TARGET_STM/TARGET_STM32WB/STM32Cube_FW/system_stm32wbxx.c b/targets/TARGET_STM/TARGET_STM32WB/STM32Cube_FW/system_stm32wbxx.c index 7594093689..f79f7cbe29 100644 --- a/targets/TARGET_STM/TARGET_STM32WB/STM32Cube_FW/system_stm32wbxx.c +++ b/targets/TARGET_STM/TARGET_STM32WB/STM32Cube_FW/system_stm32wbxx.c @@ -196,7 +196,8 @@ void SystemInit(void) /* program in SRAMx */ SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAMx for CPU1 */ #else /* program in FLASH */ - SCB->VTOR = VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */ +#include "nvic_addr.h" // MBED + SCB->VTOR = NVIC_FLASH_VECTOR_ADDRESS; // MBED #endif /* FPU settings ------------------------------------------------------------*/