ARMv7-N: Fix a copy error introduced in the previous check-in

This commit is contained in:
Gregory Nutt 2013-07-23 19:09:17 -06:00
parent cb3f394d53
commit 2e8fcc7229
6 changed files with 62 additions and 23 deletions

View File

@ -64,6 +64,11 @@
/**************************************************************************** /****************************************************************************
* Name: up_copyarmstate * Name: up_copyarmstate
*
* Description:
* Copy the ARM portion of the register save area (omitting the floating
* point registers) and save the floating pointer register directly.
*
****************************************************************************/ ****************************************************************************/
/* A little faster than most memcpy's */ /* A little faster than most memcpy's */
@ -79,6 +84,16 @@ void up_copyarmstate(uint32_t *dest, uint32_t *src)
if (src != dest) if (src != dest)
{ {
/* Save the floating point registers: This will initialize the floating
* registers at indices ARM_CONTEXT_REGS through (XCPTCONTEXT_REGS-1)
*/
up_savefpu(dest);
/* Then copy all of the ARM registers (mitting the floating point
* registers). Indices: 0 through (ARM_CONTEXT_REGS-1).
*/
for (i = 0; i < ARM_CONTEXT_REGS; i++) for (i = 0; i < ARM_CONTEXT_REGS; i++)
{ {
*dest++ = *src++; *dest++ = *src++;

View File

@ -157,9 +157,7 @@ endif
ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),ATOLLIC) ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),ATOLLIC)
CROSSDEV ?= arm-atollic-eabi- CROSSDEV ?= arm-atollic-eabi-
ARCROSSDEV ?= arm-atollic-eabi- ARCROSSDEV ?= arm-atollic-eabi-
ifneq ($(CONFIG_WINDOWS_NATIVE),y) MAXOPTIMIZATION = -Os
WINTOOL = y
endif
ifeq ($(CONFIG_ARCH_CORTEXM4),y) ifeq ($(CONFIG_ARCH_CORTEXM4),y)
ifeq ($(CONFIG_ARCH_FPU),y) ifeq ($(CONFIG_ARCH_FPU),y)
ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
@ -169,6 +167,9 @@ ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),ATOLLIC)
else ifeq ($(CONFIG_ARCH_CORTEXM3),y) else ifeq ($(CONFIG_ARCH_CORTEXM3),y)
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
endif endif
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
WINTOOL = y
endif
endif endif
# NuttX buildroot under Linux or Cygwin # NuttX buildroot under Linux or Cygwin
@ -191,6 +192,7 @@ endif
ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),CODEREDL) ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),CODEREDL)
CROSSDEV ?= arm-none-eabi- CROSSDEV ?= arm-none-eabi-
ARCROSSDEV ?= arm-none-eabi- ARCROSSDEV ?= arm-none-eabi-
MAXOPTIMIZATION = -Os
ifeq ($(CONFIG_ARCH_CORTEXM4),y) ifeq ($(CONFIG_ARCH_CORTEXM4),y)
ifeq ($(CONFIG_ARCH_FPU),y) ifeq ($(CONFIG_ARCH_FPU),y)
ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
@ -207,9 +209,7 @@ endif
ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),CODEREDW) ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),CODEREDW)
CROSSDEV ?= arm-none-eabi- CROSSDEV ?= arm-none-eabi-
ARCROSSDEV ?= arm-none-eabi- ARCROSSDEV ?= arm-none-eabi-
ifneq ($(CONFIG_WINDOWS_NATIVE),y) MAXOPTIMIZATION = -Os
WINTOOL = y
endif
ifeq ($(CONFIG_ARCH_CORTEXM4),y) ifeq ($(CONFIG_ARCH_CORTEXM4),y)
ifeq ($(CONFIG_ARCH_FPU),y) ifeq ($(CONFIG_ARCH_FPU),y)
ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
@ -219,6 +219,9 @@ ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),CODEREDW)
else ifeq ($(CONFIG_ARCH_CORTEXM3),y) else ifeq ($(CONFIG_ARCH_CORTEXM3),y)
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
endif endif
ifneq ($(CONFIG_WINDOWS_NATIVE),y)
WINTOOL = y
endif
endif endif
# CodeSourcery under Linux # CodeSourcery under Linux
@ -235,10 +238,19 @@ endif
ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),CODESOURCERYW) ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),CODESOURCERYW)
CROSSDEV ?= arm-none-eabi- CROSSDEV ?= arm-none-eabi-
ARCROSSDEV ?= arm-none-eabi- ARCROSSDEV ?= arm-none-eabi-
MAXOPTIMIZATION = -Os
ifeq ($(CONFIG_ARCH_CORTEXM4),y)
ifeq ($(CONFIG_ARCH_FPU),y)
ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
else
ARCHCPUFLAGS = -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfloat-abi=soft
endif
else ifeq ($(CONFIG_ARCH_CORTEXM3),y)
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
endif
ifneq ($(CONFIG_WINDOWS_NATIVE),y) ifneq ($(CONFIG_WINDOWS_NATIVE),y)
WINTOOL = y WINTOOL = y
endif endif
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
endif endif
# devkitARM under Windows # devkitARM under Windows

