From 3e2d87c22ade20620724b7696e763a800e320cdc Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 7 Dec 2011 18:58:21 +0000 Subject: 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 --- nuttx/arch/arm/src/stm32/Make.defs | 4 ++++ nuttx/arch/arm/src/stm32/stm32_start.c | 2 +- nuttx/arch/arm/src/stm32/stm32_vectors.S | 15 +++++++++++++-- 3 files changed, 18 insertions(+), 3 deletions(-) (limited to 'nuttx/arch/arm/src/stm32') 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 + * Author: Gregory Nutt * * 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 + * Author: Gregory Nutt * * 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" -- cgit v1.2.3