Skip to content

Commit

Permalink
tools/scripts/Make.defs: Change build system with nuttx update
Browse files Browse the repository at this point in the history
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
  • Loading branch information
SPRESENSE committed Nov 7, 2022
1 parent cbc27d2 commit f2e9fca
Showing 1 changed file with 10 additions and 43 deletions.
53 changes: 10 additions & 43 deletions sdk/tools/scripts/Make.defs
Expand Up @@ -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
Expand All @@ -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__
Expand All @@ -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
Expand Down

0 comments on commit f2e9fca

Please sign in to comment.