AlanRosenthal commented on a change in pull request #5496:
URL: https://github.com/apache/incubator-nuttx/pull/5496#discussion_r806283845



##########
File path: tools/Config.mk
##########
@@ -548,3 +548,11 @@ else
   ARCHXXINCLUDES += ${shell $(INCDIR) -s "$(CC)" 
$(TOPDIR)$(DELIM)include$(DELIM)cxx}
 endif
 ARCHXXINCLUDES += ${shell $(INCDIR) -s "$(CC)" $(TOPDIR)$(DELIM)include}
+
+# Linker Scripts
+
+ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
+  ARCHSCRIPT_CLI = $(addprefix -T,$(foreach SCRIPT,$(ARCHSCRIPT),${shell 
cygpath -w $(SCRIPT)}))
+else
+  ARCHSCRIPT_CLI = $(addprefix -T,$(ARCHSCRIPT))
+endif

Review comment:
       yeah, that should work. Thanks for the suggestion!

##########
File path: boards/arm/samv7/common/scripts/flat.memory
##########
@@ -22,10 +22,6 @@ include $(TOPDIR)/.config
 include $(TOPDIR)/tools/Config.mk
 include $(TOPDIR)/arch/arm/src/armv7-m/Toolchain.defs
 
-ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
-  ARCHSCRIPT = -T "${shell cygpath -w 
$(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)samv7.ld}"
-else
-  ARCHSCRIPT = -T$(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)samv7.ld
-endif
+ARCHSCRIPT += $(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)samv7.ld

Review comment:
       added!

##########
File path: boards/xtensa/esp32/esp32-devkitc/scripts/Make.defs
##########
@@ -23,42 +23,34 @@ 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

Review comment:
       reordered to maintain previous script order.

##########
File path: tools/Config.mk
##########
@@ -548,3 +548,11 @@ else
   ARCHXXINCLUDES += ${shell $(INCDIR) -s "$(CC)" 
$(TOPDIR)$(DELIM)include$(DELIM)cxx}
 endif
 ARCHXXINCLUDES += ${shell $(INCDIR) -s "$(CC)" $(TOPDIR)$(DELIM)include}
+
+# Linker Scripts
+
+ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
+  ARCHSCRIPT_CLI = $(addprefix -T,$(foreach SCRIPT,$(ARCHSCRIPT),${shell 
cygpath -w $(SCRIPT)}))
+else
+  ARCHSCRIPT_CLI = $(addprefix -T,$(ARCHSCRIPT))
+endif

Review comment:
       I noticed the flags were getting double added. I added a guard around it 
to prevent it from ever happening. Let me know what you think

##########
File path: tools/Config.mk
##########
@@ -548,3 +548,17 @@ else
   ARCHXXINCLUDES += ${shell $(INCDIR) -s "$(CC)" 
$(TOPDIR)$(DELIM)include$(DELIM)cxx}
 endif
 ARCHXXINCLUDES += ${shell $(INCDIR) -s "$(CC)" $(TOPDIR)$(DELIM)include}
+
+# Linker Scripts
+
+# Note: This file has the potenital to be included multiple times. To prevent 
duplicate linker scripts
+# from being added, guard the `LDFLAGS +=` with $(ARCHSCRIPT_ALREADY_ADDED)
+
+ifeq ($(ARCHSCRIPT_ALREADY_ADDED),)
+  ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
+    LDFLAGS += $(addprefix -T,$(foreach SCRIPT,$(ARCHSCRIPT),${shell cygpath 
-w $(SCRIPT)}))
+  else
+    LDFLAGS += $(addprefix -T,$(ARCHSCRIPT))
+  endif
+  ARCHSCRIPT_ALREADY_ADDED = y
+endif

Review comment:
       Instead of adding it in tools/Config.mk, I think a better spot might be 
`arch/common/src/Makefile`. This would create a spot for common code in 
arch/*/src/Makefile




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to