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

38 lines
1.1 KiB
Makefile
Raw Normal View History

include $(RIOTMAKE)/tools/edbg-devices.inc.mk
RIOT_EDBG = $(RIOTTOOLS)/edbg/edbg
2017-05-18 12:10:10 +02:00
EDBG ?= $(RIOT_EDBG)
FLASHER ?= $(EDBG)
FLASHFILE ?= $(BINFILE)
# 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:
# DEBUG_ADAPTER_ID="ATML..."
# BOARD=<board> make flash
ifneq (,$(DEBUG_ADAPTER_ID))
EDBG_ARGS += --serial $(DEBUG_ADAPTER_ID)
endif
# Set offset according to IMAGE_OFFSET if it's defined
EDBG_ARGS += $(if $(IMAGE_OFFSET),--offset $(IMAGE_OFFSET))
2019-09-25 10:09:19 +02:00
FFLAGS ?= $(EDBG_ARGS) --target $(EDBG_DEVICE_TYPE) --verbose \
--file $(FLASHFILE)
2017-05-18 12:10:10 +02:00
ifeq ($(RIOT_EDBG),$(FLASHER))
FLASHDEPS += $(RIOT_EDBG)
endif
2018-02-16 15:32:58 +01:00
RESET ?= $(EDBG)
2019-09-25 10:09:19 +02:00
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)
# 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