aboutsummaryrefslogtreecommitdiffstats
path: root/os/common/startup/ARMCMx/compilers/GCC/crt0_v6m.S
diff options
context:
space:
mode:
Diffstat (limited to 'os/common/startup/ARMCMx/compilers/GCC/crt0_v6m.S')
-rw-r--r--os/common/startup/ARMCMx/compilers/GCC/crt0_v6m.S17
1 files changed, 17 insertions, 0 deletions
diff --git a/os/common/startup/ARMCMx/compilers/GCC/crt0_v6m.S b/os/common/startup/ARMCMx/compilers/GCC/crt0_v6m.S
index b313b611a..643783bc8 100644
--- a/os/common/startup/ARMCMx/compilers/GCC/crt0_v6m.S
+++ b/os/common/startup/ARMCMx/compilers/GCC/crt0_v6m.S
@@ -39,11 +39,22 @@
#define CONTROL_USE_MSP 0
#define CONTROL_USE_PSP 2
+#define SCB_VTOR 0xE000ED08
+
/*===========================================================================*/
/* Module pre-compile time settings. */
/*===========================================================================*/
/**
+ * @brief VTOR special register initialization.
+ * @details VTOR is initialized to point to the vectors table.
+ * @note This option can only be enabled on Cortex-M0+ cores.
+ */
+#if !defined(CRT0_VTOR_INIT) || defined(__DOXYGEN__)
+#define CRT0_VTOR_INIT FALSE
+#endif
+
+/**
* @brief Control special register initialization value.
* @details The system is setup to run in privileged mode using the PSP
* stack (dual stack mode).
@@ -140,6 +151,12 @@ Reset_Handler:
msr CONTROL, r0
isb
+#if CRT0_VTOR_INIT == TRUE
+ ldr r0, =_vectors
+ ldr r1, =SCB_VTOR
+ str r0, [r1]
+#endif
+
#if CRT0_INIT_CORE == TRUE
/* Core initialization.*/
bl __core_init