summaryrefslogtreecommitdiff
path: root/startup
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2012-12-31 13:55:56 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2012-12-31 14:06:20 +0100
commit8419b87c6bd7be468239d0f68155631dfb5db103 (patch)
treee7159ec683e8b0a391f06b59a4b9a1770234b97f /startup
parentdeab534c051210678014966f60acf904ba36f81d (diff)
Fixed FPU support.
Selecting proper FPU flags in build_rules and enabling FPU during startup.
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;