From cb77e758a79d468a3b756cd4675bc2ac9360191e Mon Sep 17 00:00:00 2001 From: Romain Goyet Date: Thu, 17 Sep 2015 12:15:38 +0200 Subject: [PATCH] Enable the FPU --- boot/device/crt0.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/boot/device/crt0.c b/boot/device/crt0.c index e79cb9f20..440262eb2 100644 --- a/boot/device/crt0.c +++ b/boot/device/crt0.c @@ -8,6 +8,13 @@ extern char _data_section_end_ram; extern char _bss_section_start_ram; extern char _bss_section_end_ram; +#define CPACR (*(volatile uint32_t *)(0xE000ED88)) + +void enable_fpu() { + // http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0553a/BABDBFBJ.html + CPACR |= (0xF << 20); // Set the bits 20-23 to enable CP10 and CP11 coprocessors +} + void abort() { // TODO: #ifdef NDEBUG, maybe trigger a reset? while (1) { @@ -31,6 +38,8 @@ void _start(void) { size_t bssSectionLength = (&_bss_section_end_ram - &_bss_section_start_ram); memset(&_bss_section_start_ram, 0, bssSectionLength); + enable_fpu(); + boot(); abort();