From f44dd00276e0c42aca23dbe4fd3327f7b15f57be Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Mon, 25 Nov 2019 14:39:25 +0100 Subject: [PATCH] tools/avrdude: Fix `make reset` with bootloader The generic approach of calling avrdude to perform a reset with `make reset` does also work on board with a bootloader, but only if no other process is also accessing the serial (e.g. via `make term`). `make test` first accesses the serial and then performs `make reset` to not miss any output on the serial. This however blocks when `make reset` also wants to access that serial. As workaround, `make reset` is no only provided if the ATmega device is not programmed via bootloader. Normally, those boards reset anyway upon `make term`, which allows `make test` to work normally again. --- makefiles/tools/avrdude.inc.mk | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/makefiles/tools/avrdude.inc.mk b/makefiles/tools/avrdude.inc.mk index 2215fbe43d..5bde9d60e3 100644 --- a/makefiles/tools/avrdude.inc.mk +++ b/makefiles/tools/avrdude.inc.mk @@ -20,4 +20,9 @@ PROGRAMMER_FLAGS += $(FFLAGS_EXTRA) # don't force to flash HEXFILE, but set it as default FLASHFILE ?= $(HEXFILE) FFLAGS += -c $(PROGRAMMER) $(PROGRAMMER_FLAGS) -U flash:w:$(FLASHFILE) -RESET ?= $(FLASHER) -c $(PROGRAMMER) $(PROGRAMMER_FLAGS) + +ifeq (,$(filter $(PROGRAMMER),arduino avr109 stk500v1 stk500v2 wiring)) + # Use avrdude to trigger a reset, if programming is not done via UART and a + # bootloader. + RESET ?= $(FLASHER) -c $(PROGRAMMER) $(PROGRAMMER_FLAGS) +endif