diff --git a/boards/arduino-duemilanove/Makefile.include b/boards/arduino-duemilanove/Makefile.include index bee615c10ce044c39e0491b6b5c4ed4854c31b1d..96b667a44c213df3a307bc8f7ff02ad6f7de5b44 100644 --- a/boards/arduino-duemilanove/Makefile.include +++ b/boards/arduino-duemilanove/Makefile.include @@ -10,8 +10,6 @@ BAUD ?= 9600 # using avrdude. Can be overridden for debugging (which requires changes # that require to use an ISP) PROGRAMMER ?= arduino -# set mcu model for avrdude -FFLAGS += -p m328p # configure programmer speed in baud FFLAGS_EXTRA += -b 57600 diff --git a/boards/arduino-mega2560/Makefile.include b/boards/arduino-mega2560/Makefile.include index 676e8dc12d097508f06cae27460673ae6e9a3002..748d6f5f7fcc9f0954e3d7a77cf3ce7fecd4c045 100644 --- a/boards/arduino-mega2560/Makefile.include +++ b/boards/arduino-mega2560/Makefile.include @@ -12,8 +12,6 @@ BAUD ?= 9600 # using avrdude. Can be overridden for debugging (which requires changes # that require to use an ISP) PROGRAMMER ?= stk500v2 -# set mcu model for avrdude -FFLAGS += -p m2560 # configure programmer speed in baud FFLAGS_EXTRA += -b 115200 diff --git a/boards/arduino-uno/Makefile.include b/boards/arduino-uno/Makefile.include index b1b43b2d46a2e5c73ef48d6730473b952ee0193c..fa61f17fe4a5644ba2ef07f3af34f879a7ee5c47 100644 --- a/boards/arduino-uno/Makefile.include +++ b/boards/arduino-uno/Makefile.include @@ -10,8 +10,6 @@ BAUD ?= 9600 # using avrdude. Can be overridden for debugging (which requires changes # that require to use an ISP) PROGRAMMER ?= arduino -# set mcu model for avrdude -FFLAGS += -p m328p # configure programmer speed in baud FFLAGS_EXTRA += -b 115200 diff --git a/boards/jiminy-mega256rfr2/Makefile.include b/boards/jiminy-mega256rfr2/Makefile.include index 662e9840d4b64c47273352e45cb9e228ef590bf1..5806ad6ec0e3c71c538c57a1e82cc26941d05526 100644 --- a/boards/jiminy-mega256rfr2/Makefile.include +++ b/boards/jiminy-mega256rfr2/Makefile.include @@ -15,8 +15,6 @@ include $(RIOTMAKE)/tools/serial.inc.mk # using avrdude. Can be overridden for debugging (which requires changes # that require to use an ISP) PROGRAMMER ?= wiring -# set mcu model for avrdude (mandatory) -FFLAGS += -p atmega256rfr2 # Serial Baud rate for flasher is configured to 500kBaud # see /usr/include/asm-generic/termbits.h for availabel baudrates on your linux system FFLAGS_EXTRA += -b 0010005 diff --git a/boards/mega-xplained/Makefile.include b/boards/mega-xplained/Makefile.include index 391a7b18b147e0bafb08c1f0d4a0881d4e4fe1c0..228b9b2e302cdcf97549035ef4b9efc85ba4513a 100644 --- a/boards/mega-xplained/Makefile.include +++ b/boards/mega-xplained/Makefile.include @@ -14,8 +14,6 @@ include $(RIOTMAKE)/tools/serial.inc.mk # PROGRAMMER defaults to the external flasher Bus Pirate ISP using avrdude. PROGRAMMER ?= buspirate -# set mcu model for avrdude -FFLAGS += -p m1284p # set serial port for avrdude with buspirate ifeq ($(OS),Linux) AVRDUDE_PORT ?= /dev/ttyUSB0 diff --git a/boards/waspmote-pro/Makefile.include b/boards/waspmote-pro/Makefile.include index d77fafb5409fd00e74d38a980ec5701d9db1eeed..9bd9d495a473b22c93b04493a765df26a38c484b 100644 --- a/boards/waspmote-pro/Makefile.include +++ b/boards/waspmote-pro/Makefile.include @@ -17,8 +17,6 @@ include $(RIOTMAKE)/tools/serial.inc.mk # using avrdude. Can be overridden for debugging (which requires changes # that require to use an ISP) PROGRAMMER ?= stk500v1 -# set mcu model for avrdude -FFLAGS += -p m1281 # configure programmer speed in baud FFLAGS_EXTRA += -b 115200 # avoid error if mcu signature doesn't match diff --git a/makefiles/tools/avrdude.inc.mk b/makefiles/tools/avrdude.inc.mk index b45c685f48a0dc239e6f8440f7680b7e87bab6ba..8cde4f33fd0e80a08e0e113c0800da4cfa60e6d0 100644 --- a/makefiles/tools/avrdude.inc.mk +++ b/makefiles/tools/avrdude.inc.mk @@ -6,10 +6,16 @@ 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) +PROGRAMMER_FLAGS = -p $(subst atmega,m,$(CPU)) + +# 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)