From 1d55c85f24fcfdc6a34a3bf01e36a9f716e82c03 Mon Sep 17 00:00:00 2001 From: Gerson Fernando Budke Date: Sat, 2 Jan 2021 15:32:51 -0300 Subject: [PATCH] makefiles/tools/avrdude: Add xmega cpu conditions The current script don't allow change debug protocol and not allows set proper part name for xmega. This make DEBUGPROTO optional with JTAG as default protocol. It add a filter for atxmega to add proper AVRDUDE_PROGRAMMER_FLAGS. Signed-off-by: Gerson Fernando Budke --- makefiles/tools/avrdude.inc.mk | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/makefiles/tools/avrdude.inc.mk b/makefiles/tools/avrdude.inc.mk index 29f9371f10..80337be76c 100644 --- a/makefiles/tools/avrdude.inc.mk +++ b/makefiles/tools/avrdude.inc.mk @@ -12,14 +12,18 @@ ifneq (,$(filter $(CPU),atmega328p)) # Use debugWIRE as protocol for debugging (ATmega328P does not support JTAG) DEBUGPROTO := -w else - # Use JTAG as protocol for debugging - DEBUGPROTO := -j $(AVR_DEBUGINTERFACE) + # Use JTAG as protocol for debugging as default + DEBUGPROTO ?= -j $(AVR_DEBUGINTERFACE) endif DEBUGSERVER_FLAGS ?= "$(AVR_DEBUGDEVICE) $(DEBUGPROTO) :$(DEBUGSERVER_PORT)" DEBUGGER_FLAGS ?= "-x $(AVARICE_PATH)/gdb.conf $(ELFFILE)" DEBUGGER = "$(AVARICE_PATH)/debug.sh" $(DEBUGSERVER_FLAGS) $(AVARICE_PATH) $(DEBUGSERVER_PORT) -AVRDUDE_PROGRAMMER_FLAGS = -p $(subst atmega,m,$(CPU)) +ifeq (atxmega,$(CPU)) + AVRDUDE_PROGRAMMER_FLAGS ?= -p $(subst atxmega,x,$(CPU_MODEL)) +else + AVRDUDE_PROGRAMMER_FLAGS = -p $(subst atmega,m,$(CPU)) +endif # Set flasher port only for programmers that require it ifneq (,$(filter $(AVRDUDE_PROGRAMMER),arduino avr109 buspirate stk500v1 stk500v2 wiring))