From 4a8c6a6d2dd7dea53383cb2eb0207f0d63e2fa6e Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 21 Jan 2017 15:24:25 -0600 Subject: [PATCH] ELF: Move ARMv6-M, ARMv7-M, and legacy ARM versions of ELF relocation logic to libc/machine --- arch/arm/src/c5471/Make.defs | 6 --- arch/arm/src/dm320/Make.defs | 6 --- arch/arm/src/efm32/Make.defs | 6 --- arch/arm/src/imx1/Make.defs | 6 --- arch/arm/src/kinetis/Make.defs | 6 --- arch/arm/src/kl/Make.defs | 6 --- arch/arm/src/lpc11xx/Make.defs | 6 --- arch/arm/src/lpc17xx/Make.defs | 6 --- arch/arm/src/lpc214x/Make.defs | 6 --- arch/arm/src/lpc2378/Make.defs | 6 --- arch/arm/src/lpc31xx/Make.defs | 6 --- arch/arm/src/lpc43xx/Make.defs | 6 --- arch/arm/src/moxart/Make.defs | 6 --- arch/arm/src/nuc1xx/Make.defs | 6 --- arch/arm/src/sam34/Make.defs | 6 --- arch/arm/src/samdl/Make.defs | 6 --- arch/arm/src/samv7/Make.defs | 4 +- arch/arm/src/stm32/Make.defs | 6 --- arch/arm/src/stm32f7/Make.defs | 4 +- arch/arm/src/stm32l4/Make.defs | 6 --- arch/arm/src/str71x/Make.defs | 6 --- arch/arm/src/tiva/Make.defs | 6 --- libc/machine/arm/Kconfig | 4 ++ libc/machine/arm/Make.defs | 10 ++++- libc/machine/arm/arm/Kconfig | 4 ++ libc/machine/arm/arm/Make.defs | 43 +++++++++++++++++++ .../machine/arm/arm/arch_elf.c | 6 +-- libc/machine/arm/armv6-m/Kconfig | 4 ++ libc/machine/arm/armv6-m/Make.defs | 43 +++++++++++++++++++ .../machine/arm/armv6-m/arch_elf.c | 4 +- libc/machine/arm/armv7-m/Make.defs | 10 +++++ .../machine/arm/armv7-m/arch_elf.c | 4 +- 32 files changed, 128 insertions(+), 132 deletions(-) create mode 100644 libc/machine/arm/arm/Kconfig create mode 100644 libc/machine/arm/arm/Make.defs rename arch/arm/src/arm/up_elf.c => libc/machine/arm/arm/arch_elf.c (98%) create mode 100644 libc/machine/arm/armv6-m/Kconfig create mode 100644 libc/machine/arm/armv6-m/Make.defs rename arch/arm/src/armv6-m/up_elf.c => libc/machine/arm/armv6-m/arch_elf.c (99%) rename arch/arm/src/armv7-m/up_elf.c => libc/machine/arm/armv7-m/arch_elf.c (99%) diff --git a/arch/arm/src/c5471/Make.defs b/arch/arm/src/c5471/Make.defs index 92320e5d48..a0c3b9a5b3 100644 --- a/arch/arm/src/c5471/Make.defs +++ b/arch/arm/src/c5471/Make.defs @@ -45,12 +45,6 @@ CMN_CSRCS += up_releasestack.c up_reprioritizertr.c up_schedulesigaction.c CMN_CSRCS += up_sigdeliver.c up_stackframe.c up_syscall.c up_unblocktask.c CMN_CSRCS += up_undefinedinsn.c up_usestack.c up_vfork.c -ifeq ($(CONFIG_ELF),y) -CMN_CSRCS += up_elf.c -else ifeq ($(CONFIG_MODULE),y) -CMN_CSRCS += up_elf.c -endif - ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif diff --git a/arch/arm/src/dm320/Make.defs b/arch/arm/src/dm320/Make.defs index ab9b2afa63..0c408f6624 100644 --- a/arch/arm/src/dm320/Make.defs +++ b/arch/arm/src/dm320/Make.defs @@ -46,12 +46,6 @@ CMN_CSRCS += up_reprioritizertr.c up_schedulesigaction.c CMN_CSRCS += up_sigdeliver.c up_stackframe.c up_syscall.c up_unblocktask.c CMN_CSRCS += up_undefinedinsn.c up_usestack.c up_vfork.c -ifeq ($(CONFIG_ELF),y) -CMN_CSRCS += up_elf.c -else ifeq ($(CONFIG_MODULE),y) -CMN_CSRCS += up_elf.c -endif - ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif diff --git a/arch/arm/src/efm32/Make.defs b/arch/arm/src/efm32/Make.defs index d87e5e5699..0b5ae3819f 100644 --- a/arch/arm/src/efm32/Make.defs +++ b/arch/arm/src/efm32/Make.defs @@ -75,12 +75,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_ELF),y) -CMN_CSRCS += up_elf.c -else ifeq ($(CONFIG_MODULE),y) -CMN_CSRCS += up_elf.c -endif - ifeq ($(CONFIG_ARCH_FPU),y) CMN_ASRCS += up_fpu.S ifneq ($(CONFIG_ARMV7M_CMNVECTOR),y) diff --git a/arch/arm/src/imx1/Make.defs b/arch/arm/src/imx1/Make.defs index 40999a4e5f..3a3b245da4 100644 --- a/arch/arm/src/imx1/Make.defs +++ b/arch/arm/src/imx1/Make.defs @@ -45,12 +45,6 @@ CMN_CSRCS += up_reprioritizertr.c up_schedulesigaction.c CMN_CSRCS += up_sigdeliver.c up_stackframe.c up_syscall.c up_unblocktask.c CMN_CSRCS += up_undefinedinsn.c up_usestack.c up_vfork.c -ifeq ($(CONFIG_ELF),y) -CMN_CSRCS += up_elf.c -else ifeq ($(CONFIG_MODULE),y) -CMN_CSRCS += up_elf.c -endif - ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif diff --git a/arch/arm/src/kinetis/Make.defs b/arch/arm/src/kinetis/Make.defs index c329d5fbc4..bd4eed0648 100644 --- a/arch/arm/src/kinetis/Make.defs +++ b/arch/arm/src/kinetis/Make.defs @@ -93,12 +93,6 @@ CMN_CSRCS += up_etherstub.c endif endif -ifeq ($(CONFIG_ELF),y) -CMN_CSRCS += up_elf.c -else ifeq ($(CONFIG_MODULE),y) -CMN_CSRCS += up_elf.c -endif - ifeq ($(CONFIG_ARCH_FPU),y) CMN_ASRCS += up_fpu.S ifneq ($(CONFIG_ARMV7M_CMNVECTOR),y) diff --git a/arch/arm/src/kl/Make.defs b/arch/arm/src/kl/Make.defs index 6af672fd46..e2d0046208 100644 --- a/arch/arm/src/kl/Make.defs +++ b/arch/arm/src/kl/Make.defs @@ -59,12 +59,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_ELF),y) -CMN_CSRCS += up_elf.c -else ifeq ($(CONFIG_MODULE),y) -CMN_CSRCS += up_elf.c -endif - ifeq ($(CONFIG_DEBUG_FEATURES),y) CMN_CSRCS += up_dumpnvic.c endif diff --git a/arch/arm/src/lpc11xx/Make.defs b/arch/arm/src/lpc11xx/Make.defs index d9fcb5e152..e45cd3e1a0 100644 --- a/arch/arm/src/lpc11xx/Make.defs +++ b/arch/arm/src/lpc11xx/Make.defs @@ -59,12 +59,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_ELF),y) -CMN_CSRCS += up_elf.c -else ifeq ($(CONFIG_MODULE),y) -CMN_CSRCS += up_elf.c -endif - ifeq ($(CONFIG_DEBUG_FEATURES),y) CMN_CSRCS += up_dumpnvic.c endif diff --git a/arch/arm/src/lpc17xx/Make.defs b/arch/arm/src/lpc17xx/Make.defs index 329999c997..115a3222a2 100644 --- a/arch/arm/src/lpc17xx/Make.defs +++ b/arch/arm/src/lpc17xx/Make.defs @@ -88,12 +88,6 @@ CMN_CSRCS += up_etherstub.c endif endif -ifeq ($(CONFIG_ELF),y) -CMN_CSRCS += up_elf.c -else ifeq ($(CONFIG_MODULE),y) -CMN_CSRCS += up_elf.c -endif - ifeq ($(CONFIG_ARCH_FPU),y) CMN_ASRCS += up_fpu.S ifneq ($(CONFIG_ARMV7M_CMNVECTOR),y) diff --git a/arch/arm/src/lpc214x/Make.defs b/arch/arm/src/lpc214x/Make.defs index ea9bc40449..d29207e927 100644 --- a/arch/arm/src/lpc214x/Make.defs +++ b/arch/arm/src/lpc214x/Make.defs @@ -50,12 +50,6 @@ ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_schedulesigaction.c up_sigdeliver.c endif -ifeq ($(CONFIG_ELF),y) -CMN_CSRCS += up_elf.c -else ifeq ($(CONFIG_MODULE),y) -CMN_CSRCS += up_elf.c -endif - ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif diff --git a/arch/arm/src/lpc2378/Make.defs b/arch/arm/src/lpc2378/Make.defs index a79ce91ddd..4926d02c74 100644 --- a/arch/arm/src/lpc2378/Make.defs +++ b/arch/arm/src/lpc2378/Make.defs @@ -54,12 +54,6 @@ ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_schedulesigaction.c up_sigdeliver.c endif -ifeq ($(CONFIG_ELF),y) -CMN_CSRCS += up_elf.c -else ifeq ($(CONFIG_MODULE),y) -CMN_CSRCS += up_elf.c -endif - ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif diff --git a/arch/arm/src/lpc31xx/Make.defs b/arch/arm/src/lpc31xx/Make.defs index 03c6c0bef6..0077b22a35 100644 --- a/arch/arm/src/lpc31xx/Make.defs +++ b/arch/arm/src/lpc31xx/Make.defs @@ -51,12 +51,6 @@ ifeq ($(CONFIG_PAGING),y) CMN_CSRCS += up_pginitialize.c up_checkmapping.c up_allocpage.c up_va2pte.c endif -ifeq ($(CONFIG_ELF),y) -CMN_CSRCS += up_elf.c -else ifeq ($(CONFIG_MODULE),y) -CMN_CSRCS += up_elf.c -endif - ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif diff --git a/arch/arm/src/lpc43xx/Make.defs b/arch/arm/src/lpc43xx/Make.defs index 1329d2b598..d68a19635b 100644 --- a/arch/arm/src/lpc43xx/Make.defs +++ b/arch/arm/src/lpc43xx/Make.defs @@ -72,12 +72,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_ELF),y) -CMN_CSRCS += up_elf.c -else ifeq ($(CONFIG_MODULE),y) -CMN_CSRCS += up_elf.c -endif - ifeq ($(CONFIG_ARCH_FPU),y) CMN_ASRCS += up_fpu.S ifneq ($(CONFIG_ARMV7M_CMNVECTOR),y) diff --git a/arch/arm/src/moxart/Make.defs b/arch/arm/src/moxart/Make.defs index 48b9a21fa0..f76a29cb0b 100644 --- a/arch/arm/src/moxart/Make.defs +++ b/arch/arm/src/moxart/Make.defs @@ -48,12 +48,6 @@ CMN_CSRCS += up_releasestack.c up_reprioritizertr.c up_schedulesigaction.c CMN_CSRCS += up_sigdeliver.c up_stackframe.c up_syscall.c up_unblocktask.c CMN_CSRCS += up_undefinedinsn.c up_usestack.c up_vfork.c up_etherstub.c -ifeq ($(CONFIG_ELF),y) -CMN_CSRCS += up_elf.c -else ifeq ($(CONFIG_MODULE),y) -CMN_CSRCS += up_elf.c -endif - CHIP_ASRCS = moxart_lowputc.S CHIP_CSRCS = moxart_16550.c moxart_irq.c moxart_timer.c moxart_idle.c diff --git a/arch/arm/src/nuc1xx/Make.defs b/arch/arm/src/nuc1xx/Make.defs index 7a5a00e85a..4a2164a838 100644 --- a/arch/arm/src/nuc1xx/Make.defs +++ b/arch/arm/src/nuc1xx/Make.defs @@ -59,12 +59,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_ELF),y) -CMN_CSRCS += up_elf.c -else ifeq ($(CONFIG_MODULE),y) -CMN_CSRCS += up_elf.c -endif - ifeq ($(CONFIG_DEBUG_FEATURES),y) CMN_CSRCS += up_dumpnvic.c endif diff --git a/arch/arm/src/sam34/Make.defs b/arch/arm/src/sam34/Make.defs index 71211da379..9ca9457430 100644 --- a/arch/arm/src/sam34/Make.defs +++ b/arch/arm/src/sam34/Make.defs @@ -84,12 +84,6 @@ CMN_UASRCS += up_signal_handler.S endif endif -ifeq ($(CONFIG_ELF),y) -CMN_CSRCS += up_elf.c -else ifeq ($(CONFIG_MODULE),y) -CMN_CSRCS += up_elf.c -endif - ifeq ($(CONFIG_ARCH_FPU),y) CMN_ASRCS += up_fpu.S ifneq ($(CONFIG_ARMV7M_CMNVECTOR),y) diff --git a/arch/arm/src/samdl/Make.defs b/arch/arm/src/samdl/Make.defs index 7ef0105780..6d177f2651 100644 --- a/arch/arm/src/samdl/Make.defs +++ b/arch/arm/src/samdl/Make.defs @@ -59,12 +59,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_ELF),y) -CMN_CSRCS += up_elf.c -else ifeq ($(CONFIG_MODULE),y) -CMN_CSRCS += up_elf.c -endif - ifeq ($(CONFIG_DEBUG_FEATURES),y) CMN_CSRCS += up_dumpnvic.c endif diff --git a/arch/arm/src/samv7/Make.defs b/arch/arm/src/samv7/Make.defs index fba21d3be3..fe5ab20b2c 100644 --- a/arch/arm/src/samv7/Make.defs +++ b/arch/arm/src/samv7/Make.defs @@ -102,9 +102,9 @@ endif endif ifeq ($(CONFIG_ELF),y) -CMN_CSRCS += up_elf.c up_coherent_dcache.c +CMN_CSRCS += up_coherent_dcache.c else ifeq ($(CONFIG_MODULE),y) -CMN_CSRCS += up_elf.c up_coherent_dcache.c +CMN_CSRCS += up_coherent_dcache.c endif ifeq ($(CONFIG_STACK_COLORATION),y) diff --git a/arch/arm/src/stm32/Make.defs b/arch/arm/src/stm32/Make.defs index ff7724411c..1558c8417d 100644 --- a/arch/arm/src/stm32/Make.defs +++ b/arch/arm/src/stm32/Make.defs @@ -83,12 +83,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_ELF),y) -CMN_CSRCS += up_elf.c -else ifeq ($(CONFIG_MODULE),y) -CMN_CSRCS += up_elf.c -endif - ifeq ($(CONFIG_ARCH_FPU),y) CMN_ASRCS += up_fpu.S ifneq ($(CONFIG_ARMV7M_CMNVECTOR),y) diff --git a/arch/arm/src/stm32f7/Make.defs b/arch/arm/src/stm32f7/Make.defs index ac475b3940..d25b702d67 100644 --- a/arch/arm/src/stm32f7/Make.defs +++ b/arch/arm/src/stm32f7/Make.defs @@ -96,9 +96,9 @@ endif endif ifeq ($(CONFIG_ELF),y) -CMN_CSRCS += up_elf.c up_coherent_dcache.c +CMN_CSRCS += up_coherent_dcache.c else ifeq ($(CONFIG_MODULE),y) -CMN_CSRCS += up_elf.c up_coherent_dcache.c +CMN_CSRCS += up_coherent_dcache.c endif ifeq ($(CONFIG_STACK_COLORATION),y) diff --git a/arch/arm/src/stm32l4/Make.defs b/arch/arm/src/stm32l4/Make.defs index 4a6f97979f..15b50d8692 100644 --- a/arch/arm/src/stm32l4/Make.defs +++ b/arch/arm/src/stm32l4/Make.defs @@ -95,12 +95,6 @@ ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif -ifeq ($(CONFIG_ELF),y) -CMN_CSRCS += up_elf.c up_coherent_dcache.c -else ifeq ($(CONFIG_MODULE),y) -CMN_CSRCS += up_elf.c up_coherent_dcache.c -endif - # Required STM32L4 files CHIP_ASRCS = diff --git a/arch/arm/src/str71x/Make.defs b/arch/arm/src/str71x/Make.defs index 00db6c3b8f..c9d9fc0869 100644 --- a/arch/arm/src/str71x/Make.defs +++ b/arch/arm/src/str71x/Make.defs @@ -50,12 +50,6 @@ ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_schedulesigaction.c up_sigdeliver.c endif -ifeq ($(CONFIG_ELF),y) -CMN_CSRCS += up_elf.c -else ifeq ($(CONFIG_MODULE),y) -CMN_CSRCS += up_elf.c -endif - ifeq ($(CONFIG_STACK_COLORATION),y) CMN_CSRCS += up_checkstack.c endif diff --git a/arch/arm/src/tiva/Make.defs b/arch/arm/src/tiva/Make.defs index 7a3110cc07..d65294d6c5 100644 --- a/arch/arm/src/tiva/Make.defs +++ b/arch/arm/src/tiva/Make.defs @@ -65,12 +65,6 @@ else CMN_CSRCS += up_allocateheap.c endif -ifeq ($(CONFIG_ELF),y) -CMN_CSRCS += up_elf.c -else ifeq ($(CONFIG_MODULE),y) -CMN_CSRCS += up_elf.c -endif - CHIP_ASRCS = CHIP_CSRCS = tiva_allocateheap.c tiva_start.c tiva_irq.c tiva_gpio.c CHIP_CSRCS += tiva_gpioirq.c tiva_lowputc.c tiva_serial.c tiva_ssi.c diff --git a/libc/machine/arm/Kconfig b/libc/machine/arm/Kconfig index 8d115c6ac3..4e01900960 100644 --- a/libc/machine/arm/Kconfig +++ b/libc/machine/arm/Kconfig @@ -11,6 +11,10 @@ if ARCH_CORTEXR4 || ARCH_CORTEXR4F || ARCH_CORTEXR5 || ARCH_CORTEXR5F || ARCH_CO source libc/machine/arm/armv7-r/Kconfig endif +if ARCH_CORTEXM0 +source libc/machine/arm/armv6-m/Kconfig +endif + if ARCH_CORTEXM3 || ARCH_CORTEXM4 || ARCH_CORTEXM7 source libc/machine/arm/armv7-m/Kconfig endif diff --git a/libc/machine/arm/Make.defs b/libc/machine/arm/Make.defs index e8ee7977f2..9bcd5b06ea 100644 --- a/libc/machine/arm/Make.defs +++ b/libc/machine/arm/Make.defs @@ -33,7 +33,13 @@ # ############################################################################ -ifeq ($(CONFIG_ARCH_CORTEXA5),y) # Cortex-A5 is ARMv7-A +ifeq ($(CONFIG_ARCH_ARM7TDMI),y) # ARM7TDMI is ARMv4T +include ${TOPDIR}/libc/machine/arm/arm/Make.defs +else ifeq ($(CONFIG_ARCH_ARM920T),y) # ARM920T is ARMv4T +include ${TOPDIR}/libc/machine/arm/arm/Make.defs +else ifeq ($(CONFIG_ARCH_ARM926EJS),y) # ARM926EJS is ARMv5TE +include ${TOPDIR}/libc/machine/arm/arm/Make.defs +else ifeq ($(CONFIG_ARCH_CORTEXA5),y) # Cortex-A5 is ARMv7-A include ${TOPDIR}/libc/machine/arm/armv7-a/Make.defs else ifeq ($(CONFIG_ARCH_CORTEXA8),y) # Cortex-A8 is ARMv7-A include ${TOPDIR}/libc/machine/arm/armv7-a/Make.defs @@ -51,6 +57,8 @@ else ifeq ($(CONFIG_ARCH_CORTEXR7),y) # Cortex-R7 is ARMv7-R include ${TOPDIR}/libc/machine/arm/armv7-r/Make.defs else ifeq ($(CONFIG_ARCH_CORTEXR7F),y) # Cortex-R7F is ARMv7-R include ${TOPDIR}/libc/machine/arm/armv7-r/Make.defs +else ifeq ($(CONFIG_ARCH_CORTEXM0),y) # Cortex-M0 is ARMv6-M +include ${TOPDIR}/libc/machine/arm/armv6-m/Make.defs else ifeq ($(CONFIG_ARCH_CORTEXM3),y) # Cortex-M3 is ARMv7-M include ${TOPDIR}/libc/machine/arm/armv7-m/Make.defs else ifeq ($(CONFIG_ARCH_CORTEXM33),y) # Cortex-M33 is ARMv8-M diff --git a/libc/machine/arm/arm/Kconfig b/libc/machine/arm/arm/Kconfig new file mode 100644 index 0000000000..f72f3c094c --- /dev/null +++ b/libc/machine/arm/arm/Kconfig @@ -0,0 +1,4 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# diff --git a/libc/machine/arm/arm/Make.defs b/libc/machine/arm/arm/Make.defs new file mode 100644 index 0000000000..d5632227c7 --- /dev/null +++ b/libc/machine/arm/arm/Make.defs @@ -0,0 +1,43 @@ +############################################################################ +# libc/machine/arm/arm/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_LIBC_ARCH_ELF),y) + +CSRCS += arch_elf.c + +DEPPATH += --dep-path machine/arm/arm +VPATH += :machine/arm/arm + +endif diff --git a/arch/arm/src/arm/up_elf.c b/libc/machine/arm/arm/arch_elf.c similarity index 98% rename from arch/arm/src/arm/up_elf.c rename to libc/machine/arm/arm/arch_elf.c index c6d88bdc32..b92d399c4f 100644 --- a/arch/arm/src/arm/up_elf.c +++ b/libc/machine/arm/arm/arch_elf.c @@ -1,7 +1,7 @@ /**************************************************************************** - * arch/arm/src/arm/up_elf.c + * libc/machine/arm/arm/up_elf.c * - * Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2014, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -115,7 +115,7 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr) if ((ehdr->e_entry & 3) != 0) { berr("ERROR: Entry point is not properly aligned: %08x\n", ehdr->e_entry); - return -ENOEXEC + return -ENOEXEC; } /* TODO: Check ABI here. */ diff --git a/libc/machine/arm/armv6-m/Kconfig b/libc/machine/arm/armv6-m/Kconfig new file mode 100644 index 0000000000..f72f3c094c --- /dev/null +++ b/libc/machine/arm/armv6-m/Kconfig @@ -0,0 +1,4 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# diff --git a/libc/machine/arm/armv6-m/Make.defs b/libc/machine/arm/armv6-m/Make.defs new file mode 100644 index 0000000000..36addcd441 --- /dev/null +++ b/libc/machine/arm/armv6-m/Make.defs @@ -0,0 +1,43 @@ +############################################################################ +# libc/machine/arm/armv6-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_LIBC_ARCH_ELF),y) + +CSRCS += arch_elf.c + +DEPPATH += --dep-path machine/arm/armv6-m +VPATH += :machine/arm/armv6-m + +endif diff --git a/arch/arm/src/armv6-m/up_elf.c b/libc/machine/arm/armv6-m/arch_elf.c similarity index 99% rename from arch/arm/src/armv6-m/up_elf.c rename to libc/machine/arm/armv6-m/arch_elf.c index 7bde5d0110..b6479b3b2f 100644 --- a/arch/arm/src/armv6-m/up_elf.c +++ b/libc/machine/arm/armv6-m/arch_elf.c @@ -1,7 +1,7 @@ /**************************************************************************** - * arch/arm/src/armv6-m/up_elf.c + * libc/machine/arm/armv6-m/up_elf.c * - * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2014, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without diff --git a/libc/machine/arm/armv7-m/Make.defs b/libc/machine/arm/armv7-m/Make.defs index 634ba38819..a9985a70b8 100644 --- a/libc/machine/arm/armv7-m/Make.defs +++ b/libc/machine/arm/armv7-m/Make.defs @@ -41,3 +41,13 @@ DEPPATH += --dep-path machine/arm/armv7-m/gnu VPATH += :machine/arm/armv7-m/gnu endif + +ifeq ($(CONFIG_LIBC_ARCH_ELF),y) + +CSRCS += arch_elf.c + +DEPPATH += --dep-path machine/arm/armv7-m +VPATH += :machine/arm/armv7-m + +endif + diff --git a/arch/arm/src/armv7-m/up_elf.c b/libc/machine/arm/armv7-m/arch_elf.c similarity index 99% rename from arch/arm/src/armv7-m/up_elf.c rename to libc/machine/arm/armv7-m/arch_elf.c index f2e0cdd979..11ea2c0935 100644 --- a/arch/arm/src/armv7-m/up_elf.c +++ b/libc/machine/arm/armv7-m/arch_elf.c @@ -1,7 +1,7 @@ /**************************************************************************** - * arch/arm/src/armv7-m/up_elf.c + * libc/machine/arm/armv7-m/up_elf.c * - * Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2014, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without