From 89242a4c73380cde1007b378540a9666917701af Mon Sep 17 00:00:00 2001 From: Paul Scheffler Date: Thu, 14 Nov 2024 20:14:51 +0100 Subject: [PATCH] fixup! --- sw/sw.mk | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/sw/sw.mk b/sw/sw.mk index da5184427..8be1e8237 100644 --- a/sw/sw.mk +++ b/sw/sw.mk @@ -100,6 +100,8 @@ CHS_SW_GEN_HDRS += $(OTPROOT)/.generated %.o: %.S $(CHS_SW_GEN_HDRS) $(CHS_SW_CC) $(CHS_SW_INCLUDES) $(CHS_SW_CCFLAGS) -c $< -o $@ +# Programs may specify a linking mode in their name, e.g. `helloworld.spm.c`. +# Tests with such infixes are built only for one linking mode, tests without them for all define chs_sw_ld_elf_rule .PRECIOUS: %.$(1).elf @@ -109,6 +111,13 @@ endef $(foreach link,$(patsubst $(CHS_SW_LD_DIR)/%.ld,%,$(wildcard $(CHS_SW_LD_DIR)/*.ld)),$(eval $(call chs_sw_ld_elf_rule,$(link)))) +# %.$(1).elf: $$(CHS_SW_LD_DIR)/$(1).ld %.$(1).o $$(CHS_SW_LIBS) +# $$(CHS_SW_CC) $$(CHS_SW_INCLUDES) -T$$< $$(CHS_SW_LDFLAGS) -o $$@ $$*.$(1).o $$(CHS_SW_LIBS) + +# CHS_SW_LINK_MODES ?= $(patsubst $(CHS_SW_LD_DIR)/%.ld,%,$(wildcard $(CHS_SW_LD_DIR)/*.ld)) + +# $(foreach link,$(CHS_SW_LINK_MODES),$(eval $(call chs_sw_ld_elf_rule,$(link)))) + %.dump: %.elf $(CHS_SW_OBJDUMP) -d -S $< > $@ @@ -158,6 +167,28 @@ $(CHS_SW_DIR)/boot/linux.%.gpt.bin: $(CHS_SW_DIR)/boot/zsl.rom.bin $(CHS_SW_DIR) # Tests # ######### +# # Accumulate single-link-mode sources and corresponding .dump targets +# define chs_sw_tests_add_rule +# BLA += $(wildcard $(2)/*.$(1).c) +# CHS_SW_TEST_LONE += $(wildcard $(2)/*.$(1).c) $(wildcard $(2)/*.$(1).S) +# CHS_SW_TEST_DUMP += $(patsubst %.c,%.dump,$(wildcard $(2)/*.$(1).c)) $(patsubst %.S,%.dump,$(wildcard $(2)/*.$(1).S)) +# endef + +# # Accumulate tests for all link modes +# $(foreach link,$(CHS_SW_LINK_MODES),$(eval $(call chs_sw_tests_add_rule,$(link),$(CHS_SW_DIR)/tests))) + +# # Collect mode-agnostic tests, which should be build for all modes, and their .dump targets +# CHS_SW_TEST_C_LALL = $(filter-out $(CHS_SW_TEST_LONE), $(wildcard $(CHS_SW_DIR)/tests/*.c)) +# CHS_SW_TEST_S_LALL = $(filter-out $(CHS_SW_TEST_LONE), $(wildcard $(CHS_SW_DIR)/tests/*.S)) +# $(foreach link,$(CHS_SW_LINK_MODES),$(eval CHS_SW_TEST_DUMP += $(CHS_SW_TEST_C_LALL:.c=.$(link).dump) $(CHS_SW_TEST_S_LALL:.S=.$(link).dump))) + +# # Generate .memh targets for ROM-linked tests +# CHS_SW_TEST_ROM_DUMP = $(filter %.rom.dump,$(CHS_SW_TEST_DUMP)) +# CHS_SW_TESTS += $(CHS_SW_TEST_ROM_DUMP:.rom.dump=.rom.memh) $(CHS_SW_TEST_ROM_DUMP:.rom.dump=.gpt.memh) + +# # Add all dumps to test build +# CHS_SW_TESTS += $(CHS_SW_TEST_DUMP) + CHS_SW_TEST_SRCS_S = $(wildcard $(CHS_SW_DIR)/tests/*.S) CHS_SW_TEST_SRCS_C = $(wildcard $(CHS_SW_DIR)/tests/*.c) CHS_SW_TEST_DRAM_DUMP = $(CHS_SW_TEST_SRCS_S:.S=.dram.dump) $(CHS_SW_TEST_SRCS_C:.c=.dram.dump)