aboutsummaryrefslogtreecommitdiff
path: root/lib/stm32
diff options
context:
space:
mode:
authorPiotr Esden-Tempski2012-10-05 13:03:58 -0700
committerPiotr Esden-Tempski2012-10-05 13:03:58 -0700
commitcb60e3760867133bbef90905c681881a2fb3ae50 (patch)
treea971d20e9ec8986f6857b951d036f70e104f0463 /lib/stm32
parent4efa64c2785692b422988f7444e737c67931ea5d (diff)
parentaac5909ff133a71dc01037712f86e89f4e7877d7 (diff)
Merging pull request #37 Adds hard-float support to stm32f4, with a nice mandelbrot example
Merge remote-tracking branch 'schodet/hard-float'
Diffstat (limited to 'lib/stm32')
-rw-r--r--lib/stm32/f4/Makefile3
-rw-r--r--lib/stm32/f4/vector.c5
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/stm32/f4/Makefile b/lib/stm32/f4/Makefile
index 85870a7..fd0b279 100644
--- a/lib/stm32/f4/Makefile
+++ b/lib/stm32/f4/Makefile
@@ -24,7 +24,8 @@ PREFIX ?= arm-none-eabi
CC = $(PREFIX)-gcc
AR = $(PREFIX)-ar
CFLAGS = -Os -g -Wall -Wextra -I../../../include -fno-common \
- -mcpu=cortex-m3 -mthumb -Wstrict-prototypes \
+ -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 \
+ -Wstrict-prototypes \
-ffunction-sections -fdata-sections -MD -DSTM32F4
# ARFLAGS = rcsv
ARFLAGS = rcs
diff --git a/lib/stm32/f4/vector.c b/lib/stm32/f4/vector.c
index 3429bfb..01b5e64 100644
--- a/lib/stm32/f4/vector.c
+++ b/lib/stm32/f4/vector.c
@@ -18,6 +18,8 @@
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <libopencm3/stm32/f4/scb.h>
+
#define WEAK __attribute__ ((weak))
/* Symbols exported by the linker script(s): */
@@ -224,6 +226,9 @@ void reset_handler(void)
__asm__("MSR msp, %0" : : "r"(&_stack));
+ /* Enable access to Floating-Point coprocessor. */
+ SCB_CPACR |= SCB_CPACR_FULL * (SCB_CPACR_CP10 | SCB_CPACR_CP11);
+
for (src = &_data_loadaddr, dest = &_data; dest < &_edata; src++, dest++)
*dest = *src;