1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

makefiles/edbg: refactor to use wrapper script

This commit is contained in:
Alexandre Abadie 2021-02-18 11:20:13 +01:00
parent 1ec4ea2d7c
commit 9153e39dab
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405

View File

@ -1,9 +1,11 @@
include $(RIOTMAKE)/tools/edbg-devices.inc.mk
RIOT_EDBG = $(RIOTTOOLS)/edbg/edbg
EDBG ?= $(RIOT_EDBG)
FLASHER ?= $(EDBG)
# Edbg use a bin file for flashing
FLASHFILE ?= $(BINFILE)
EDBG ?= $(RIOTTOOLS)/edbg/edbg
FLASHDEPS += $(EDBG)
# Use USB serial number to select device when more than one is connected
# Use /dist/tools/usb-serial/list-ttys.sh to find out serial number.
# Usage:
@ -15,22 +17,21 @@ endif
# Set offset according to IMAGE_OFFSET if it's defined
EDBG_ARGS += $(if $(IMAGE_OFFSET),--offset $(IMAGE_OFFSET))
EDBG_ARGS += --target $(EDBG_DEVICE_TYPE)
FFLAGS ?= $(EDBG_ARGS) --target $(EDBG_DEVICE_TYPE) --verbose \
--file $(FLASHFILE)
EDBG_TARGETS = flash flash-only reset
# Export EDBG to required targets
$(call target-export-variables,$(EDBG_TARGETS),EDBG)
ifeq ($(RIOT_EDBG),$(FLASHER))
FLASHDEPS += $(RIOT_EDBG)
endif
RESET ?= $(EDBG)
RESET_FLAGS ?= $(EDBG_ARGS) --target $(EDBG_DEVICE_TYPE)
# Export EDBG_ARGS to required targets
$(call target-export-variables,$(EDBG_TARGETS),EDBG_ARGS)
define edbg-flash-recipe
$(call check_cmd,$(FLASHER),Flash program)
$(FLASHER) $(FFLAGS) --verify || $(FLASHER) $(FFLAGS) --verify --program
endef
# Set flasher and reset for the RIOT build system
FLASHER ?= $(RIOTTOOLS)/edbg/edbg.sh
FFLAGS ?= flash $(FLASHFILE)
flash-recipe = $(edbg-flash-recipe)
RESET ?= $(RIOTTOOLS)/edbg/edbg.sh
RESET_FLAGS ?= reset
# use openocd for debugging, must be included at the end so FLASHER/RESET
# variables are already set for edbg.