From 7df2bc2072a1bb1d48a258ff29f33f86ecafc998 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Fri, 23 Sep 2022 13:41:27 +0200 Subject: [PATCH] tools/avarice: deduce debugger from AVRDUDE_PROGRAMMER If `AVRDUDE_PROGRAMMER` is already set to a programmer that is also capable of debugging, we can assume that typically the user will want to use the same hardware for debugging. Thus, let `AVR_DEBUGDEVICE` default to the matching hardware. --- makefiles/tools/avrdude.inc.mk | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/makefiles/tools/avrdude.inc.mk b/makefiles/tools/avrdude.inc.mk index 7d86c8d896..68734523e5 100644 --- a/makefiles/tools/avrdude.inc.mk +++ b/makefiles/tools/avrdude.inc.mk @@ -3,9 +3,15 @@ DIST_PATH = $(BOARDDIR)/dist AVARICE_PATH = $(RIOTTOOLS)/avarice DEBUGSERVER_PORT = 4242 DEBUGSERVER ?= $(AVARICE_PATH)/debug_srv.sh -# Allow choosing debugger hardware via AVR_DEBUGDEVICE, default to Atmel ICE, -# which is compatible to all AVR devices and since the AVR Dragon is no longer -# produced, the least expensive option +# Allow choosing debugger hardware via AVR_DEBUGDEVICE. If the +# AVRDUDE_PROGRAMMER however is also capable of debugging, use that by default +ifneq (,$(filter $(AVRDUDE_PROGRAMMER),atmelice xplainedpro xplainedpro_pdi)) + AVR_DEBUGDEVICE ?= --edbg +endif +ifneq (,$(filter dragon%,$(AVRDUDE_PROGRAMMER))) + AVR_DEBUGDEVICE ?= --dragon +endif +# Atmel ICE / EDBG is the most sensible fallback AVR_DEBUGDEVICE ?= --edbg AVR_DEBUGINTERFACE ?= usb ifneq (,$(filter $(CPU),atmega328p))