diff --git a/os/ports/GCC/ARMCMx/chcore_v7m.h b/os/ports/GCC/ARMCMx/chcore_v7m.h index a2427c27e..96149cae9 100644 --- a/os/ports/GCC/ARMCMx/chcore_v7m.h +++ b/os/ports/GCC/ARMCMx/chcore_v7m.h @@ -66,6 +66,13 @@ #endif #endif +/** + * @brief NVIC VTOR initialization expression. + */ +#if !defined(CORTEX_VTOR_INIT) || defined(__DOXYGEN__) +#define CORTEX_VTOR_INIT 0x00000000 +#endif + /*===========================================================================*/ /* Port derived parameters. */ /*===========================================================================*/ @@ -192,6 +199,7 @@ struct intctx { * @brief Port-related initialization code. */ #define port_init() { \ + SCB_VTOR = CORTEX_VTOR_INIT; \ SCB_AIRCR = AIRCR_VECTKEY | AIRCR_PRIGROUP(0); \ NVICSetSystemHandlerPriority(HANDLER_SVCALL, \ CORTEX_PRIORITY_MASK(CORTEX_PRIORITY_SVCALL)); \ diff --git a/os/ports/IAR/ARMCMx/chcore_v7m.h b/os/ports/IAR/ARMCMx/chcore_v7m.h index ee077749c..8ebd45bda 100644 --- a/os/ports/IAR/ARMCMx/chcore_v7m.h +++ b/os/ports/IAR/ARMCMx/chcore_v7m.h @@ -66,6 +66,13 @@ #endif #endif +/** + * @brief NVIC VTOR initialization expression. + */ +#if !defined(CORTEX_VTOR_INIT) || defined(__DOXYGEN__) +#define CORTEX_VTOR_INIT 0x00000000 +#endif + /*===========================================================================*/ /* Port derived parameters. */ /*===========================================================================*/ @@ -192,6 +199,7 @@ struct intctx { * @brief Port-related initialization code. */ #define port_init() { \ + SCB_VTOR = CORTEX_VTOR_INIT; \ SCB_AIRCR = AIRCR_VECTKEY | AIRCR_PRIGROUP(0); \ NVICSetSystemHandlerPriority(HANDLER_SVCALL, \ CORTEX_PRIORITY_MASK(CORTEX_PRIORITY_SVCALL)); \ diff --git a/os/ports/RVCT/ARMCMx/chcore_v7m.h b/os/ports/RVCT/ARMCMx/chcore_v7m.h index ef04fa15e..b4181d517 100644 --- a/os/ports/RVCT/ARMCMx/chcore_v7m.h +++ b/os/ports/RVCT/ARMCMx/chcore_v7m.h @@ -66,6 +66,13 @@ #endif #endif +/** + * @brief NVIC VTOR initialization expression. + */ +#if !defined(CORTEX_VTOR_INIT) || defined(__DOXYGEN__) +#define CORTEX_VTOR_INIT 0x00000000 +#endif + /*===========================================================================*/ /* Port derived parameters. */ /*===========================================================================*/ @@ -192,6 +199,7 @@ struct intctx { * @brief Port-related initialization code. */ #define port_init() { \ + SCB_VTOR = CORTEX_VTOR_INIT; \ SCB_AIRCR = AIRCR_VECTKEY | AIRCR_PRIGROUP(0); \ NVICSetSystemHandlerPriority(HANDLER_SVCALL, \ CORTEX_PRIORITY_MASK(CORTEX_PRIORITY_SVCALL)); \ diff --git a/readme.txt b/readme.txt index 3adb886b9..1c1bc7808 100644 --- a/readme.txt +++ b/readme.txt @@ -84,6 +84,9 @@ (backported to 2.2.8). - FIX: Fixed broken TIM8 support in STM32 PWM driver (bug 3418620). - FIX: Fixed halconf.h file corrupted in some STM32 demos (bug 3418626). +- NEW: Added initialization of the NVIC VTOR register to all Cortex-Mx (v7M) + ports. Also added a port option CORTEX_VTOR_INIT to enforce a different + default value into the register. - NEW: Removed the warning about the "untested M4 platform", now it is tested and officially supported. - NEW: Reorganized the STM32F1xx hal_lld_xxx.h files in order to distribute