aboutsummaryrefslogtreecommitdiffstats
path: root/os/common/ports/ARMCMx/compilers
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2015-08-16 08:33:01 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2015-08-16 08:33:01 +0000
commit407e5714792cf9280eeea1a60e66db69924f114c (patch)
tree842dc4fb0fa5f71f046fdb82ebcf624a0bac0f9d /os/common/ports/ARMCMx/compilers
parent83b26b4f441d78fc13737d33f1535bacb8219af5 (diff)
downloadChibiOS-407e5714792cf9280eeea1a60e66db69924f114c.tar.gz
ChibiOS-407e5714792cf9280eeea1a60e66db69924f114c.tar.bz2
ChibiOS-407e5714792cf9280eeea1a60e66db69924f114c.zip
Moved cache initialization into startup files.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8220 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/common/ports/ARMCMx/compilers')
-rw-r--r--os/common/ports/ARMCMx/compilers/GCC/crt0_v6m.s12
-rw-r--r--os/common/ports/ARMCMx/compilers/GCC/crt0_v7m.s36
-rw-r--r--os/common/ports/ARMCMx/compilers/GCC/crt1.c26
3 files changed, 59 insertions, 15 deletions
diff --git a/os/common/ports/ARMCMx/compilers/GCC/crt0_v6m.s b/os/common/ports/ARMCMx/compilers/GCC/crt0_v6m.s
index 38b4513b7..824538215 100644
--- a/os/common/ports/ARMCMx/compilers/GCC/crt0_v6m.s
+++ b/os/common/ports/ARMCMx/compilers/GCC/crt0_v6m.s
@@ -57,6 +57,13 @@
#endif
/**
+ * @brief Core initialization switch.
+ */
+#if !defined(CRT0_INIT_CORE) || defined(__DOXYGEN__)
+#define CRT0_INIT_CORE TRUE
+#endif
+
+/**
* @brief Stack segments initialization switch.
*/
#if !defined(CRT0_STACKS_FILL_PATTERN) || defined(__DOXYGEN__)
@@ -129,6 +136,11 @@ Reset_Handler:
msr CONTROL, r0
isb
+#if CRT0_INIT_CORE == TRUE
+ /* Core initialization.*/
+ bl __core_init
+#endif
+
/* Early initialization..*/
bl __early_init
diff --git a/os/common/ports/ARMCMx/compilers/GCC/crt0_v7m.s b/os/common/ports/ARMCMx/compilers/GCC/crt0_v7m.s
index fcfa4decd..029713227 100644
--- a/os/common/ports/ARMCMx/compilers/GCC/crt0_v7m.s
+++ b/os/common/ports/ARMCMx/compilers/GCC/crt0_v7m.s
@@ -55,6 +55,17 @@
/*===========================================================================*/
/**
+ * @brief FPU initialization switch.
+ */
+#if !defined(CRT0_INIT_FPU) || defined(__DOXYGEN__)
+#if defined(CORTEX_USE_FPU) || defined(__DOXYGEN__)
+#define CRT0_INIT_FPU CORTEX_USE_FPU
+#else
+#define CRT0_INIT_FPU FALSE
+#endif
+#endif
+
+/**
* @brief Control special register initialization value.
* @details The system is setup to run in privileged mode using the PSP
* stack (dual stack mode).
@@ -65,6 +76,13 @@
#endif
/**
+ * @brief Core initialization switch.
+ */
+#if !defined(CRT0_INIT_CORE) || defined(__DOXYGEN__)
+#define CRT0_INIT_CORE TRUE
+#endif
+
+/**
* @brief Stack segments initialization switch.
*/
#if !defined(CRT0_STACKS_FILL_PATTERN) || defined(__DOXYGEN__)
@@ -107,17 +125,6 @@
#endif
/**
- * @brief FPU initialization switch.
- */
-#if !defined(CRT0_INIT_FPU) || defined(__DOXYGEN__)
-#if defined(CORTEX_USE_FPU) || defined(__DOXYGEN__)
-#define CRT0_INIT_FPU CORTEX_USE_FPU
-#else
-#define CRT0_INIT_FPU FALSE
-#endif
-#endif
-
-/**
* @brief FPU FPCCR register initialization value.
* @note Only used if @p CRT0_INIT_FPU is equal to @p TRUE.
*/
@@ -199,7 +206,12 @@ Reset_Handler:
msr CONTROL, r0
isb
- /* Early initialization..*/
+#if CRT0_INIT_CORE == TRUE
+ /* Core initialization.*/
+ bl __core_init
+#endif
+
+ /* Early initialization.*/
bl __early_init
#if CRT0_INIT_STACKS == TRUE
diff --git a/os/common/ports/ARMCMx/compilers/GCC/crt1.c b/os/common/ports/ARMCMx/compilers/GCC/crt1.c
index 68e22b95a..b20c3ba9a 100644
--- a/os/common/ports/ARMCMx/compilers/GCC/crt1.c
+++ b/os/common/ports/ARMCMx/compilers/GCC/crt1.c
@@ -27,11 +27,31 @@
#include <stdbool.h>
+#include "cmparams.h"
+
/**
- * @brief Early initialization.
+ * @brief Architecture-dependent core initialization.
* @details This hook is invoked immediately after the stack initialization
- * and before the DATA and BSS segments initialization. The
- * default behavior is to do nothing.
+ * and before the DATA and BSS segments initialization.
+ * @note This function is a weak symbol.
+ */
+#if !defined(__DOXYGEN__)
+__attribute__((weak))
+#endif
+/*lint -save -e9075 [8.4] All symbols are invoked from asm context.*/
+void __core_init(void) {
+
+#if __CORTEX_M == 7
+ SCB_EnableICache();
+ SCB_EnableDCache();
+#endif
+}
+
+/**
+ * @brief Early initialization.
+ * @details This hook is invoked immediately after the stack and core
+ * initialization and before the DATA and BSS segments
+ * initialization.
* @note This function is a weak symbol.
*/
#if !defined(__DOXYGEN__)