From f2e9fca8ef7945b5adf96850597673f014c6a474 Mon Sep 17 00:00:00 2001 From: SPRESENSE <41312067+SPRESENSE@users.noreply.github.com> Date: Thu, 22 Sep 2022 19:49:16 +0900 Subject: [PATCH] tools/scripts/Make.defs: Change build system with nuttx update Reflect thease changes of nuttx/boards/arm/cxd56xx/spresense/scripts/Make.defs * Move warning option from Make.defs to Toolchain.defs * boards: Move -fno-strict-aliasing from Make.defs to Toolchain.defs * boards: Remove -std=c++1x from Make.defs * boards: Move -g from Make.defs to Toolchain.defs * boards: Move -fno-common from Make.defs to Toolchain.defs * boards: Switch the elf link script to binfmt/libelf/gnu-elf.ld * compile/opt: add config DEBUG_LINK_MAP * compile/opt: add config DEBUG_OPT_UNUSED_SECTIONS * arch/arm: Make CXX exception and RTTI depend on Kconfig options * boards/Kconfig: introduce ARCH_BOARD_COMMON option * boards: Remove -fno-builtin * boards: Add -fno-common to ARCHCFLAGS and ARCHCXXFLAGS * boards: Replace CONFIG_CYGWIN_WINTOOL with CONVERT_PATH * Remove duplicate linker script definitions * board: Remove -fno-strength-reduce * compile/flags: remove redundant -fomit-frame-pointer from board flags --- sdk/tools/scripts/Make.defs | 53 +++++++------------------------------ 1 file changed, 10 insertions(+), 43 deletions(-) diff --git a/sdk/tools/scripts/Make.defs b/sdk/tools/scripts/Make.defs index 5aff06b1f..1588edee5 100644 --- a/sdk/tools/scripts/Make.defs +++ b/sdk/tools/scripts/Make.defs @@ -25,7 +25,7 @@ include $(TOPDIR)/arch/arm/src/armv7-m/Toolchain.defs # Setup for the kind of memory that we are executing from -ifeq ($(CONFIG_CXD56_USE_SYSBUS), y) +ifeq ($(CONFIG_CXD56_USE_SYSBUS),y) LDSCRIPT = ramconfig-new.ld else LDSCRIPT = ramconfig.ld @@ -39,36 +39,25 @@ ifeq ($(CONFIG_CYGWIN_WINTOOL),y) ARCHINCLUDES += -isystem "${shell cygpath -w $(SDKDIR)/include}" ARCHXXINCLUDES += -I. ARCHXXINCLUDES += -isystem "${shell cygpath -w $(SDKDIR)/include}" - ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)}" else # TODO: ARCHINCLUDES/ARCHXXINCLUDES need to move as nuttx change ARCHINCLUDES += -I. ARCHINCLUDES += -isystem $(SDKDIR)/include ARCHXXINCLUDES += -I. ARCHXXINCLUDES += -isystem $(SDKDIR)/include - ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT) endif +ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT) + MKNXFLAT = mknxflat LDNXFLAT = ldnxflat -ifeq ($(CONFIG_DEBUG_SYMBOLS),y) - ARCHOPTIMIZATION = -g -endif - -ifneq ($(CONFIG_DEBUG_NOOPT),y) - ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer -endif - -ARCHCFLAGS = -fno-builtin -mabi=aapcs -ffunction-sections -fdata-sections -ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti -std=c++11 -ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -ARCHWARNINGSXX = -Wall -Wshadow -Wundef +ARCHCFLAGS += -mabi=aapcs ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10 -CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe +CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) -CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe +CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS) CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) AFLAGS := $(CFLAGS) -D__ASSEMBLY__ @@ -82,40 +71,18 @@ LDNXFLATFLAGS = -e main -s 2048 CMODULEFLAGS = $(CFLAGS) -mlong-calls # --target1-abs LDMODULEFLAGS = -r -e module_initialize -ifeq ($(CONFIG_CYGWIN_WINTOOL),y) - LDMODULEFLAGS += -T "${shell cygpath -w $(TOPDIR)/libs/libc/modlib/gnu-elf.ld}" -else - LDMODULEFLAGS += -T $(TOPDIR)/libs/libc/modlib/gnu-elf.ld -endif +LDMODULEFLAGS += -T $(call CONVERT_PATH,$(TOPDIR)/libs/libc/modlib/gnu-elf.ld) # ELF module definitions -CELFFLAGS = $(CFLAGS) -fno-common -CXXELFFLAGS = $(CXXFLAGS) -fno-common +CELFFLAGS = $(CFLAGS) +CXXELFFLAGS = $(CXXFLAGS) LDELFFLAGS = -r -e main -ifeq ($(CONFIG_CYGWIN_WINTOOL),y) - LDELFFLAGS += -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)gnu-elf.ld}" -else - LDELFFLAGS += -T $(BOARD_DIR)$(DELIM)scripts$(DELIM)gnu-elf.ld -endif - -LDFLAGS += --gc-sections - -ifeq ($(CONFIG_DEBUG_SYMBOLS),y) - CFLAGS += -gdwarf-3 - CXXFLAGS += -gdwarf-3 - LDFLAGS += -g -endif +LDELFFLAGS += -T $(call CONVERT_PATH,$(TOPDIR)/binfmt/libelf/gnu-elf.ld) # Output map file with cross reference table -ifeq ($(CONFIG_CYGWIN_WINTOOL),y) - LDFLAGS += -Map="${shell cygpath -w $(TOPDIR)/nuttx.map}" --cref -else - LDFLAGS += -Map=$(TOPDIR)/nuttx.map --cref -endif - ifneq ($(CONFIG_ASMP_MEMSIZE),) LDFLAGS += --defsym=__reserved_ramsize=$(CONFIG_ASMP_MEMSIZE) endif