2020-01-29 18:40:27 +01:00
|
|
|
include $(RIOTMAKE)/tools/edbg-devices.inc.mk
|
|
|
|
|
2021-02-18 11:20:13 +01:00
|
|
|
# Edbg use a bin file for flashing
|
2018-12-19 19:34:37 +01:00
|
|
|
FLASHFILE ?= $(BINFILE)
|
2021-02-18 11:20:13 +01:00
|
|
|
|
|
|
|
EDBG ?= $(RIOTTOOLS)/edbg/edbg
|
|
|
|
FLASHDEPS += $(EDBG)
|
|
|
|
|
2017-10-08 07:58:02 +02:00
|
|
|
# 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:
|
2019-05-31 11:45:23 +02:00
|
|
|
# DEBUG_ADAPTER_ID="ATML..."
|
2017-10-08 07:58:02 +02:00
|
|
|
# BOARD=<board> make flash
|
|
|
|
ifneq (,$(DEBUG_ADAPTER_ID))
|
|
|
|
EDBG_ARGS += --serial $(DEBUG_ADAPTER_ID)
|
|
|
|
endif
|
2018-08-16 16:36:05 +02:00
|
|
|
|
|
|
|
# Set offset according to IMAGE_OFFSET if it's defined
|
2018-09-18 18:28:19 +02:00
|
|
|
EDBG_ARGS += $(if $(IMAGE_OFFSET),--offset $(IMAGE_OFFSET))
|
2021-02-18 11:20:13 +01:00
|
|
|
EDBG_ARGS += --target $(EDBG_DEVICE_TYPE)
|
2018-08-16 16:36:05 +02:00
|
|
|
|
2021-02-18 11:20:13 +01:00
|
|
|
EDBG_TARGETS = flash flash-only reset
|
|
|
|
# Export EDBG to required targets
|
|
|
|
$(call target-export-variables,$(EDBG_TARGETS),EDBG)
|
2017-05-18 12:10:10 +02:00
|
|
|
|
2021-02-18 11:20:13 +01:00
|
|
|
# Export EDBG_ARGS to required targets
|
|
|
|
$(call target-export-variables,$(EDBG_TARGETS),EDBG_ARGS)
|
2019-09-25 10:14:20 +02:00
|
|
|
|
2021-02-18 11:20:13 +01:00
|
|
|
# Set flasher and reset for the RIOT build system
|
|
|
|
FLASHER ?= $(RIOTTOOLS)/edbg/edbg.sh
|
|
|
|
FFLAGS ?= flash $(FLASHFILE)
|
2019-09-25 10:14:20 +02:00
|
|
|
|
2021-02-18 11:20:13 +01:00
|
|
|
RESET ?= $(RIOTTOOLS)/edbg/edbg.sh
|
|
|
|
RESET_FLAGS ?= reset
|
2020-11-24 14:47:05 +01:00
|
|
|
|
|
|
|
# use openocd for debugging, must be included at the end so FLASHER/RESET
|
|
|
|
# variables are already set for edbg.
|
|
|
|
include $(RIOTMAKE)/tools/openocd.inc.mk
|