summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/stm32/stm32_start.c
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/arch/arm/src/stm32/stm32_start.c')
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_start.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/nuttx/arch/arm/src/stm32/stm32_start.c b/nuttx/arch/arm/src/stm32/stm32_start.c
index ce7aeb53a..7209d3cb9 100644
--- a/nuttx/arch/arm/src/stm32/stm32_start.c
+++ b/nuttx/arch/arm/src/stm32/stm32_start.c
@@ -49,6 +49,9 @@
#include "stm32_internal.h"
#include "stm32_gpio.h"
+#ifdef CONFIG_ARCH_FPU
+# include "nvic.h"
+#endif
/****************************************************************************
* Name: showprogress
@@ -68,6 +71,33 @@
* Public Functions
****************************************************************************/
+ /****************************************************************************
+ * Name: stm32_fpuconfig
+ *
+ * Description:
+ * Configure the FPU. The the MCU has an FPU, then enable full access
+ * to coprocessors CP10 and CP11.
+ *
+ * This is implemented as a macro because the stack has not yet been
+ * initialized.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_FPU
+# define stm32_fpuconfig() \
+{ \
+ uint32_t regval = getreg32(NVIC_CPACR); \
+ regval |= ((3 << (2*10)) | (3 << (2*11))); \
+ putreg32(regval, NVIC_CPACR); \
+}
+#else
+# define stm32_fpuconfig()
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
/****************************************************************************
* Name: _start
*
@@ -84,6 +114,7 @@ void __start(void)
/* Configure the uart so that we can get debug output as soon as possible */
stm32_clockconfig();
+ stm32_fpuconfig();
stm32_lowsetup();
stm32_gpioinit();
showprogress('A');