makefiles/tools: fix avrdude with ICSP programmers

Currently the flag "-P ${PORT}" is added to avrdude regardless of the programmer
used. But this flag should only be set for programmers that operate over a
serial port - e.g. like the various Arduino bootloaders. This commit changes
the behaviour so that the "-P flag" is only set for only of the default
programmers of the various AVR boards supported by RIOT. This allows to use
ICSP programmers (e.g. like the usbtiny) like this:

    make BOARD=arduino-uno PROGRAMMER=usbtiny
This commit is contained in:
Marian Buschsieweke 2019-02-20 21:40:40 +01:00
parent f37b02a73a
commit 93cd8a1b04
No known key found for this signature in database
GPG Key ID: 61F64C6599B1539F

View File

@ -6,10 +6,14 @@ DEBUGSERVER_FLAGS = "-g -j usb :$(DEBUGSERVER_PORT)"
DEBUGGER_FLAGS = "-x $(RIOTBOARD)/$(BOARD)/dist/gdb.conf $(ELFFILE)"
DEBUGGER = $(DIST_PATH)/debug.sh $(DEBUGSERVER_FLAGS) $(DIST_PATH) $(DEBUGSERVER_PORT)
# make the flasher port configurable (e.g. with atmelice the port is usb)
# defaults to terminal's serial port if not configured
AVRDUDE_PORT ?= $(PORT)
PROGRAMMER_FLAGS = -P $(AVRDUDE_PORT) $(FFLAGS_EXTRA)
# Set flasher port only for programmers that require it
ifneq (,$(filter $(PROGRAMMER),arduino buspirate stk500v1 stk500v2 wiring))
# make the flasher port configurable (e.g. with atmelice the port is usb)
# defaults to terminal's serial port if not configured
AVRDUDE_PORT ?= $(PORT)
PROGRAMMER_FLAGS += -P $(AVRDUDE_PORT)
endif
PROGRAMMER_FLAGS += $(FFLAGS_EXTRA)
# don't force to flash HEXFILE, but set it as default
FLASHFILE ?= $(HEXFILE)