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.
This commit is contained in:
Kaspar Schleiser 2019-09-25 10:14:20 +02:00
parent 1cba611dd9
commit a45d99f741

View File

@ -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)