From d1317abc02dde7ed043acc752e6e8737907a0be5 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Thu, 16 Jun 2022 09:54:44 +0200 Subject: [PATCH] makefiles/tests: use FLASHFILE for hash comparision instead of ELFFILE Let's consider firmwares as identical if their flash files are matching. This will have the side effect that hash mismatches for ESP32 due to different .debug sections in the ELFFILE are prevented, as for ESP32 the BINFILE is used. --- Makefile.include | 14 ++------------ cpu/mips_pic32mx/Makefile.include | 3 +++ cpu/mips_pic32mz/Makefile.include | 3 +++ makefiles/tests/tests.inc.mk | 5 ++++- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Makefile.include b/Makefile.include index d8fd372480..772cae6d77 100644 --- a/Makefile.include +++ b/Makefile.include @@ -395,11 +395,6 @@ ifneq (,$(IOTLAB_NODE)) PROGRAMMER ?= iotlab # iotlab uses ELFFILE by default for flashing boards. FLASHFILE ?= $(ELFFILE) - # RIOT_CI_BUILD disables the build of BINFILE which is required for flashing - # on IoT-LAB - ifeq (1,$(RIOT_CI_BUILD)) - BUILD_FILES += $(BINFILE) - endif # Disable IOTLAB_NODE if inside Docker to avoid including the # iotlab.single.inc.mk file which is useless there: it's only useful for # flashing and this is done outside of Docker. @@ -654,6 +649,7 @@ endif ELFFILE ?= $(BINDIR)/$(APPLICATION).elf HEXFILE ?= $(ELFFILE:.elf=.hex) BINFILE ?= $(ELFFILE:.elf=.bin) +HASHFILE ?= $(BINFILE) MAPFILE ?= $(ELFFILE:.elf=.map) ifneq (,$(filter suit,$(USEMODULE))) @@ -686,13 +682,7 @@ ifeq (,$(FLASHFILE)) $(error FLASHFILE is not defined for this board: $(FLASHFILE)) endif -# By default always build ELFFILE, BINFILE and FLASHFILE -ifeq ($(RIOT_CI_BUILD),1) - # Don't build BINFILE on the CI to save some computation time - BUILD_FILES += $(ELFFILE) $(FLASHFILE) -else - BUILD_FILES += $(ELFFILE) $(BINFILE) $(FLASHFILE) -endif +BUILD_FILES += $(ELFFILE) $(BINFILE) $(FLASHFILE) $(HASHFILE) # variables used to compile and link c++ ifneq (,$(filter cpp,$(USEMODULE))) diff --git a/cpu/mips_pic32mx/Makefile.include b/cpu/mips_pic32mx/Makefile.include index d8f4ad0621..f123088e90 100644 --- a/cpu/mips_pic32mx/Makefile.include +++ b/cpu/mips_pic32mx/Makefile.include @@ -31,3 +31,6 @@ endif # system objcopy is not able to generate a binfile for MIPS BINFILE = + +# hence, use HEXFILE instead for hashing +HASHFILE = $(HEXFILE) diff --git a/cpu/mips_pic32mz/Makefile.include b/cpu/mips_pic32mz/Makefile.include index dc17e17fc7..0337688e6d 100644 --- a/cpu/mips_pic32mz/Makefile.include +++ b/cpu/mips_pic32mz/Makefile.include @@ -34,3 +34,6 @@ endif # system objcopy is not able to generate a binfile for MIPS BINFILE = + +# hence, use HEXFILE instead for hashing +HASHFILE = $(HEXFILE) diff --git a/makefiles/tests/tests.inc.mk b/makefiles/tests/tests.inc.mk index 7ceded0bcc..b3441a413d 100644 --- a/makefiles/tests/tests.inc.mk +++ b/makefiles/tests/tests.inc.mk @@ -74,7 +74,10 @@ test-with-config/check-config: # this target only makes sense if an ELFFILE is actually created, thus guard by # RIOTNOLINK="". ifeq (,$(RIOTNOLINK)) -test-input-hash: $(TESTS) $(TESTS_WITH_CONFIG) $(TESTS_AS_ROOT) $(ELFFILE) $(TEST_EXTRA_FILES) + ifeq (,$(HASHFILE)) + $(error HASHFILE is empty for $(BOARD)) + endif +test-input-hash: $(TESTS) $(TESTS_WITH_CONFIG) $(TESTS_AS_ROOT) $(HASHFILE) $(TEST_EXTRA_FILES) sha1sum $^ > $(BINDIR)/test-input-hash.sha1 else test-input-hash: