qemu-arm: Add ldscript dependency in the final firmware.elf target.

So that the target is rebuilt if the linker script changes.
This commit is contained in:
Yonatan Goldschmidt 2019-11-11 12:51:23 +02:00 committed by Damien George
parent 1e87f11d3f
commit 973f68780d
2 changed files with 8 additions and 4 deletions

View File

@ -104,10 +104,14 @@ OBJ_COMMON += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o))
OBJ_RUN = OBJ_RUN =
OBJ_RUN += $(addprefix $(BUILD)/, $(SRC_RUN_C:.c=.o)) OBJ_RUN += $(addprefix $(BUILD)/, $(SRC_RUN_C:.c=.o))
ALL_OBJ_RUN = $(OBJ_COMMON) $(OBJ_RUN)
OBJ_TEST = OBJ_TEST =
OBJ_TEST += $(addprefix $(BUILD)/, $(SRC_TEST_C:.c=.o)) OBJ_TEST += $(addprefix $(BUILD)/, $(SRC_TEST_C:.c=.o))
OBJ_TEST += $(BUILD)/tinytest.o OBJ_TEST += $(BUILD)/tinytest.o
ALL_OBJ_TEST = $(OBJ_COMMON) $(OBJ_TEST)
# All object files, needed to get dependencies correct # All object files, needed to get dependencies correct
OBJ = $(OBJ_COMMON) $(OBJ_RUN) $(OBJ_TEST) OBJ = $(OBJ_COMMON) $(OBJ_RUN) $(OBJ_TEST)
@ -127,8 +131,8 @@ run: $(BUILD)/firmware.elf
qemu-system-arm -machine $(BOARD) $(QEMU_EXTRA) -nographic -monitor null -semihosting -kernel $< qemu-system-arm -machine $(BOARD) $(QEMU_EXTRA) -nographic -monitor null -semihosting -kernel $<
## `$(LD)` doesn't seem to like `--specs` for some reason, but we can just use `$(CC)` here. ## `$(LD)` doesn't seem to like `--specs` for some reason, but we can just use `$(CC)` here.
$(BUILD)/firmware.elf: $(OBJ_COMMON) $(OBJ_RUN) $(BUILD)/firmware.elf: $(LDSCRIPT) $(ALL_OBJ_RUN)
$(Q)$(LD) $(LDFLAGS) -o $@ $^ $(LIBS) $(Q)$(LD) $(LDFLAGS) -o $@ $(ALL_OBJ_RUN) $(LIBS)
$(Q)$(SIZE) $@ $(Q)$(SIZE) $@
include $(TOP)/py/mkrules.mk include $(TOP)/py/mkrules.mk

View File

@ -16,8 +16,8 @@ $(BUILD)/genhdr/tests.h:
$(BUILD)/tinytest.o: $(BUILD)/tinytest.o:
$(Q)$(CC) $(CFLAGS) -DNO_FORKING -o $@ -c $(TINYTEST)/tinytest.c $(Q)$(CC) $(CFLAGS) -DNO_FORKING -o $@ -c $(TINYTEST)/tinytest.c
$(BUILD)/firmware-test.elf: $(OBJ_COMMON) $(OBJ_TEST) $(BUILD)/firmware-test.elf: $(LDSCRIPT) $(ALL_OBJ_TEST)
$(Q)$(LD) $(LDFLAGS) -o $@ $^ $(LIBS) $(Q)$(LD) $(LDFLAGS) -o $@ $(ALL_OBJ_TEST) $(LIBS)
$(Q)$(SIZE) $@ $(Q)$(SIZE) $@
# Note: Using timeout(1) to handle cases where qemu hangs (e.g. this can happen with alignment errors). # Note: Using timeout(1) to handle cases where qemu hangs (e.g. this can happen with alignment errors).