diff --git a/boards/jiminy-mega256rfr2/Makefile.include b/boards/jiminy-mega256rfr2/Makefile.include index 43861c0577..a1b36bccd8 100644 --- a/boards/jiminy-mega256rfr2/Makefile.include +++ b/boards/jiminy-mega256rfr2/Makefile.include @@ -1,26 +1,27 @@ # define the cpu used by the jiminy board export CPU = atmega256rfr2 -# export needed for flash rule -export PORT_LINUX ?= /dev/ttyACM0 -export PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) - -# Serial Baud rate for Ffasher is configured to 500kBaud -# see /usr/include/asm-generic/termbits.h for availabel baudrates on your linux system -export PROGRAMMER_SPEED ?= 0010005 - -export FFLAGS += -p atmega256rfr2 - +# configure the terminal program +PORT_LINUX ?= /dev/ttyACM0 +PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) # refine serial port information for pyterm # For 8MHz F_CPU following Baudrate have good error rates # 76923 # 38400 -BAUD = 38400 +BAUD ?= 38400 include $(RIOTMAKE)/tools/serial.inc.mk -# PROGRAMMER defaults to arduino which is the internal flasher via USB. Can be -# overridden for debugging (which requires changes that require to use an ISP) -export PROGRAMMER ?= wiring +# PROGRAMMER defaults to wiring which is the internal flasher via USB +# 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 +# avoid error if mcu signature doesn't match +FFLAGS_EXTRA += -F # From current fuse configuration BOOTLOADER_SIZE ?= 4K diff --git a/boards/mega-xplained/Makefile.include b/boards/mega-xplained/Makefile.include index 9a8d7e5f4f..891fb8f5cf 100644 --- a/boards/mega-xplained/Makefile.include +++ b/boards/mega-xplained/Makefile.include @@ -7,23 +7,22 @@ BOOTLOADER_SIZE ?= 4K ROM_RESERVED ?= $(BOOTLOADER_SIZE) # configure the terminal program -export PORT_LINUX ?= /dev/ttyACM0 -export PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbserial*))) -export BAUD ?= 9600 +PORT_LINUX ?= /dev/ttyACM0 +PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) +BAUD ?= 9600 include $(RIOTMAKE)/tools/serial.inc.mk -export FLASHER = avrdude -export DIST_PATH = $(RIOTBOARD)/$(BOARD)/dist -export DEBUGSERVER_PORT = 4242 -export DEBUGSERVER = $(DIST_PATH)/debug_srv.sh -export DEBUGSERVER_FLAGS = "-g -j usb :$(DEBUGSERVER_PORT)" -export DEBUGGER_FLAGS = "-x $(RIOTBOARD)/$(BOARD)/dist/gdb.conf $(ELFFILE)" -export DEBUGGER = $(DIST_PATH)/debug.sh $(DEBUGSERVER_FLAGS) $(DIST_PATH) $(DEBUGSERVER_PORT) +# 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 +else ifeq ($(OS),Darwin) + AVRDUDE_PORT ?= $(firstword $(sort $(wildcard /dev/tty.usbserial*))) +endif +# avoid error if mcu signature doesn't match +FFLAGS_EXTRA += -F -# PROGRAMMER defaults to the Bus Pirate ISP -export PROGRAMMER ?= buspirate - -export PROGRAMMER_FLAGS = -P /dev/ttyUSB0 - -OFLAGS += -j .text -j .data -export FFLAGS += -p m1284p -c $(PROGRAMMER) $(PROGRAMMER_FLAGS) -F -U flash:w:$(HEXFILE) +include $(RIOTMAKE)/tools/avrdude.inc.mk diff --git a/boards/waspmote-pro/Makefile.include b/boards/waspmote-pro/Makefile.include index a2cd81ebc2..6a098e05e6 100644 --- a/boards/waspmote-pro/Makefile.include +++ b/boards/waspmote-pro/Makefile.include @@ -13,31 +13,15 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbserial*))) BAUD ?= 9600 include $(RIOTMAKE)/tools/serial.inc.mk -# define tools used for building the project -export PREFIX = avr- -export CC = $(PREFIX)gcc -export CXX = $(PREFIX)c++ -export AR = $(PREFIX)ar -export AS = $(PREFIX)as -export LINK = $(PREFIX)gcc -export SIZE = $(PREFIX)size -export OBJCOPY = $(PREFIX)objcopy +# PROGRAMMER defaults to stk500v1 which is the internal flasher via USB +# 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 +FFLAGS_EXTRA += -F -export FLASHER = avrdude -export DIST_PATH = $(RIOTBOARD)/$(BOARD)/dist -export DEBUGSERVER_PORT = 4242 -export DEBUGSERVER = $(DIST_PATH)/debug_srv.sh -export DEBUGSERVER_FLAGS = "-g -j usb :$(DEBUGSERVER_PORT)" -export DEBUGGER_FLAGS = "-x $(RIOTBOARD)/$(BOARD)/dist/gdb.conf $(ELFFILE)" -export DEBUGGER = $(DIST_PATH)/debug.sh $(DEBUGSERVER_FLAGS) $(DIST_PATH) $(DEBUGSERVER_PORT) - -# PROGRAMMER defaults to stk500v1 which is the internal flasher via USB. Can be -# overridden for debugging (which requires changes that require to use an ISP) -export PROGRAMMER ?= stk500v1 - -ifeq ($(PROGRAMMER), stk500v1) - export PROGRAMMER_FLAGS = -P $(PORT) -b 115200 -endif - -OFLAGS += -j .text -j .data -export FFLAGS += -p m1281 -c $(PROGRAMMER) $(PROGRAMMER_FLAGS) -F -U flash:w:$(HEXFILE) +include $(RIOTMAKE)/tools/avrdude.inc.mk