View File

@ -67,8 +67,7 @@
* *
* Description: * Description:
* Copy the ARM portion of the register save area (omitting the floating * Copy the ARM portion of the register save area (omitting the floating
* point registers). This is a little faster than most memcpy's since it * point registers) and save the floating pointer register directly.
* does 32-bit transfers.
* *
****************************************************************************/ ****************************************************************************/
@ -83,10 +82,33 @@ void up_copyarmstate(uint32_t *dest, uint32_t *src)
if (src != dest) if (src != dest)
{ {
/* Save the floating point registers: This will initialize the floating
* registers at indices SW_INT_REGS through (SW_INT_REGS+SW_FPU_REGS-1)
*/
up_savefpu(dest);
/* Save the block of ARM registers that were saved by the interrupt
* handling logic. Indices: 0 through (SW_INT_REGS-1).
*/
for (i = 0; i < SW_INT_REGS; i++) for (i = 0; i < SW_INT_REGS; i++)
{ {
*dest++ = *src++; *dest++ = *src++;
} }
/* Skip over the floating point registers and save the block of ARM
* registers that were saved by the hardware when the interrupt was
* taken. Indices: (SW_INT_REGS+SW_FPU_REGS) through (HW_XCPT_REGS-1)
*/
src += SW_FPU_REGS;
dest += SW_FPU_REGS;
for (i = 0; i < HW_XCPT_REGS; i++)
{
*dest++ = *src++;
}
} }
} }

View File

@ -128,12 +128,7 @@
*/ */
# if defined(CONFIG_ARCH_FPU) && !defined(CONFIG_ARMV7M_CMNVECTOR) # if defined(CONFIG_ARCH_FPU) && !defined(CONFIG_ARMV7M_CMNVECTOR)
# define up_savestate(regs) \ # define up_savestate(regs) up_copyarmstate(regs, (uint32_t*)current_regs)
do { \
up_copyarmstate(regs, (uint32_t*)current_regs); \
up_savefpu(regs); \
} \
while (0)
# else # else
# define up_savestate(regs) up_copyfullstate(regs, (uint32_t*)current_regs) # define up_savestate(regs) up_copyfullstate(regs, (uint32_t*)current_regs)
# endif # endif
@ -151,12 +146,7 @@
*/ */
# if defined(CONFIG_ARCH_FPU) # if defined(CONFIG_ARCH_FPU)
# define up_savestate(regs) \ # define up_savestate(regs) up_copyarmstate(regs, (uint32_t*)current_regs)
do { \
up_copyarmstate(regs, (uint32_t*)current_regs); \
up_savefpu(regs); \
} \
while (0)
# else # else
# define up_savestate(regs) up_copyfullstate(regs, (uint32_t*)current_regs) # define up_savestate(regs) up_copyfullstate(regs, (uint32_t*)current_regs)
# endif # endif