summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/stm32
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-12-07 18:58:21 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-12-07 18:58:21 +0000
commit3e2d87c22ade20620724b7696e763a800e320cdc (patch)
tree197ae7885c03edbda5fc8fc0c8578d3a6ec6b94b /nuttx/arch/arm/src/stm32
parentdf19be6fa87a092e5ed5cd96ec59640b59afc69e (diff)
downloadpx4-nuttx-3e2d87c22ade20620724b7696e763a800e320cdc.tar.gz
px4-nuttx-3e2d87c22ade20620724b7696e763a800e320cdc.tar.bz2
px4-nuttx-3e2d87c22ade20620724b7696e763a800e320cdc.zip
Add support for the Cortex-M4 floating pointing
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4144 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/stm32')
-rw-r--r--nuttx/arch/arm/src/stm32/Make.defs4
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_start.c2
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_vectors.S15
3 files changed, 18 insertions, 3 deletions
diff --git a/nuttx/arch/arm/src/stm32/Make.defs b/nuttx/arch/arm/src/stm32/Make.defs
index b09ffd519..824d2fbfc 100644
--- a/nuttx/arch/arm/src/stm32/Make.defs
+++ b/nuttx/arch/arm/src/stm32/Make.defs
@@ -48,6 +48,10 @@ ifeq ($(CONFIG_DEBUG_STACK),y)
CMN_CSRCS += up_checkstack.c
endif
+ifeq ($(CONFIG_ARCH_FPU),y)
+CMN_ASRCS += up_fpu.S
+endif
+
CHIP_ASRCS =
CHIP_CSRCS = stm32_allocateheap.c stm32_start.c stm32_rcc.c stm32_lse.c \
stm32_gpio.c stm32_exti.c stm32_flash.c stm32_irq.c \
diff --git a/nuttx/arch/arm/src/stm32/stm32_start.c b/nuttx/arch/arm/src/stm32/stm32_start.c
index 7209d3cb9..7ac7ac1f9 100644
--- a/nuttx/arch/arm/src/stm32/stm32_start.c
+++ b/nuttx/arch/arm/src/stm32/stm32_start.c
@@ -3,7 +3,7 @@
* arch/arm/src/chip/stm32_start.c
*
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/nuttx/arch/arm/src/stm32/stm32_vectors.S b/nuttx/arch/arm/src/stm32/stm32_vectors.S
index 714244686..ee4220ccc 100644
--- a/nuttx/arch/arm/src/stm32/stm32_vectors.S
+++ b/nuttx/arch/arm/src/stm32/stm32_vectors.S
@@ -3,7 +3,7 @@
* arch/arm/src/chip/stm32_vectors.S
*
* Copyright (C) 2009-2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -254,7 +254,7 @@ stm32_common:
* values to the stack.
*/
- add r1, r0, #SW_XCPT_SIZE /* R1=Address of HW save area in reg array */
+ add r1, r0, #SW_XCPT_SIZE /* R1=Address of HW save area in reg array */
ldmia r1, {r4-r11} /* Fetch eight registers in HW save area */
ldr r1, [r0, #(4*REG_SP)] /* R1=Value of SP before interrupt */
stmdb r1!, {r4-r11} /* Store eight registers in HW save area */
@@ -263,6 +263,17 @@ stm32_common:
#else
ldmia r0, {r2-r11} /* Recover R4-R11 + 2 temp values */
#endif
+
+ /* We may also need to restore FPU registers. This is not done in
+ * normal interrupt save/restore because the cost is prohibitive. This
+ * is only done when switching contexts. A consequence of this is that
+ * floating point operations may not be performed in interrupt handling
+ * logic.
+ */
+
+#ifdef CONFIG_ARCH_FPU
+ bl up_restorefpu /* Restore the FPU registers */
+#endif
b 2f /* Re-join common logic */
/* We are returning with no context switch. We simply need to "unwind"