From a45d99f7412bcf566cf49d5b65e07179e2022671 Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Wed, 25 Sep 2019 10:14:20 +0200 Subject: [PATCH] make/tools/edbg: verify before flash This commit overrides the default flash recipe with an edbg specific one. The new recipe first verifies the flashfile agains the device flash. If it is already on there, it won't get overridden. edbg takes care of resetting the device in any case. --- makefiles/tools/edbg.inc.mk | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/makefiles/tools/edbg.inc.mk b/makefiles/tools/edbg.inc.mk index a74896b330..a7d83a0413 100644 --- a/makefiles/tools/edbg.inc.mk +++ b/makefiles/tools/edbg.inc.mk @@ -15,10 +15,17 @@ endif EDBG_ARGS += $(if $(IMAGE_OFFSET),--offset $(IMAGE_OFFSET)) FFLAGS ?= $(EDBG_ARGS) --target $(EDBG_DEVICE_TYPE) --verbose \ - --verify --program --file $(FLASHFILE) + --file $(FLASHFILE) ifeq ($(RIOT_EDBG),$(FLASHER)) FLASHDEPS += $(RIOT_EDBG) endif RESET ?= $(EDBG) RESET_FLAGS ?= $(EDBG_ARGS) --target $(EDBG_DEVICE_TYPE) + +define edbg-flash-recipe + $(call check_cmd,$(FLASHER),Flash program) + $(FLASHER) $(FFLAGS) --verify || $(FLASHER) $(FFLAGS) --verify --program +endef + +flash-recipe = $(edbg-flash-recipe)