Skip to content

Commit 9caa65c

Browse files
committed
allow a board to override link.ld
1 parent 77fcb8a commit 9caa65c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ports/raspberrypi/Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,13 @@ SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_M
276276

277277
all: $(BUILD)/firmware.uf2
278278

279-
$(BUILD)/firmware.elf: $(OBJ) link.ld
279+
LINK_LD := $(firstword $(wildcard boards/$(BOARD)/link.ld link.ld))
280+
$(BUILD)/firmware.elf: $(OBJ) $(LINK_LD)
280281
$(STEPECHO) "LINK $@"
281282
$(Q)echo $(OBJ) > $(BUILD)/firmware.objs
282283
$(Q)echo $(PICO_LDFLAGS) > $(BUILD)/firmware.ldflags
283-
$(Q)$(CC) -o $@ $(CFLAGS) @$(BUILD)/firmware.ldflags -Wl,-T,link.ld -Wl,-Map=$@.map -Wl,-cref -Wl,--gc-sections @$(BUILD)/firmware.objs
284-
$(Q)$(SIZE) $@ | $(PYTHON) $(TOP)/tools/build_memory_info.py link.ld
284+
$(Q)$(CC) -o $@ $(CFLAGS) @$(BUILD)/firmware.ldflags -Wl,-T,$(LINK_LD) -Wl,-Map=$@.map -Wl,-cref -Wl,--gc-sections @$(BUILD)/firmware.objs
285+
$(Q)$(SIZE) $@ | $(PYTHON) $(TOP)/tools/build_memory_info.py $(LINK_LD)
285286

286287
$(BUILD)/firmware.bin: $(BUILD)/firmware.elf
287288
$(STEPECHO) "Create $@"

0 commit comments

Comments
 (0)