diff --git a/boards/xtensa/esp32/common/kernel/Makefile b/boards/xtensa/esp32/common/kernel/Makefile index c29e3c5f71f..e5fe0297116 100644 --- a/boards/xtensa/esp32/common/kernel/Makefile +++ b/boards/xtensa/esp32/common/kernel/Makefile @@ -29,12 +29,12 @@ ENTRYPT = $(patsubst "%",%,$(CONFIG_INIT_ENTRYPOINT)) # is appropriate for the host OS USER_LIBPATHS = $(addprefix -L,$(call CONVERT_PATH,$(addprefix $(TOPDIR)$(DELIM),$(dir $(USERLIBS))))) -USER_LDSCRIPT = -T $(call CONVERT_PATH,$(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_out.ld) -USER_LDSCRIPT += -T $(call CONVERT_PATH,$(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)user-space.ld) +USER_LDSCRIPT = $(call CONVERT_PATH,$(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)protected_memory.ld) +USER_LDSCRIPT += $(call CONVERT_PATH,$(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)user-space.ld) USER_HEXFILE += $(call CONVERT_PATH,$(TOPDIR)$(DELIM)nuttx_user.hex) USER_BINFILE += $(call CONVERT_PATH,$(TOPDIR)$(DELIM)nuttx_user.bin) -USER_LDFLAGS = --undefined=$(ENTRYPT) --entry=$(ENTRYPT) $(USER_LDSCRIPT) +USER_LDFLAGS = --undefined=$(ENTRYPT) --entry=$(ENTRYPT) $(addprefix -T,$(addsuffix .tmp,$(USER_LDSCRIPT))) ifeq ($(CONFIG_DEBUG_LINK_MAP),y) USER_LDFLAGS += --cref -Map="$(TOPDIR)$(DELIM)User.map" @@ -67,9 +67,12 @@ all: $(TOPDIR)$(DELIM)nuttx_user.elf $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) +$(addsuffix .tmp,$(USER_LDSCRIPT)): $(USER_LDSCRIPT) + $(call PREPROCESS,$(patsubst %.tmp,%,$@),$@) + # Create the nuttx_user.elf file containing all of the user-mode code -nuttx_user.elf: $(OBJS) +nuttx_user.elf: $(OBJS) $(addsuffix .tmp,$(USER_LDSCRIPT)) $(Q) $(LD) -o $@ $(USER_LDFLAGS) $(USER_LIBPATHS) $(OBJS) $(LDSTARTGROUP) $(USER_LDLIBS) $(LDENDGROUP) $(USER_LIBGCC) $(TOPDIR)$(DELIM)nuttx_user.elf: nuttx_user.elf @@ -83,6 +86,7 @@ ifeq ($(CONFIG_RAW_BINARY),y) $(Q) echo "CP: nuttx_user.bin" $(Q) $(OBJCOPY) $(OBJCOPYARGS) -O binary nuttx_user.elf $(USER_BINFILE) endif + $(Q) $(call DELFILE,$(addsuffix .tmp,$(USER_LDSCRIPT))) .depend: diff --git a/boards/xtensa/esp32/common/scripts/.gitignore b/boards/xtensa/esp32/common/scripts/.gitignore new file mode 100644 index 00000000000..0fa3d8108a5 --- /dev/null +++ b/boards/xtensa/esp32/common/scripts/.gitignore @@ -0,0 +1 @@ +/*.ld.tmp diff --git a/boards/xtensa/esp32/esp32-devkitc/scripts/.gitignore b/boards/xtensa/esp32/esp32-devkitc/scripts/.gitignore deleted file mode 100644 index 461270524bd..00000000000 --- a/boards/xtensa/esp32/esp32-devkitc/scripts/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/esp32_out.ld diff --git a/boards/xtensa/esp32/esp32-devkitc/scripts/Make.defs b/boards/xtensa/esp32/esp32-devkitc/scripts/Make.defs index 7b5f696dd1a..f4948996cba 100644 --- a/boards/xtensa/esp32/esp32-devkitc/scripts/Make.defs +++ b/boards/xtensa/esp32/esp32-devkitc/scripts/Make.defs @@ -23,42 +23,22 @@ include $(TOPDIR)/tools/Config.mk include $(TOPDIR)/tools/esp32/Config.mk include $(TOPDIR)/arch/xtensa/src/lx6/Toolchain.defs -# This is the generated memory layout linker script. It will always be -# generated at the board level. - -ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_out.ld +ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld # Pick the linker scripts from the board level if they exist, if not # pick the common linker scripts. -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_sections.ld),) - ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_sections.ld +ifeq ($(CONFIG_BUILD_PROTECTED),y) + ARCHSCRIPT += $(call FINDSCRIPT,protected_memory.ld) + ARCHSCRIPT += $(call FINDSCRIPT,kernel-space.ld) else - ifeq ($(CONFIG_BUILD_PROTECTED),y) - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)kernel-space.ld - else - ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y) - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)mcuboot_sections.ld - else - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)legacy_sections.ld - endif - endif -endif + ARCHSCRIPT += $(call FINDSCRIPT,flat_memory.ld) -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld),) - ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld -else - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld -endif - -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_memory.ld),) - LDSCRIPT_TEMPLATE = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_memory.ld -else - ifeq ($(CONFIG_BUILD_PROTECTED),y) - LDSCRIPT_TEMPLATE = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)protected_memory.ld - else - LDSCRIPT_TEMPLATE = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)flat_memory.ld - endif + ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y) + ARCHSCRIPT += $(call FINDSCRIPT,mcuboot_sections.ld) + else + ARCHSCRIPT += $(call FINDSCRIPT,legacy_sections.ld) + endif endif ARCHPICFLAGS = -fpic diff --git a/boards/xtensa/esp32/esp32-devkitc/src/Make.defs b/boards/xtensa/esp32/esp32-devkitc/src/Make.defs index 8b3ee8acbf8..a2bd15606ea 100644 --- a/boards/xtensa/esp32/esp32-devkitc/src/Make.defs +++ b/boards/xtensa/esp32/esp32-devkitc/src/Make.defs @@ -59,18 +59,6 @@ ifeq ($(CONFIG_NET_W5500),y) CSRCS += esp32_w5500.c endif -SCRIPTOUT = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_out.ld - -.PHONY = context distclean - -$(SCRIPTOUT): $(LDSCRIPT_TEMPLATE) $(CONFIGFILE) - $(Q) $(CC) -isystem $(TOPDIR)/include -I $(BOARD_COMMON_DIR)$(DELIM)scripts -C -P -x c -E $(LDSCRIPT_TEMPLATE) -o $@ - -context:: $(SCRIPTOUT) - -distclean:: - $(call DELFILE, $(SCRIPTOUT)) - DEPPATH += --dep-path board VPATH += :board CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board) diff --git a/boards/xtensa/esp32/esp32-ethernet-kit/scripts/.gitignore b/boards/xtensa/esp32/esp32-ethernet-kit/scripts/.gitignore deleted file mode 100644 index 461270524bd..00000000000 --- a/boards/xtensa/esp32/esp32-ethernet-kit/scripts/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/esp32_out.ld diff --git a/boards/xtensa/esp32/esp32-ethernet-kit/scripts/Make.defs b/boards/xtensa/esp32/esp32-ethernet-kit/scripts/Make.defs index 11ab74a3623..fbd3e2ecdb5 100644 --- a/boards/xtensa/esp32/esp32-ethernet-kit/scripts/Make.defs +++ b/boards/xtensa/esp32/esp32-ethernet-kit/scripts/Make.defs @@ -23,42 +23,22 @@ include $(TOPDIR)/tools/Config.mk include $(TOPDIR)/tools/esp32/Config.mk include $(TOPDIR)/arch/xtensa/src/lx6/Toolchain.defs -# This is the generated memory layout linker script. It will always be -# generated at the board level. - -ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_out.ld +ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld # Pick the linker scripts from the board level if they exist, if not # pick the common linker scripts. -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_sections.ld),) - ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_sections.ld +ifeq ($(CONFIG_BUILD_PROTECTED),y) + ARCHSCRIPT += $(call FINDSCRIPT,protected_memory.ld) + ARCHSCRIPT += $(call FINDSCRIPT,kernel-space.ld) else - ifeq ($(CONFIG_BUILD_PROTECTED),y) - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)kernel-space.ld - else - ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y) - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)mcuboot_sections.ld - else - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)legacy_sections.ld - endif - endif -endif + ARCHSCRIPT += $(call FINDSCRIPT,flat_memory.ld) -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld),) - ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld -else - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld -endif - -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_memory.ld),) - LDSCRIPT_TEMPLATE = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_memory.ld -else - ifeq ($(CONFIG_BUILD_PROTECTED),y) - LDSCRIPT_TEMPLATE = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)protected_memory.ld - else - LDSCRIPT_TEMPLATE = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)flat_memory.ld - endif + ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y) + ARCHSCRIPT += $(call FINDSCRIPT,mcuboot_sections.ld) + else + ARCHSCRIPT += $(call FINDSCRIPT,legacy_sections.ld) + endif endif ARCHPICFLAGS = -fpic diff --git a/boards/xtensa/esp32/esp32-ethernet-kit/src/Make.defs b/boards/xtensa/esp32/esp32-ethernet-kit/src/Make.defs index d2de6cc4338..b6f0b79146c 100644 --- a/boards/xtensa/esp32/esp32-ethernet-kit/src/Make.defs +++ b/boards/xtensa/esp32/esp32-ethernet-kit/src/Make.defs @@ -39,18 +39,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += esp32_buttons.c endif -SCRIPTOUT = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_out.ld - -.PHONY = context distclean - -$(SCRIPTOUT): $(LDSCRIPT_TEMPLATE) $(CONFIGFILE) - $(Q) $(CC) -isystem $(TOPDIR)/include -C -P -x c -E $(LDSCRIPT_TEMPLATE) -o $@ - -context:: $(SCRIPTOUT) - -distclean:: - $(call DELFILE, $(SCRIPTOUT)) - DEPPATH += --dep-path board VPATH += :board CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board) diff --git a/boards/xtensa/esp32/esp32-lyrat/scripts/.gitignore b/boards/xtensa/esp32/esp32-lyrat/scripts/.gitignore deleted file mode 100644 index 461270524bd..00000000000 --- a/boards/xtensa/esp32/esp32-lyrat/scripts/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/esp32_out.ld diff --git a/boards/xtensa/esp32/esp32-lyrat/scripts/Make.defs b/boards/xtensa/esp32/esp32-lyrat/scripts/Make.defs index cafd322df8b..c2d6f54b650 100644 --- a/boards/xtensa/esp32/esp32-lyrat/scripts/Make.defs +++ b/boards/xtensa/esp32/esp32-lyrat/scripts/Make.defs @@ -23,42 +23,22 @@ include $(TOPDIR)/tools/Config.mk include $(TOPDIR)/tools/esp32/Config.mk include $(TOPDIR)/arch/xtensa/src/lx6/Toolchain.defs -# This is the generated memory layout linker script. It will always be -# generated at the board level. - -ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_out.ld +ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld # Pick the linker scripts from the board level if they exist, if not # pick the common linker scripts. -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_sections.ld),) - ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_sections.ld +ifeq ($(CONFIG_BUILD_PROTECTED),y) + ARCHSCRIPT += $(call FINDSCRIPT,protected_memory.ld) + ARCHSCRIPT += $(call FINDSCRIPT,kernel-space.ld) else - ifeq ($(CONFIG_BUILD_PROTECTED),y) - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)kernel-space.ld - else - ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y) - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)mcuboot_sections.ld - else - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)legacy_sections.ld - endif - endif -endif + ARCHSCRIPT += $(call FINDSCRIPT,flat_memory.ld) -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld),) - ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld -else - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld -endif - -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_memory.ld),) - LDSCRIPT_TEMPLATE = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_memory.ld -else - ifeq ($(CONFIG_BUILD_PROTECTED),y) - LDSCRIPT_TEMPLATE = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)protected_memory.ld - else - LDSCRIPT_TEMPLATE = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)flat_memory.ld - endif + ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y) + ARCHSCRIPT += $(call FINDSCRIPT,mcuboot_sections.ld) + else + ARCHSCRIPT += $(call FINDSCRIPT,legacy_sections.ld) + endif endif ARCHPICFLAGS = -fpic diff --git a/boards/xtensa/esp32/esp32-lyrat/src/Make.defs b/boards/xtensa/esp32/esp32-lyrat/src/Make.defs index 39d1e99c2ee..ce55853e339 100644 --- a/boards/xtensa/esp32/esp32-lyrat/src/Make.defs +++ b/boards/xtensa/esp32/esp32-lyrat/src/Make.defs @@ -47,18 +47,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += esp32_buttons.c endif -SCRIPTOUT = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_out.ld - -.PHONY = context distclean - -$(SCRIPTOUT): $(LDSCRIPT_TEMPLATE) $(CONFIGFILE) - $(Q) $(CC) -isystem $(TOPDIR)/include -C -P -x c -E $(LDSCRIPT_TEMPLATE) -o $@ - -context:: $(SCRIPTOUT) - -distclean:: - $(call DELFILE, $(SCRIPTOUT)) - DEPPATH += --dep-path board VPATH += :board CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board) diff --git a/boards/xtensa/esp32/esp32-sparrow-kit/scripts/.gitignore b/boards/xtensa/esp32/esp32-sparrow-kit/scripts/.gitignore deleted file mode 100644 index 461270524bd..00000000000 --- a/boards/xtensa/esp32/esp32-sparrow-kit/scripts/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/esp32_out.ld diff --git a/boards/xtensa/esp32/esp32-sparrow-kit/scripts/Make.defs b/boards/xtensa/esp32/esp32-sparrow-kit/scripts/Make.defs index caa093612a0..fa7765a3dcd 100644 --- a/boards/xtensa/esp32/esp32-sparrow-kit/scripts/Make.defs +++ b/boards/xtensa/esp32/esp32-sparrow-kit/scripts/Make.defs @@ -23,42 +23,22 @@ include $(TOPDIR)/tools/Config.mk include $(TOPDIR)/tools/esp32/Config.mk include $(TOPDIR)/arch/xtensa/src/lx6/Toolchain.defs -# This is the generated memory layout linker script. It will always be -# generated at the board level. - -ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_out.ld +ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld # Pick the linker scripts from the board level if they exist, if not # pick the common linker scripts. -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_sections.ld),) - ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_sections.ld +ifeq ($(CONFIG_BUILD_PROTECTED),y) + ARCHSCRIPT += $(call FINDSCRIPT,protected_memory.ld) + ARCHSCRIPT += $(call FINDSCRIPT,kernel-space.ld) else - ifeq ($(CONFIG_BUILD_PROTECTED),y) - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)kernel-space.ld - else - ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y) - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)mcuboot_sections.ld - else - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)legacy_sections.ld - endif - endif -endif + ARCHSCRIPT += $(call FINDSCRIPT,flat_memory.ld) -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld),) - ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld -else - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld -endif - -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_memory.ld),) - LDSCRIPT_TEMPLATE = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_memory.ld -else - ifeq ($(CONFIG_BUILD_PROTECTED),y) - LDSCRIPT_TEMPLATE = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)protected_memory.ld - else - LDSCRIPT_TEMPLATE = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)flat_memory.ld - endif + ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y) + ARCHSCRIPT += $(call FINDSCRIPT,mcuboot_sections.ld) + else + ARCHSCRIPT += $(call FINDSCRIPT,legacy_sections.ld) + endif endif ARCHPICFLAGS = -fpic diff --git a/boards/xtensa/esp32/esp32-sparrow-kit/src/Make.defs b/boards/xtensa/esp32/esp32-sparrow-kit/src/Make.defs index bb0a5de2b78..235a708505f 100644 --- a/boards/xtensa/esp32/esp32-sparrow-kit/src/Make.defs +++ b/boards/xtensa/esp32/esp32-sparrow-kit/src/Make.defs @@ -49,18 +49,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += esp32_buttons.c endif -SCRIPTOUT = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_out.ld - -.PHONY = context distclean - -$(SCRIPTOUT): $(LDSCRIPT_TEMPLATE) $(CONFIGFILE) - $(Q) $(CC) -isystem $(TOPDIR)/include -C -P -x c -E $(LDSCRIPT_TEMPLATE) -o $@ - -context:: $(SCRIPTOUT) - -distclean:: - $(call DELFILE, $(SCRIPTOUT)) - DEPPATH += --dep-path board VPATH += :board CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board) diff --git a/boards/xtensa/esp32/esp32-wrover-kit/scripts/.gitignore b/boards/xtensa/esp32/esp32-wrover-kit/scripts/.gitignore deleted file mode 100644 index 461270524bd..00000000000 --- a/boards/xtensa/esp32/esp32-wrover-kit/scripts/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/esp32_out.ld diff --git a/boards/xtensa/esp32/esp32-wrover-kit/scripts/Make.defs b/boards/xtensa/esp32/esp32-wrover-kit/scripts/Make.defs index da681591bf9..291e6de697b 100644 --- a/boards/xtensa/esp32/esp32-wrover-kit/scripts/Make.defs +++ b/boards/xtensa/esp32/esp32-wrover-kit/scripts/Make.defs @@ -23,42 +23,22 @@ include $(TOPDIR)/tools/Config.mk include $(TOPDIR)/tools/esp32/Config.mk include $(TOPDIR)/arch/xtensa/src/lx6/Toolchain.defs -# This is the generated memory layout linker script. It will always be -# generated at the board level. - -ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_out.ld +ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld # Pick the linker scripts from the board level if they exist, if not # pick the common linker scripts. -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_sections.ld),) - ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_sections.ld +ifeq ($(CONFIG_BUILD_PROTECTED),y) + ARCHSCRIPT += $(call FINDSCRIPT,protected_memory.ld) + ARCHSCRIPT += $(call FINDSCRIPT,kernel-space.ld) else - ifeq ($(CONFIG_BUILD_PROTECTED),y) - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)kernel-space.ld - else - ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y) - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)mcuboot_sections.ld - else - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)legacy_sections.ld - endif - endif -endif + ARCHSCRIPT += $(call FINDSCRIPT,flat_memory.ld) -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld),) - ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld -else - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld -endif - -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_memory.ld),) - LDSCRIPT_TEMPLATE = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_memory.ld -else - ifeq ($(CONFIG_BUILD_PROTECTED),y) - LDSCRIPT_TEMPLATE = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)protected_memory.ld - else - LDSCRIPT_TEMPLATE = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)flat_memory.ld - endif + ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y) + ARCHSCRIPT += $(call FINDSCRIPT,mcuboot_sections.ld) + else + ARCHSCRIPT += $(call FINDSCRIPT,legacy_sections.ld) + endif endif ARCHPICFLAGS = -fpic diff --git a/boards/xtensa/esp32/esp32-wrover-kit/src/Make.defs b/boards/xtensa/esp32/esp32-wrover-kit/src/Make.defs index e3534c251ea..6bbffb584c3 100644 --- a/boards/xtensa/esp32/esp32-wrover-kit/src/Make.defs +++ b/boards/xtensa/esp32/esp32-wrover-kit/src/Make.defs @@ -49,18 +49,6 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += esp32_buttons.c endif -SCRIPTOUT = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_out.ld - -.PHONY = context distclean - -$(SCRIPTOUT): $(LDSCRIPT_TEMPLATE) $(CONFIGFILE) - $(Q) $(CC) -isystem $(TOPDIR)/include -C -P -x c -E $(LDSCRIPT_TEMPLATE) -o $@ - -context:: $(SCRIPTOUT) - -distclean:: - $(call DELFILE, $(SCRIPTOUT)) - DEPPATH += --dep-path board VPATH += :board CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board) diff --git a/boards/xtensa/esp32/lilygo_tbeam_lora_gps/scripts/.gitignore b/boards/xtensa/esp32/lilygo_tbeam_lora_gps/scripts/.gitignore deleted file mode 100644 index 461270524bd..00000000000 --- a/boards/xtensa/esp32/lilygo_tbeam_lora_gps/scripts/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/esp32_out.ld diff --git a/boards/xtensa/esp32/lilygo_tbeam_lora_gps/scripts/Make.defs b/boards/xtensa/esp32/lilygo_tbeam_lora_gps/scripts/Make.defs index 772a2d5e47c..cac88f8f747 100644 --- a/boards/xtensa/esp32/lilygo_tbeam_lora_gps/scripts/Make.defs +++ b/boards/xtensa/esp32/lilygo_tbeam_lora_gps/scripts/Make.defs @@ -23,42 +23,22 @@ include $(TOPDIR)/tools/Config.mk include $(TOPDIR)/tools/esp32/Config.mk include $(TOPDIR)/arch/xtensa/src/lx6/Toolchain.defs -# This is the generated memory layout linker script. It will always be -# generated at the board level. - -ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_out.ld +ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld # Pick the linker scripts from the board level if they exist, if not # pick the common linker scripts. -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_sections.ld),) - ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_sections.ld +ifeq ($(CONFIG_BUILD_PROTECTED),y) + ARCHSCRIPT += $(call FINDSCRIPT,protected_memory.ld) + ARCHSCRIPT += $(call FINDSCRIPT,kernel-space.ld) else - ifeq ($(CONFIG_BUILD_PROTECTED),y) - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)kernel-space.ld - else - ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y) - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)mcuboot_sections.ld - else - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)legacy_sections.ld - endif - endif -endif + ARCHSCRIPT += $(call FINDSCRIPT,flat_memory.ld) -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld),) - ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld -else - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld -endif - -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_memory.ld),) - LDSCRIPT_TEMPLATE = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_memory.ld -else - ifeq ($(CONFIG_BUILD_PROTECTED),y) - LDSCRIPT_TEMPLATE = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)protected_memory.ld - else - LDSCRIPT_TEMPLATE = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)flat_memory.ld - endif + ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y) + ARCHSCRIPT += $(call FINDSCRIPT,mcuboot_sections.ld) + else + ARCHSCRIPT += $(call FINDSCRIPT,legacy_sections.ld) + endif endif ARCHPICFLAGS = -fpic diff --git a/boards/xtensa/esp32/lilygo_tbeam_lora_gps/src/Make.defs b/boards/xtensa/esp32/lilygo_tbeam_lora_gps/src/Make.defs index d4e04843c6a..dcf64770a89 100644 --- a/boards/xtensa/esp32/lilygo_tbeam_lora_gps/src/Make.defs +++ b/boards/xtensa/esp32/lilygo_tbeam_lora_gps/src/Make.defs @@ -51,18 +51,6 @@ ifeq ($(CONFIG_LPWAN_SX127X),y) CSRCS += esp32_sx127x.c endif -SCRIPTOUT = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_out.ld - -.PHONY = context distclean - -$(SCRIPTOUT): $(LDSCRIPT_TEMPLATE) $(CONFIGFILE) - $(Q) $(CC) -isystem $(TOPDIR)/include -C -P -x c -E $(LDSCRIPT_TEMPLATE) -o $@ - -context:: $(SCRIPTOUT) - -distclean:: - $(call DELFILE, $(SCRIPTOUT)) - DEPPATH += --dep-path board VPATH += :board CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board) diff --git a/boards/xtensa/esp32/ttgo_eink5_v2/scripts/.gitignore b/boards/xtensa/esp32/ttgo_eink5_v2/scripts/.gitignore deleted file mode 100644 index 461270524bd..00000000000 --- a/boards/xtensa/esp32/ttgo_eink5_v2/scripts/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/esp32_out.ld diff --git a/boards/xtensa/esp32/ttgo_eink5_v2/scripts/Make.defs b/boards/xtensa/esp32/ttgo_eink5_v2/scripts/Make.defs index ec0bac8e345..6c817803546 100644 --- a/boards/xtensa/esp32/ttgo_eink5_v2/scripts/Make.defs +++ b/boards/xtensa/esp32/ttgo_eink5_v2/scripts/Make.defs @@ -23,42 +23,22 @@ include $(TOPDIR)/tools/Config.mk include $(TOPDIR)/tools/esp32/Config.mk include $(TOPDIR)/arch/xtensa/src/lx6/Toolchain.defs -# This is the generated memory layout linker script. It will always be -# generated at the board level. - -ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_out.ld +ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld # Pick the linker scripts from the board level if they exist, if not # pick the common linker scripts. -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_sections.ld),) - ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_sections.ld +ifeq ($(CONFIG_BUILD_PROTECTED),y) + ARCHSCRIPT += $(call FINDSCRIPT,protected_memory.ld) + ARCHSCRIPT += $(call FINDSCRIPT,kernel-space.ld) else - ifeq ($(CONFIG_BUILD_PROTECTED),y) - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)kernel-space.ld - else - ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y) - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)mcuboot_sections.ld - else - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)legacy_sections.ld - endif - endif -endif + ARCHSCRIPT += $(call FINDSCRIPT,flat_memory.ld) -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld),) - ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld -else - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld -endif - -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_memory.ld),) - LDSCRIPT_TEMPLATE = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_memory.ld -else - ifeq ($(CONFIG_BUILD_PROTECTED),y) - LDSCRIPT_TEMPLATE = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)protected_memory.ld - else - LDSCRIPT_TEMPLATE = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)flat_memory.ld - endif + ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y) + ARCHSCRIPT += $(call FINDSCRIPT,mcuboot_sections.ld) + else + ARCHSCRIPT += $(call FINDSCRIPT,legacy_sections.ld) + endif endif ARCHPICFLAGS = -fpic diff --git a/boards/xtensa/esp32/ttgo_eink5_v2/src/Make.defs b/boards/xtensa/esp32/ttgo_eink5_v2/src/Make.defs index 76e6b0bfc8b..07b2a5d445b 100644 --- a/boards/xtensa/esp32/ttgo_eink5_v2/src/Make.defs +++ b/boards/xtensa/esp32/ttgo_eink5_v2/src/Make.defs @@ -55,18 +55,6 @@ ifeq ($(CONFIG_ESP32_TWAI),y) CSRCS += esp32_twai.c endif -SCRIPTOUT = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_out.ld - -.PHONY = context distclean - -$(SCRIPTOUT): $(LDSCRIPT_TEMPLATE) $(CONFIGFILE) - $(Q) $(CC) -isystem $(TOPDIR)/include -I $(BOARD_COMMON_DIR)$(DELIM)scripts -C -P -x c -E $(LDSCRIPT_TEMPLATE) -o $@ - -context:: $(SCRIPTOUT) - -distclean:: - $(call DELFILE, $(SCRIPTOUT)) - DEPPATH += --dep-path board VPATH += :board CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board) diff --git a/boards/xtensa/esp32/ttgo_lora_esp32/scripts/.gitignore b/boards/xtensa/esp32/ttgo_lora_esp32/scripts/.gitignore deleted file mode 100644 index 461270524bd..00000000000 --- a/boards/xtensa/esp32/ttgo_lora_esp32/scripts/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/esp32_out.ld diff --git a/boards/xtensa/esp32/ttgo_lora_esp32/scripts/Make.defs b/boards/xtensa/esp32/ttgo_lora_esp32/scripts/Make.defs index 772a2d5e47c..cac88f8f747 100644 --- a/boards/xtensa/esp32/ttgo_lora_esp32/scripts/Make.defs +++ b/boards/xtensa/esp32/ttgo_lora_esp32/scripts/Make.defs @@ -23,42 +23,22 @@ include $(TOPDIR)/tools/Config.mk include $(TOPDIR)/tools/esp32/Config.mk include $(TOPDIR)/arch/xtensa/src/lx6/Toolchain.defs -# This is the generated memory layout linker script. It will always be -# generated at the board level. - -ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_out.ld +ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld # Pick the linker scripts from the board level if they exist, if not # pick the common linker scripts. -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_sections.ld),) - ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_sections.ld +ifeq ($(CONFIG_BUILD_PROTECTED),y) + ARCHSCRIPT += $(call FINDSCRIPT,protected_memory.ld) + ARCHSCRIPT += $(call FINDSCRIPT,kernel-space.ld) else - ifeq ($(CONFIG_BUILD_PROTECTED),y) - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)kernel-space.ld - else - ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y) - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)mcuboot_sections.ld - else - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)legacy_sections.ld - endif - endif -endif + ARCHSCRIPT += $(call FINDSCRIPT,flat_memory.ld) -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld),) - ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld -else - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld -endif - -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_memory.ld),) - LDSCRIPT_TEMPLATE = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_memory.ld -else - ifeq ($(CONFIG_BUILD_PROTECTED),y) - LDSCRIPT_TEMPLATE = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)protected_memory.ld - else - LDSCRIPT_TEMPLATE = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)flat_memory.ld - endif + ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y) + ARCHSCRIPT += $(call FINDSCRIPT,mcuboot_sections.ld) + else + ARCHSCRIPT += $(call FINDSCRIPT,legacy_sections.ld) + endif endif ARCHPICFLAGS = -fpic diff --git a/boards/xtensa/esp32/ttgo_lora_esp32/src/Make.defs b/boards/xtensa/esp32/ttgo_lora_esp32/src/Make.defs index d4e04843c6a..dcf64770a89 100644 --- a/boards/xtensa/esp32/ttgo_lora_esp32/src/Make.defs +++ b/boards/xtensa/esp32/ttgo_lora_esp32/src/Make.defs @@ -51,18 +51,6 @@ ifeq ($(CONFIG_LPWAN_SX127X),y) CSRCS += esp32_sx127x.c endif -SCRIPTOUT = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_out.ld - -.PHONY = context distclean - -$(SCRIPTOUT): $(LDSCRIPT_TEMPLATE) $(CONFIGFILE) - $(Q) $(CC) -isystem $(TOPDIR)/include -C -P -x c -E $(LDSCRIPT_TEMPLATE) -o $@ - -context:: $(SCRIPTOUT) - -distclean:: - $(call DELFILE, $(SCRIPTOUT)) - DEPPATH += --dep-path board VPATH += :board CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board) diff --git a/boards/xtensa/esp32/ttgo_t_display_esp32/scripts/.gitignore b/boards/xtensa/esp32/ttgo_t_display_esp32/scripts/.gitignore deleted file mode 100644 index 461270524bd..00000000000 --- a/boards/xtensa/esp32/ttgo_t_display_esp32/scripts/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/esp32_out.ld diff --git a/boards/xtensa/esp32/ttgo_t_display_esp32/scripts/Make.defs b/boards/xtensa/esp32/ttgo_t_display_esp32/scripts/Make.defs index f800c81dabb..88fd40c2661 100644 --- a/boards/xtensa/esp32/ttgo_t_display_esp32/scripts/Make.defs +++ b/boards/xtensa/esp32/ttgo_t_display_esp32/scripts/Make.defs @@ -23,42 +23,22 @@ include $(TOPDIR)/tools/Config.mk include $(TOPDIR)/tools/esp32/Config.mk include $(TOPDIR)/arch/xtensa/src/lx6/Toolchain.defs -# This is the generated memory layout linker script. It will always be -# generated at the board level. - -ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_out.ld +ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld # Pick the linker scripts from the board level if they exist, if not # pick the common linker scripts. -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_sections.ld),) - ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_sections.ld +ifeq ($(CONFIG_BUILD_PROTECTED),y) + ARCHSCRIPT += $(call FINDSCRIPT,protected_memory.ld) + ARCHSCRIPT += $(call FINDSCRIPT,kernel-space.ld) else - ifeq ($(CONFIG_BUILD_PROTECTED),y) - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)kernel-space.ld - else - ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y) - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)mcuboot_sections.ld - else - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)legacy_sections.ld - endif - endif -endif + ARCHSCRIPT += $(call FINDSCRIPT,flat_memory.ld) -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld),) - ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld -else - ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)esp32_rom.ld -endif - -ifneq ($(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_memory.ld),) - LDSCRIPT_TEMPLATE = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_memory.ld -else - ifeq ($(CONFIG_BUILD_PROTECTED),y) - LDSCRIPT_TEMPLATE = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)protected_memory.ld - else - LDSCRIPT_TEMPLATE = $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)flat_memory.ld - endif + ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y) + ARCHSCRIPT += $(call FINDSCRIPT,mcuboot_sections.ld) + else + ARCHSCRIPT += $(call FINDSCRIPT,legacy_sections.ld) + endif endif ARCHPICFLAGS = -fpic diff --git a/boards/xtensa/esp32/ttgo_t_display_esp32/src/Make.defs b/boards/xtensa/esp32/ttgo_t_display_esp32/src/Make.defs index 47f8bf5938b..44bee80c2bd 100644 --- a/boards/xtensa/esp32/ttgo_t_display_esp32/src/Make.defs +++ b/boards/xtensa/esp32/ttgo_t_display_esp32/src/Make.defs @@ -55,18 +55,6 @@ ifeq ($(CONFIG_ESP32_TWAI),y) CSRCS += esp32_twai.c endif -SCRIPTOUT = $(BOARD_DIR)$(DELIM)scripts$(DELIM)esp32_out.ld - -.PHONY = context distclean - -$(SCRIPTOUT): $(LDSCRIPT_TEMPLATE) $(CONFIGFILE) - $(Q) $(CC) -isystem $(TOPDIR)/include -I $(BOARD_COMMON_DIR)$(DELIM)scripts -C -P -x c -E $(LDSCRIPT_TEMPLATE) -o $@ - -context:: $(SCRIPTOUT) - -distclean:: - $(call DELFILE, $(SCRIPTOUT)) - DEPPATH += --dep-path board VPATH += :board CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board) diff --git a/tools/Config.mk b/tools/Config.mk index 5092df40ac9..5e7155b3ed2 100644 --- a/tools/Config.mk +++ b/tools/Config.mk @@ -525,6 +525,15 @@ define RWILDCARD $(foreach d,$(wildcard $1/*),$(call RWILDCARD,$d,$2)$(filter $(subst *,%,$2),$d)) endef +# FINDSCRIPT - Find a given linker script. Prioritize the version from currently +# configured board. If not provided, use the linker script from the +# board common directory. +# Example: $(call FINDSCRIPT,script.ld) + +define FINDSCRIPT + $(if $(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(1)),$(BOARD_DIR)$(DELIM)scripts$(DELIM)$(1),$(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)$(1)) +endef + # CLEAN - Default clean target ifeq ($(CONFIG_ARCH_COVERAGE),y)