From be5ba90d4fac07466e842af9752b9da90d3a57b6 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 20 Jan 2017 10:53:46 -0600 Subject: [PATCH] Move optimized ARM memcpy functions from arch/arm/src/ to libc/machine/. This is necessary for the PROTECTED and KERNEL build modes. Otherwise, memcpy() will be built in to kernel space and not accessible to applications. --- arch/arm/src/a1x/Make.defs | 4 -- arch/arm/src/armv7-a/Kconfig | 7 +++ arch/arm/src/armv7-r/Kconfig | 7 +++ arch/arm/src/efm32/Make.defs | 4 -- arch/arm/src/imx6/Make.defs | 4 -- arch/arm/src/kinetis/Make.defs | 4 -- arch/arm/src/lpc17xx/Make.defs | 4 -- arch/arm/src/lpc43xx/Make.defs | 4 -- arch/arm/src/sam34/Make.defs | 4 -- arch/arm/src/sama5/Make.defs | 4 -- arch/arm/src/samv7/Make.defs | 4 -- arch/arm/src/stm32/Make.defs | 4 -- arch/arm/src/stm32f7/Make.defs | 4 -- arch/arm/src/stm32l4/Make.defs | 4 -- arch/arm/src/tiva/Make.defs | 4 -- arch/arm/src/tms570/Make.defs | 4 -- libc/machine/Kconfig | 12 ++++++ libc/machine/Make.defs | 26 ++++++++++- libc/machine/armv7-a/Kconfig | 14 ++++++ libc/machine/armv7-a/Make.defs | 43 +++++++++++++++++++ .../machine/armv7-a/gnu/arch_memcpy.S | 11 ++++- libc/machine/armv7-m/Kconfig | 11 +++++ libc/machine/armv7-m/Make.defs | 43 +++++++++++++++++++ .../machine/armv7-m/gnu/arch_memcpy.S | 10 ++++- libc/machine/armv7-r/Kconfig | 11 +++++ libc/machine/armv7-r/Make.defs | 43 +++++++++++++++++++ .../machine/armv7-r/gnu/arch_memcpy.S | 17 ++++++-- 27 files changed, 247 insertions(+), 64 deletions(-) create mode 100644 libc/machine/armv7-a/Kconfig create mode 100644 libc/machine/armv7-a/Make.defs rename arch/arm/src/armv7-a/arm_memcpy.S => libc/machine/armv7-a/gnu/arch_memcpy.S (98%) create mode 100644 libc/machine/armv7-m/Kconfig create mode 100644 libc/machine/armv7-m/Make.defs rename arch/arm/src/armv7-m/gnu/up_memcpy.S => libc/machine/armv7-m/gnu/arch_memcpy.S (98%) create mode 100644 libc/machine/armv7-r/Kconfig create mode 100644 libc/machine/armv7-r/Make.defs rename arch/arm/src/armv7-r/arm_memcpy.S => libc/machine/armv7-r/gnu/arch_memcpy.S (97%) diff --git a/arch/arm/src/a1x/Make.defs b/arch/arm/src/a1x/Make.defs index 4ba3a296e9..78cf125a9d 100644 --- a/arch/arm/src/a1x/Make.defs +++ b/arch/arm/src/a1x/Make.defs @@ -59,10 +59,6 @@ CMN_ASRCS += arm_testset.S CMN_ASRCS += cp15_coherent_dcache.S cp15_invalidate_dcache.S CMN_ASRCS += cp15_clean_dcache.S cp15_flush_dcache.S cp15_invalidate_dcache_all.S -ifeq ($(CONFIG_LIBC_ARCH_MEMCPY),y) -CMN_ASRCS += arm_memcpy.S -endif - # Common C source files CMN_CSRCS = up_initialize.c up_idle.c up_interruptcontext.c up_exit.c diff --git a/arch/arm/src/armv7-a/Kconfig b/arch/arm/src/armv7-a/Kconfig index 312ed8d441..e4746900a3 100644 --- a/arch/arm/src/armv7-a/Kconfig +++ b/arch/arm/src/armv7-a/Kconfig @@ -133,10 +133,12 @@ choice config ARMV7A_TOOLCHAIN_BUILDROOT bool "Buildroot (Cygwin or Linux)" + select ARM_TOOLCHAIN_GNU depends on !WINDOWS_NATIVE config ARMV7A_TOOLCHAIN_CODESOURCERYL bool "CodeSourcery GNU toolchain under Linux" + select ARM_TOOLCHAIN_GNU depends on HOST_LINUX ---help--- For use with the GNU toolchain built with the NuttX buildroot package. @@ -145,20 +147,24 @@ config ARMV7A_TOOLCHAIN_CODESOURCERYL config ARMV7A_TOOLCHAIN_CODESOURCERYW bool "CodeSourcery GNU toolchain under Windows" + select ARM_TOOLCHAIN_GNU depends on TOOLCHAIN_WINDOWS config ARMV7A_TOOLCHAIN_DEVKITARM bool "devkitARM GNU toolchain" + select ARM_TOOLCHAIN_GNU depends on TOOLCHAIN_WINDOWS config ARMV7A_TOOLCHAIN_GNU_EABIL bool "Generic GNU EABI toolchain under Linux (or other POSIX environment)" + select ARM_TOOLCHAIN_GNU ---help--- This option should work for any modern GNU toolchain (GCC 4.5 or newer) configured for arm-none-eabi-. config ARMV7A_TOOLCHAIN_GNU_EABIW bool "Generic GNU EABI toolchain under Windows" + select ARM_TOOLCHAIN_GNU depends on TOOLCHAIN_WINDOWS ---help--- This option should work for any modern GNU toolchain (GCC 4.5 or newer) @@ -166,6 +172,7 @@ config ARMV7A_TOOLCHAIN_GNU_EABIW config ARMV7A_TOOLCHAIN_GNU_OABI bool "Generic GNU OABI toolchain" + select ARM_TOOLCHAIN_GNU ---help--- This option should work for any GNU toolchain configured for arm-elf-. diff --git a/arch/arm/src/armv7-r/Kconfig b/arch/arm/src/armv7-r/Kconfig index 03012b5da2..b4ec974db0 100644 --- a/arch/arm/src/armv7-r/Kconfig +++ b/arch/arm/src/armv7-r/Kconfig @@ -149,10 +149,12 @@ choice config ARMV7R_TOOLCHAIN_BUILDROOT bool "Buildroot (Cygwin or Linux)" + select ARM_TOOLCHAIN_GNU depends on !WINDOWS_NATIVE config ARMV7R_TOOLCHAIN_CODESOURCERYL bool "CodeSourcery GNU toolchain under Linux" + select ARM_TOOLCHAIN_GNU depends on HOST_LINUX ---help--- For use with the GNU toolchain built with the NuttX buildroot package. @@ -161,20 +163,24 @@ config ARMV7R_TOOLCHAIN_CODESOURCERYL config ARMV7R_TOOLCHAIN_CODESOURCERYW bool "CodeSourcery GNU toolchain under Windows" + select ARM_TOOLCHAIN_GNU depends on TOOLCHAIN_WINDOWS config ARMV7R_TOOLCHAIN_DEVKITARM bool "devkitARM GNU toolchain" + select ARM_TOOLCHAIN_GNU depends on TOOLCHAIN_WINDOWS config ARMV7R_TOOLCHAIN_GNU_EABIL bool "Generic GNU EABI toolchain under Linux (or other POSIX environment)" + select ARM_TOOLCHAIN_GNU ---help--- This option should work for any modern GNU toolchain (GCC 4.5 or newer) configured for arm-none-eabi-. config ARMV7R_TOOLCHAIN_GNU_EABIW bool "Generic GNU EABI toolchain under Windows" + select ARM_TOOLCHAIN_GNU depends on TOOLCHAIN_WINDOWS ---help--- This option should work for any modern GNU toolchain (GCC 4.5 or newer) @@ -182,6 +188,7 @@ config ARMV7R_TOOLCHAIN_GNU_EABIW config ARMV7R_TOOLCHAIN_GNU_OABI bool "Generic GNU OABI toolchain" + select ARM_TOOLCHAIN_GNU ---help--- This option should work for any GNU toolchain configured for arm-elf-. diff --git a/arch/arm/src/efm32/Make.defs b/arch/arm/src/efm32/Make.defs index ccd7fc3c57..d87e5e5699 100644 --- a/arch/arm/src/efm32/Make.defs +++ b/arch/arm/src/efm32/Make.defs @@ -63,10 +63,6 @@ ifeq ($(CONFIG_ARCH_RAMVECTORS),y) CMN_CSRCS += up_ramvec_initialize.c up_ramvec_attach.c endif -ifeq ($(CONFIG_LIBC_ARCH_MEMCPY),y) -CMN_ASRCS += up_memcpy.S -endif - ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) diff --git a/arch/arm/src/imx6/Make.defs b/arch/arm/src/imx6/Make.defs index 6594b03bf5..8704e2fec4 100644 --- a/arch/arm/src/imx6/Make.defs +++ b/arch/arm/src/imx6/Make.defs @@ -62,10 +62,6 @@ CMN_ASRCS += arm_testset.S CMN_ASRCS += cp15_coherent_dcache.S cp15_invalidate_dcache.S CMN_ASRCS += cp15_clean_dcache.S cp15_flush_dcache.S cp15_invalidate_dcache_all.S -ifeq ($(CONFIG_LIBC_ARCH_MEMCPY),y) -CMN_ASRCS += arm_memcpy.S -endif - # Common C source files CMN_CSRCS = up_initialize.c up_idle.c up_interruptcontext.c up_exit.c diff --git a/arch/arm/src/kinetis/Make.defs b/arch/arm/src/kinetis/Make.defs index 2a74edcb09..c329d5fbc4 100644 --- a/arch/arm/src/kinetis/Make.defs +++ b/arch/arm/src/kinetis/Make.defs @@ -71,10 +71,6 @@ ifeq ($(CONFIG_ARCH_RAMVECTORS),y) CMN_CSRCS += up_ramvec_initialize.c up_ramvec_attach.c endif -ifeq ($(CONFIG_LIBC_ARCH_MEMCPY),y) -CMN_ASRCS += up_memcpy.S -endif - ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) diff --git a/arch/arm/src/lpc17xx/Make.defs b/arch/arm/src/lpc17xx/Make.defs index 4bb1440d11..329999c997 100644 --- a/arch/arm/src/lpc17xx/Make.defs +++ b/arch/arm/src/lpc17xx/Make.defs @@ -70,10 +70,6 @@ ifeq ($(CONFIG_ARCH_RAMVECTORS),y) CMN_CSRCS += up_ramvec_initialize.c up_ramvec_attach.c endif -ifeq ($(CONFIG_LIBC_ARCH_MEMCPY),y) -CMN_ASRCS += up_memcpy.S -endif - ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) diff --git a/arch/arm/src/lpc43xx/Make.defs b/arch/arm/src/lpc43xx/Make.defs index 8f772981bc..1329d2b598 100644 --- a/arch/arm/src/lpc43xx/Make.defs +++ b/arch/arm/src/lpc43xx/Make.defs @@ -60,10 +60,6 @@ ifeq ($(CONFIG_ARCH_RAMVECTORS),y) CMN_CSRCS += up_ramvec_initialize.c up_ramvec_attach.c endif -ifeq ($(CONFIG_LIBC_ARCH_MEMCPY),y) -CMN_ASRCS += up_memcpy.S -endif - ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) diff --git a/arch/arm/src/sam34/Make.defs b/arch/arm/src/sam34/Make.defs index 88460b677a..71211da379 100644 --- a/arch/arm/src/sam34/Make.defs +++ b/arch/arm/src/sam34/Make.defs @@ -76,10 +76,6 @@ ifeq ($(CONFIG_ARCH_RAMVECTORS),y) CMN_CSRCS += up_ramvec_initialize.c up_ramvec_attach.c endif -ifeq ($(CONFIG_LIBC_ARCH_MEMCPY),y) -CMN_ASRCS += up_memcpy.S -endif - ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) diff --git a/arch/arm/src/sama5/Make.defs b/arch/arm/src/sama5/Make.defs index b69ca387f5..3c18d07a4b 100644 --- a/arch/arm/src/sama5/Make.defs +++ b/arch/arm/src/sama5/Make.defs @@ -61,10 +61,6 @@ CMN_ASRCS += cp15_clean_dcache.S cp15_flush_dcache.S cp15_invalidate_dcache_all. # Configuration dependent assembly language files -ifeq ($(CONFIG_LIBC_ARCH_MEMCPY),y) -CMN_ASRCS += arm_memcpy.S -endif - # Common C source files CMN_CSRCS = up_initialize.c up_idle.c up_interruptcontext.c up_exit.c diff --git a/arch/arm/src/samv7/Make.defs b/arch/arm/src/samv7/Make.defs index 3ba78172a0..fba21d3be3 100644 --- a/arch/arm/src/samv7/Make.defs +++ b/arch/arm/src/samv7/Make.defs @@ -90,10 +90,6 @@ ifeq ($(CONFIG_ARCH_RAMVECTORS),y) CMN_CSRCS += up_ramvec_initialize.c up_ramvec_attach.c endif -ifeq ($(CONFIG_LIBC_ARCH_MEMCPY),y) -CMN_ASRCS += up_memcpy.S -endif - ifeq ($(CONFIG_ARM_MPU),y) CMN_CSRCS += up_mpu.c ifeq ($(CONFIG_BUILD_PROTECTED),y) diff --git a/arch/arm/src/stm32/Make.defs b/arch/arm/src/stm32/Make.defs index 19c79e3eea..ff7724411c 100644 --- a/arch/arm/src/stm32/Make.defs +++ b/arch/arm/src/stm32/Make.defs @@ -71,10 +71,6 @@ ifeq ($(CONFIG_ARCH_RAMVECTORS),y) CMN_CSRCS += up_ramvec_initialize.c up_ramvec_attach.c endif -ifeq ($(CONFIG_LIBC_ARCH_MEMCPY),y) -CMN_ASRCS += up_memcpy.S -endif - ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) diff --git a/arch/arm/src/stm32f7/Make.defs b/arch/arm/src/stm32f7/Make.defs index f69fa5354a..ac475b3940 100644 --- a/arch/arm/src/stm32f7/Make.defs +++ b/arch/arm/src/stm32f7/Make.defs @@ -87,10 +87,6 @@ ifeq ($(CONFIG_ARCH_RAMVECTORS),y) CMN_CSRCS += up_ramvec_initialize.c up_ramvec_attach.c endif -ifeq ($(CONFIG_LIBC_ARCH_MEMCPY),y) -CMN_ASRCS += up_memcpy.S -endif - ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) diff --git a/arch/arm/src/stm32l4/Make.defs b/arch/arm/src/stm32l4/Make.defs index 261cc17eff..4a6f97979f 100644 --- a/arch/arm/src/stm32l4/Make.defs +++ b/arch/arm/src/stm32l4/Make.defs @@ -83,10 +83,6 @@ ifeq ($(CONFIG_ARCH_RAMVECTORS),y) CMN_CSRCS += up_ramvec_initialize.c up_ramvec_attach.c endif -ifeq ($(CONFIG_LIBC_ARCH_MEMCPY),y) -CMN_ASRCS += up_memcpy.S -endif - ifeq ($(CONFIG_BUILD_PROTECTED),y) CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) diff --git a/arch/arm/src/tiva/Make.defs b/arch/arm/src/tiva/Make.defs index ff456454cf..7a3110cc07 100644 --- a/arch/arm/src/tiva/Make.defs +++ b/arch/arm/src/tiva/Make.defs @@ -51,10 +51,6 @@ ifeq ($(CONFIG_ARCH_RAMVECTORS),y) CMN_CSRCS += up_ramvec_initialize.c up_ramvec_attach.c endif -ifeq ($(CONFIG_LIBC_ARCH_MEMCPY),y) -CMN_ASRCS += up_memcpy.S -endif - ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif diff --git a/arch/arm/src/tms570/Make.defs b/arch/arm/src/tms570/Make.defs index 688cecfd20..b054f04a95 100644 --- a/arch/arm/src/tms570/Make.defs +++ b/arch/arm/src/tms570/Make.defs @@ -53,10 +53,6 @@ ifeq ($(CONFIG_ARCH_FPU),y) CMN_ASRCS += arm_fpuconfig.S endif -ifeq ($(CONFIG_LIBC_ARCH_MEMCPY),y) -CMN_ASRCS += arm_memcpy.S -endif - # Common C source files CMN_CSRCS = up_allocateheap.c up_initialize.c up_idle.c up_interruptcontext.c diff --git a/libc/machine/Kconfig b/libc/machine/Kconfig index ee717ee5af..665b05ef18 100644 --- a/libc/machine/Kconfig +++ b/libc/machine/Kconfig @@ -113,6 +113,18 @@ config LIBM_ARCH_TRUNCF # One or more the of above may be selected by architecture specific logic +if ARCH_CORTEXA5 || ARCH_CORTEXA8 || ARCH_CORTEXA9 +source libc/machine/armv7-a/Kconfig +endif + +if ARCH_CORTEXR4 || ARCH_CORTEXR4F || ARCH_CORTEXR5 || ARCH_CORTEXR5F || ARCH_CORTEXR7 || ARCH_CORTEXR7F +source libc/machine/armv7-r/Kconfig +endif + +if ARCH_CORTEXM3 || ARCH_CORTEXM4 || ARCH_CORTEXM7 +source libc/machine/armv7-m/Kconfig +endif + if ARCH_CORTEXM33 source libc/machine/armv8/Kconfig endif diff --git a/libc/machine/Make.defs b/libc/machine/Make.defs index 1b78ca5d09..7ffe7f00d5 100644 --- a/libc/machine/Make.defs +++ b/libc/machine/Make.defs @@ -33,6 +33,30 @@ # ############################################################################ -ifeq ($(CONFIG_ARCH_CORTEXM33),y) +ifeq ($(CONFIG_ARCH_CORTEXA5),y) # Cortex-A5 is ARMv7-A +include ${TOPDIR}/libc/machine/armv7-a/Make.defs +else ifeq ($(CONFIG_ARCH_CORTEXA8),y) # Cortex-A8 is ARMv7-A +include ${TOPDIR}/libc/machine/armv7-a/Make.defs +else ifeq ($(CONFIG_ARCH_CORTEXA9),y) # Cortex-A9 is ARMv7-A +include ${TOPDIR}/libc/machine/armv7-a/Make.defs +else ifeq ($(CONFIG_ARCH_CORTEXR4),y) # Cortex-R4 is ARMv7-R +include ${TOPDIR}/libc/machine/armv7-r/Make.defs +else ifeq ($(CONFIG_ARCH_CORTEXR4F),y) # Cortex-R4F is ARMv7-R +include ${TOPDIR}/libc/machine/armv7-r/Make.defs +else ifeq ($(CONFIG_ARCH_CORTEXR5),y) # Cortex-R5 is ARMv7-R +include ${TOPDIR}/libc/machine/armv7-r/Make.defs +else ifeq ($(CONFIG_ARCH_CORTEXR5F),y) # Cortex-R5F is ARMv7-R +include ${TOPDIR}/libc/machine/armv7-r/Make.defs +else ifeq ($(CONFIG_ARCH_CORTEXR7),y) # Cortex-R7 is ARMv7-R +include ${TOPDIR}/libc/machine/armv7-r/Make.defs +else ifeq ($(CONFIG_ARCH_CORTEXR7F),y) # Cortex-R7F is ARMv7-R +include ${TOPDIR}/libc/machine/armv7-r/Make.defs +else ifeq ($(CONFIG_ARCH_CORTEXM3),y) # Cortex-M3 is ARMv7-M +include ${TOPDIR}/libc/machine/armv7-m/Make.defs +else ifeq ($(CONFIG_ARCH_CORTEXM33),y) # Cortex-M33 is ARMv8-M include ${TOPDIR}/libc/machine/armv8/Make.defs +else ifeq ($(CONFIG_ARCH_CORTEXM4),y) # Cortex-M4 is ARMv7E-M +include ${TOPDIR}/libc/machine/armv7-m/Make.defs +else ifeq ($(CONFIG_ARCH_CORTEXM7),y) # Cortex-M4 is ARMv7E-M +include ${TOPDIR}/libc/machine/armv7-m/Make.defs endif diff --git a/libc/machine/armv7-a/Kconfig b/libc/machine/armv7-a/Kconfig new file mode 100644 index 0000000000..d63d564e0d --- /dev/null +++ b/libc/machine/armv7-a/Kconfig @@ -0,0 +1,14 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +config ARMV7A_MEMCPY + bool "Enable optimized memcpy() for ARMv7-A" + select LIBC_ARCH_MEMCPY + depends on ARM_TOOLCHAIN_GNU && EXPERIMENTAL + ---help--- + Enable optimized ARMv7-A specific memcpy() library function + + Marked EXPERIMENTAL because it did not build for me the last time I + tried. diff --git a/libc/machine/armv7-a/Make.defs b/libc/machine/armv7-a/Make.defs new file mode 100644 index 0000000000..affc2fc312 --- /dev/null +++ b/libc/machine/armv7-a/Make.defs @@ -0,0 +1,43 @@ +############################################################################ +# libc/machine/armv7-a/Make.defs +# +# Copyright (C) 2017 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +ifeq ($(CONFIG_ARMV7A_MEMCPY),y) + +ASRCS += arch_memcpy.S + +DEPPATH += --dep-path machine/armv7-a/gnu +VPATH += :machine/armv7-a/gnu + +endif diff --git a/arch/arm/src/armv7-a/arm_memcpy.S b/libc/machine/armv7-a/gnu/arch_memcpy.S similarity index 98% rename from arch/arm/src/armv7-a/arm_memcpy.S rename to libc/machine/armv7-a/gnu/arch_memcpy.S index 48e1294986..f5078c7481 100644 --- a/arch/arm/src/armv7-a/arm_memcpy.S +++ b/libc/machine/armv7-a/gnu/arch_memcpy.S @@ -59,9 +59,16 @@ .global memcpy - .syntax unified +#if defined(CONFIG_ARCH_CORTEXA5) + .cpu cortex-a5 +#elif defined(CONFIG_ARCH_CORTEXA8) + .cpu cortex-a8 +#elif defined(CONFIG_ARCH_CORTEXA9) + .cpu cortex-a9 +#endif - .file "arm_memcpy.S" + .syntax unified + .file "arch_memcpy.S" /************************************************************************************ * .text diff --git a/libc/machine/armv7-m/Kconfig b/libc/machine/armv7-m/Kconfig new file mode 100644 index 0000000000..7148c25c4b --- /dev/null +++ b/libc/machine/armv7-m/Kconfig @@ -0,0 +1,11 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +config ARMV7M_MEMCPY + bool "Enable optimized memcpy() for ARMv7-M" + select LIBC_ARCH_MEMCPY + depends on ARM_TOOLCHAIN_GNU + ---help--- + Enable optimized ARMv7-M specific memcpy() library function diff --git a/libc/machine/armv7-m/Make.defs b/libc/machine/armv7-m/Make.defs new file mode 100644 index 0000000000..888799f7da --- /dev/null +++ b/libc/machine/armv7-m/Make.defs @@ -0,0 +1,43 @@ +############################################################################ +# libc/machine/armv7-m/Make.defs +# +# Copyright (C) 2017 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +ifeq ($(CONFIG_ARMV7M_MEMCPY),y) + +ASRCS += arch_memcpy.S + +DEPPATH += --dep-path machine/armv7-m/gnu +VPATH += :machine/armv7-m/gnu + +endif diff --git a/arch/arm/src/armv7-m/gnu/up_memcpy.S b/libc/machine/armv7-m/gnu/arch_memcpy.S similarity index 98% rename from arch/arm/src/armv7-m/gnu/up_memcpy.S rename to libc/machine/armv7-m/gnu/arch_memcpy.S index cf34648d01..2b93ee6504 100644 --- a/arch/arm/src/armv7-m/gnu/up_memcpy.S +++ b/libc/machine/armv7-m/gnu/arch_memcpy.S @@ -60,8 +60,16 @@ .syntax unified .thumb + +#if defined(CONFIG_ARCH_CORTEXM3) .cpu cortex-m3 - .file "up_memcpy.S" +#elif defined(CONFIG_ARCH_CORTEXM4) + .cpu cortex-m4 +#elif defined(CONFIG_ARCH_CORTEXM7) + .cpu cortex-m7 +#endif + + .file "arch_memcpy.S" /************************************************************************************ * .text diff --git a/libc/machine/armv7-r/Kconfig b/libc/machine/armv7-r/Kconfig new file mode 100644 index 0000000000..e772a2942d --- /dev/null +++ b/libc/machine/armv7-r/Kconfig @@ -0,0 +1,11 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +config ARMV7R_MEMCPY + bool "Enable optimized memcpy() for ARMv7-R" + select LIBC_ARCH_MEMCPY + depends on ARM_TOOLCHAIN_GNU + ---help--- + Enable optimized ARMv7-R specific memcpy() library function diff --git a/libc/machine/armv7-r/Make.defs b/libc/machine/armv7-r/Make.defs new file mode 100644 index 0000000000..fe61e5ffe1 --- /dev/null +++ b/libc/machine/armv7-r/Make.defs @@ -0,0 +1,43 @@ +############################################################################ +# libc/machine/armv7-r/Make.defs +# +# Copyright (C) 2017 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +ifeq ($(CONFIG_ARMV7R_MEMCPY),y) + +ASRCS += arch_memcpy.S + +DEPPATH += --dep-path machine/armv7-r/gnu +VPATH += :machine/armv7-r/gnu + +endif diff --git a/arch/arm/src/armv7-r/arm_memcpy.S b/libc/machine/armv7-r/gnu/arch_memcpy.S similarity index 97% rename from arch/arm/src/armv7-r/arm_memcpy.S rename to libc/machine/armv7-r/gnu/arch_memcpy.S index b88a0e0869..46bb835add 100644 --- a/arch/arm/src/armv7-r/arm_memcpy.S +++ b/libc/machine/armv7-r/gnu/arch_memcpy.S @@ -59,13 +59,22 @@ .global memcpy -#ifdef CONFIG_ARCH_FPU +#if defined(CONFIG_ARCH_CORTEXR4) .cpu cortex-r4 -#else +#elif defined(CONFIG_ARCH_CORTEXR4F) .cpu cortex-r4f -#endif +#elif defined(CONFIG_ARCH_CORTEXR5) + .cpu cortex-r5 +#elif defined(CONFIG_ARCH_CORTEXR6F) + .cpu cortex-r5f +#elif defined(CONFIG_ARCH_CORTEXR7) + .cpu cortex-r7 +#elif defined(CONFIG_ARCH_CORTEXR7F) + .cpu cortex-r7f +endif + .syntax unified - .file "arm_memcpy.S" + .file "arch_memcpy.S" /************************************************************************************ * .text