From bd2da2f543f8b52b1a30276eb0ffa42ff2442a3c Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 2 Apr 2016 07:53:52 -0600 Subject: [PATCH] ARMv7-M: Add toolchain option to select the IAR tools. Move ARMv7-M assembly language into a gnu/ subdirectory. Makefile selects iar/ or gnu/ directory based upon tool configuration --- arch/arm/Kconfig | 8 ++++++ arch/arm/src/Makefile | 28 ++++++++++++------- arch/arm/src/armv7-m/Kconfig | 21 ++++++++++++++ arch/arm/src/armv7-m/Toolchain.defs | 2 +- arch/arm/src/armv7-m/{ => gnu}/up_exception.S | 4 +-- arch/arm/src/armv7-m/{ => gnu}/up_fpu.S | 4 +-- .../armv7-m/{ => gnu}/up_fullcontextrestore.S | 4 +-- .../src/armv7-m/{ => gnu}/up_lazyexception.S | 4 +-- arch/arm/src/armv7-m/{ => gnu}/up_memcpy.S | 2 +- .../armv7-m/{ => gnu}/up_saveusercontext.S | 4 +-- .../src/armv7-m/{ => gnu}/up_signal_handler.S | 4 +-- .../src/armv7-m/{ => gnu}/up_switchcontext.S | 4 +-- arch/arm/src/armv7-m/{ => gnu}/up_testset.S | 2 +- arch/arm/src/armv7-m/{ => gnu}/vfork.S | 4 +-- arch/arm/src/stm32/stm32_start.c | 2 +- 15 files changed, 67 insertions(+), 30 deletions(-) rename arch/arm/src/armv7-m/{ => gnu}/up_exception.S (98%) rename arch/arm/src/armv7-m/{ => gnu}/up_fpu.S (98%) rename arch/arm/src/armv7-m/{ => gnu}/up_fullcontextrestore.S (96%) rename arch/arm/src/armv7-m/{ => gnu}/up_lazyexception.S (99%) rename arch/arm/src/armv7-m/{ => gnu}/up_memcpy.S (99%) rename arch/arm/src/armv7-m/{ => gnu}/up_saveusercontext.S (97%) rename arch/arm/src/armv7-m/{ => gnu}/up_signal_handler.S (97%) rename arch/arm/src/armv7-m/{ => gnu}/up_switchcontext.S (96%) rename arch/arm/src/armv7-m/{ => gnu}/up_testset.S (99%) rename arch/arm/src/armv7-m/{ => gnu}/vfork.S (98%) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 52f914d9b6..fd960282a1 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -425,6 +425,14 @@ config ARCH_CHIP default "tms570" if ARCH_CHIP_TMS570 default "moxart" if ARCH_CHIP_MOXART +config ARM_TOOLCHAIN_IAR + bool + default n + +config ARM_TOOLCHAIN_GNU + bool + default n + config ARMV7M_USEBASEPRI bool "Use BASEPRI Register" default n diff --git a/arch/arm/src/Makefile b/arch/arm/src/Makefile index c9f89ef76a..e74c0cfc28 100644 --- a/arch/arm/src/Makefile +++ b/arch/arm/src/Makefile @@ -34,7 +34,7 @@ ############################################################################ -include $(TOPDIR)/Make.defs --include chip/Make.defs +-include chip$(DELIM)Make.defs ifeq ($(CONFIG_ARCH_CORTEXA5),y) # Cortex-A5 is ARMv7-A ARCH_SUBDIR = armv7-a @@ -167,9 +167,17 @@ VPATH += chip VPATH += common VPATH += $(ARCH_SUBDIR) +ifeq ($(CONFIG_ARM_TOOLCHAIN_IAR),y) + VPATH += chip$(DELIM)iar + VPATH += $(ARCH_SUBDIR)$(DELIM)iar +else # ifeq ($(CONFIG_ARM_TOOLCHAIN_GNU),y) + VPATH += chip$(DELIM)gnu + VPATH += $(ARCH_SUBDIR)$(DELIM)gnu +endif + all: $(HEAD_OBJ) $(BIN) -.PHONY: board/libboard$(LIBEXT) +.PHONY: board$(DELIM)libboard$(LIBEXT) $(AOBJS) $(UAOBJS) $(HEAD_OBJ): %$(OBJEXT): %.S $(call ASSEMBLE, $<, $@) @@ -183,10 +191,10 @@ $(BIN) $(KBIN): $(OBJS) $(UBIN): $(UOBJS) $(call ARCHIVE, $@, $(UOBJS)) -board/libboard$(LIBEXT): +board$(DELIM)libboard$(LIBEXT): $(Q) $(MAKE) -C board TOPDIR="$(TOPDIR)" libboard$(LIBEXT) EXTRADEFINES=$(EXTRADEFINES) -nuttx$(EXEEXT): $(HEAD_OBJ) board/libboard$(LIBEXT) +nuttx$(EXEEXT): $(HEAD_OBJ) board$(DELIM)libboard$(LIBEXT) $(Q) echo "LD: nuttx" $(Q) $(LD) --entry=__start $(LDFLAGS) $(LIBPATHS) $(EXTRA_LIBPATHS) \ -o $(NUTTX) $(HEAD_OBJ) $(EXTRA_OBJS) \ @@ -194,26 +202,26 @@ nuttx$(EXEEXT): $(HEAD_OBJ) board/libboard$(LIBEXT) ifneq ($(CONFIG_WINDOWS_NATIVE),y) $(Q) $(NM) $(NUTTX) | \ grep -v '\(compiled\)\|\(\$(OBJEXT)$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \ - sort > $(TOPDIR)/System.map + sort > $(TOPDIR)$(DELIM)System.map endif # This is part of the top-level export target # Note that there may not be a head object if layout is handled # by the linker configuration. -export_startup: board/libboard$(LIBEXT) $(STARTUP_OBJS) +export_startup: board$(DELIM)libboard$(LIBEXT) $(STARTUP_OBJS) ifneq ($(STARTUP_OBJS),) - $(Q) if [ -d "$(EXPORT_DIR)/startup" ]; then \ - cp -f $(STARTUP_OBJS) "$(EXPORT_DIR)/startup/."; \ + $(Q) if [ -d "$(EXPORT_DIR)$(DELIM)startup" ]; then \ + cp -f $(STARTUP_OBJS) "$(EXPORT_DIR)$(DELIM)startup$(DELIM)."; \ else \ - echo "$(EXPORT_DIR)/startup does not exist"; \ + echo "$(EXPORT_DIR)$(DELIM)startup does not exist"; \ exit 1; \ fi endif # Dependencies -.depend: Makefile chip/Make.defs $(SRCS) +.depend: Makefile chip$(DELIM)Make.defs $(SRCS) ifeq ($(BOARDMAKE),y) $(Q) $(MAKE) -C board TOPDIR="$(TOPDIR)" depend endif diff --git a/arch/arm/src/armv7-m/Kconfig b/arch/arm/src/armv7-m/Kconfig index 8c59384ace..406e2e4662 100644 --- a/arch/arm/src/armv7-m/Kconfig +++ b/arch/arm/src/armv7-m/Kconfig @@ -51,36 +51,55 @@ choice default ARMV7M_TOOLCHAIN_GNU_EABIW if HOST_WINDOWS default ARMV7M_TOOLCHAIN_GNU_EABIL if !HOST_WINDOWS +config ARMV7M_TOOLCHAIN_IARW + bool "IAR for Windows" + depends on HOST_WINDOWS + select ARM_TOOLCHAIN_IAR + +config ARMV7M_TOOLCHAIN_IARL + bool "IAR for Linux" + depends on HOST_LINUX + select ARM_TOOLCHAIN_IAR + config ARMV7M_TOOLCHAIN_ATOLLIC bool "Atollic Lite/Pro for Windows" depends on HOST_WINDOWS + select ARM_TOOLCHAIN_GNU config ARMV7M_TOOLCHAIN_BUILDROOT bool "Buildroot (Cygwin or Linux)" depends on !WINDOWS_NATIVE + select ARM_TOOLCHAIN_GNU config ARMV7M_TOOLCHAIN_CODEREDL bool "CodeRed for Linux" depends on HOST_LINUX + select ARM_TOOLCHAIN_GNU config ARMV7M_TOOLCHAIN_CODEREDW bool "CodeRed for Windows" depends on HOST_WINDOWS + select ARM_TOOLCHAIN_GNU config ARMV7M_TOOLCHAIN_CODESOURCERYL bool "CodeSourcery GNU toolchain under Linux" depends on HOST_LINUX + select ARM_TOOLCHAIN_GNU config ARMV7M_TOOLCHAIN_CODESOURCERYW bool "CodeSourcery GNU toolchain under Windows" depends on HOST_WINDOWS + select ARM_TOOLCHAIN_GNU config ARMV7M_TOOLCHAIN_DEVKITARM bool "devkitARM GNU toolchain" depends on HOST_WINDOWS + select ARM_TOOLCHAIN_GNU config ARMV7M_TOOLCHAIN_GNU_EABIL bool "Generic GNU EABI toolchain under Linux (or other POSIX environment)" + depends on !WINDOWS_NATIVE + select ARM_TOOLCHAIN_GNU ---help--- This option should work for any modern GNU toolchain (GCC 4.5 or newer) configured for arm-none-eabi. @@ -88,6 +107,7 @@ config ARMV7M_TOOLCHAIN_GNU_EABIL config ARMV7M_TOOLCHAIN_GNU_EABIW bool "Generic GNU EABI toolchain under Windows" depends on HOST_WINDOWS + select ARM_TOOLCHAIN_GNU ---help--- This option should work for any modern GNU toolchain (GCC 4.5 or newer) configured for arm-none-eabi. @@ -95,6 +115,7 @@ config ARMV7M_TOOLCHAIN_GNU_EABIW config ARMV7M_TOOLCHAIN_RAISONANCE bool "STMicro Raisonance for Windows" depends on HOST_WINDOWS + select ARM_TOOLCHAIN_GNU endchoice diff --git a/arch/arm/src/armv7-m/Toolchain.defs b/arch/arm/src/armv7-m/Toolchain.defs index 9d5ce9ce18..8cfcaa3e1d 100644 --- a/arch/arm/src/armv7-m/Toolchain.defs +++ b/arch/arm/src/armv7-m/Toolchain.defs @@ -1,7 +1,7 @@ ############################################################################ # arch/arm/src/armv7-m/Toolchain.defs # -# Copyright (C) 2012-2013, 2015 Gregory Nutt. All rights reserved. +# Copyright (C) 2012-2013, 2015-2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without diff --git a/arch/arm/src/armv7-m/up_exception.S b/arch/arm/src/armv7-m/gnu/up_exception.S similarity index 98% rename from arch/arm/src/armv7-m/up_exception.S rename to arch/arm/src/armv7-m/gnu/up_exception.S index 1682e70e17..0010136b03 100644 --- a/arch/arm/src/armv7-m/up_exception.S +++ b/arch/arm/src/armv7-m/gnu/up_exception.S @@ -1,7 +1,7 @@ /************************************************************************************ - * arch/arm/src/armv7-m/up_exception.S + * arch/arm/src/armv7-m/gnu/up_exception.S * - * Copyright (C) 2009-2013, 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2013, 2015-2016 Gregory Nutt. All rights reserved. * Copyright (C) 2012 Michael Smith. All rights reserved. * Author: Gregory Nutt * diff --git a/arch/arm/src/armv7-m/up_fpu.S b/arch/arm/src/armv7-m/gnu/up_fpu.S similarity index 98% rename from arch/arm/src/armv7-m/up_fpu.S rename to arch/arm/src/armv7-m/gnu/up_fpu.S index c75b27c3b6..6c9dd28fba 100644 --- a/arch/arm/src/armv7-m/up_fpu.S +++ b/arch/arm/src/armv7-m/gnu/up_fpu.S @@ -1,7 +1,7 @@ /************************************************************************************ - * arch/arm/src/armv7-m/up_fpu.S + * arch/arm/src/armv7-m/gnu/up_fpu.S * - * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2012, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without diff --git a/arch/arm/src/armv7-m/up_fullcontextrestore.S b/arch/arm/src/armv7-m/gnu/up_fullcontextrestore.S similarity index 96% rename from arch/arm/src/armv7-m/up_fullcontextrestore.S rename to arch/arm/src/armv7-m/gnu/up_fullcontextrestore.S index 46d482248d..a9ccb0d572 100644 --- a/arch/arm/src/armv7-m/up_fullcontextrestore.S +++ b/arch/arm/src/armv7-m/gnu/up_fullcontextrestore.S @@ -1,7 +1,7 @@ /************************************************************************************ - * arch/arm/src/armv7-m/up_fullcontextrestore.S + * arch/arm/src/armv7-m/gnu/up_fullcontextrestore.S * - * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without diff --git a/arch/arm/src/armv7-m/up_lazyexception.S b/arch/arm/src/armv7-m/gnu/up_lazyexception.S similarity index 99% rename from arch/arm/src/armv7-m/up_lazyexception.S rename to arch/arm/src/armv7-m/gnu/up_lazyexception.S index cf43556481..08ce8be75c 100644 --- a/arch/arm/src/armv7-m/up_lazyexception.S +++ b/arch/arm/src/armv7-m/gnu/up_lazyexception.S @@ -1,7 +1,7 @@ /************************************************************************************************ - * arch/arm/src/armv7-m/up_lazyexcption.S + * arch/arm/src/armv7-m/gnu/up_lazyexcption.S * - * Copyright (C) 2009-2010, 2013-2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2010, 2013-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without diff --git a/arch/arm/src/armv7-m/up_memcpy.S b/arch/arm/src/armv7-m/gnu/up_memcpy.S similarity index 99% rename from arch/arm/src/armv7-m/up_memcpy.S rename to arch/arm/src/armv7-m/gnu/up_memcpy.S index 4144455081..cf34648d01 100644 --- a/arch/arm/src/armv7-m/up_memcpy.S +++ b/arch/arm/src/armv7-m/gnu/up_memcpy.S @@ -1,5 +1,5 @@ /************************************************************************************ - * nuttx/arch/arm/src/armv7-m/up_memcpy.S + * nuttx/arch/arm/src/armv7-m/gnu/up_memcpy.S * * armv7m-optimised memcpy, contributed by Mike Smith. Apparently in the public * domain and is re-released here under the modified BSD license: diff --git a/arch/arm/src/armv7-m/up_saveusercontext.S b/arch/arm/src/armv7-m/gnu/up_saveusercontext.S similarity index 97% rename from arch/arm/src/armv7-m/up_saveusercontext.S rename to arch/arm/src/armv7-m/gnu/up_saveusercontext.S index 72f1526ea1..7ebd2e4836 100644 --- a/arch/arm/src/armv7-m/up_saveusercontext.S +++ b/arch/arm/src/armv7-m/gnu/up_saveusercontext.S @@ -1,7 +1,7 @@ /************************************************************************************ - * arch/arm/src/armv7-m/up_saveusercontext.S + * arch/arm/src/armv7-m/gnu/up_saveusercontext.S * - * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without diff --git a/arch/arm/src/armv7-m/up_signal_handler.S b/arch/arm/src/armv7-m/gnu/up_signal_handler.S similarity index 97% rename from arch/arm/src/armv7-m/up_signal_handler.S rename to arch/arm/src/armv7-m/gnu/up_signal_handler.S index e220ddf107..2cc31da4d1 100644 --- a/arch/arm/src/armv7-m/up_signal_handler.S +++ b/arch/arm/src/armv7-m/gnu/up_signal_handler.S @@ -1,7 +1,7 @@ /**************************************************************************** - * arch/arm/src/armv7-m/up_signal_handler.S + * arch/arm/src/armv7-m/gnu/up_signal_handler.S * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without diff --git a/arch/arm/src/armv7-m/up_switchcontext.S b/arch/arm/src/armv7-m/gnu/up_switchcontext.S similarity index 96% rename from arch/arm/src/armv7-m/up_switchcontext.S rename to arch/arm/src/armv7-m/gnu/up_switchcontext.S index 9e51652356..c0ddf15162 100644 --- a/arch/arm/src/armv7-m/up_switchcontext.S +++ b/arch/arm/src/armv7-m/gnu/up_switchcontext.S @@ -1,7 +1,7 @@ /************************************************************************************ - * arch/arm/src/armv7-m/up_switchcontext.S + * arch/arm/src/armv7-m/gnu/up_switchcontext.S * - * Copyright (C) 2009-2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2011, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without diff --git a/arch/arm/src/armv7-m/up_testset.S b/arch/arm/src/armv7-m/gnu/up_testset.S similarity index 99% rename from arch/arm/src/armv7-m/up_testset.S rename to arch/arm/src/armv7-m/gnu/up_testset.S index c7be199bb7..7dd45eee4d 100644 --- a/arch/arm/src/armv7-m/up_testset.S +++ b/arch/arm/src/armv7-m/gnu/up_testset.S @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/armv7-m/up_testset.S + * arch/arm/src/armv7-m/gnu/up_testset.S * * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/arch/arm/src/armv7-m/vfork.S b/arch/arm/src/armv7-m/gnu/vfork.S similarity index 98% rename from arch/arm/src/armv7-m/vfork.S rename to arch/arm/src/armv7-m/gnu/vfork.S index a0d0c15502..784ab83ce7 100644 --- a/arch/arm/src/armv7-m/vfork.S +++ b/arch/arm/src/armv7-m/gnu/vfork.S @@ -1,7 +1,7 @@ /************************************************************************************ - * arch/arm/src/armv7-m/vfork.S + * arch/arm/src/armv7-m/gnu/vfork.S * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without diff --git a/arch/arm/src/stm32/stm32_start.c b/arch/arm/src/stm32/stm32_start.c index 9c2906dc8b..b808670ee6 100644 --- a/arch/arm/src/stm32/stm32_start.c +++ b/arch/arm/src/stm32/stm32_start.c @@ -280,7 +280,7 @@ void __start(void) * certain that there are no issues with the state of global variables. */ - for (dest = _START_BSS; dest < __END_BSS; ) + for (dest = _START_BSS; dest < _END_BSS; ) { *dest++ = 0; }