From 64e26832c712baca1cb1b6148cfdf49e3c5bf1d1 Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Mon, 7 May 2018 10:22:46 +0000 Subject: [PATCH] tests: makefiles need to handle linker script generators too Without this you get errors about not finding the linker script (because it will be generated) and linker errors due to bare -l flags. --- tests/rules.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/rules.mk b/tests/rules.mk index 14d4a0c9..2040ba67 100644 --- a/tests/rules.mk +++ b/tests/rules.mk @@ -100,7 +100,10 @@ ifeq ($(V),99) TGT_LDFLAGS += -Wl,--print-gc-sections endif +# Linker script generator fills this in for us. +ifeq (,$(DEVICE)) LDLIBS += -l$(OPENCM3_LIB) +endif # nosys is only in newer gcc-arm-embedded... #LDLIBS += -specs=nosys.specs LDLIBS += -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group @@ -119,10 +122,13 @@ LDLIBS += -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group all: $(PROJECT).elf $(PROJECT).bin flash: $(PROJECT).flash +# error if not using linker script generator +ifeq (,$(DEVICE)) $(LDSCRIPT): ifeq (,$(wildcard $(LDSCRIPT))) $(error Unable to find specified linker script: $(LDSCRIPT)) endif +endif # Need a special rule to have a bin dir $(BUILD_DIR)/%.o: %.c