diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2016-06-26 18:30:32 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2016-06-26 18:30:32 +0000 |
commit | 12c3d9e4169cb5f27fdf1027c306821742029121 (patch) | |
tree | b3d81767c43c00009fef118841343faa25154f9a /os/common/startup | |
parent | e8f9eaea0d383b65e500061957850b8dc391f8a3 (diff) | |
download | ChibiOS-12c3d9e4169cb5f27fdf1027c306821742029121.tar.gz ChibiOS-12c3d9e4169cb5f27fdf1027c306821742029121.tar.bz2 ChibiOS-12c3d9e4169cb5f27fdf1027c306821742029121.zip |
Stack initialization workaround.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9668 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/common/startup')
-rw-r--r-- | os/common/startup/ARMCMx/compilers/GCC/crt0_v6m.S | 15 | ||||
-rw-r--r-- | os/common/startup/ARMCMx/compilers/GCC/crt0_v7m.S | 6 |
2 files changed, 21 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 643783bc8..a5053e4d5 100644 --- a/os/common/startup/ARMCMx/compilers/GCC/crt0_v6m.S +++ b/os/common/startup/ARMCMx/compilers/GCC/crt0_v6m.S @@ -46,6 +46,15 @@ /*===========================================================================*/
/**
+ * @brief Enforces initialization of MSP.
+ * @note This is required if the boot process is not reliable for whatever
+ * reason (bad ROMs, bad bootloaders, bad debuggers=.
+ */
+#if !defined(CRT0_VTOR_INIT) || defined(__DOXYGEN__)
+#define CRT0_FORCE_MSP_INIT TRUE
+#endif
+
+/**
* @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.
@@ -142,6 +151,12 @@ Reset_Handler: /* Interrupts are globally masked initially.*/
cpsid i
+#if CRT0_FORCE_MSP_INIT == TRUE
+ /* MSP stack pointers initialization.*/
+ ldr r0, =__main_stack_end__
+ msr MSP, r0
+#endif
+
/* PSP stack pointers initialization.*/
ldr r0, =__process_stack_end__
msr PSP, r0
diff --git a/os/common/startup/ARMCMx/compilers/GCC/crt0_v7m.S b/os/common/startup/ARMCMx/compilers/GCC/crt0_v7m.S index 3abfc1813..2a92768f3 100644 --- a/os/common/startup/ARMCMx/compilers/GCC/crt0_v7m.S +++ b/os/common/startup/ARMCMx/compilers/GCC/crt0_v7m.S @@ -180,6 +180,12 @@ Reset_Handler: /* Interrupts are globally masked initially.*/
cpsid i
+#if CRT0_FORCE_MSP_INIT == TRUE
+ /* MSP stack pointers initialization.*/
+ ldr r0, =__main_stack_end__
+ msr MSP, r0
+#endif
+
/* PSP stack pointers initialization.*/
ldr r0, =__process_stack_end__
msr PSP, r0
|