summaryrefslogtreecommitdiff
path: root/startup
diff options
context:
space:
mode:
Diffstat (limited to 'startup')
-rw-r--r--startup/entry.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/startup/entry.cpp b/startup/entry.cpp
index d7385f8..64aac37 100644
--- a/startup/entry.cpp
+++ b/startup/entry.cpp
@@ -1,5 +1,6 @@
#include <stdint.h>
#include <rcc/rcc.h>
+#include <cortex_m/fpu.h>
int main();
@@ -35,6 +36,11 @@ void __attribute__((naked)) entry() {
*wp++ = 0;
}
+ // Enable FPU before calling any functions that can invoke FPU instructions.
+ #ifdef HAS_FPU
+ COPROC.CPAC |= (3 << 22) | (3 << 20);
+ #endif
+
// Call constructors.
funcp_t* fp = &_init_array_start;