From 1a98d64cd56f3ba69ef820c1f5d980fc51ee74f7 Mon Sep 17 00:00:00 2001 From: Francisco Acosta <fco.ja.ac@gmail.com> Date: Tue, 15 May 2018 02:16:27 +0200 Subject: [PATCH] boards/arduino*: use common avrdude.inc.mk from atmega_common Leverages common flasher (avrdude) and removes unnecessary exports. Moreover, a reuse of serial.inc.mk is perfomed from the same atmega_common/Makefile.include --- boards/arduino-duemilanove/Makefile.include | 21 +++++++++++-------- boards/arduino-mega2560/Makefile.include | 21 +++++++++++-------- boards/arduino-uno/Makefile.include | 21 +++++++++++-------- boards/common/arduino-atmega/Makefile.include | 17 ++++----------- boards/jiminy-mega256rfr2/Makefile.include | 5 +++-- 5 files changed, 43 insertions(+), 42 deletions(-) diff --git a/boards/arduino-duemilanove/Makefile.include b/boards/arduino-duemilanove/Makefile.include index dd282db94f..b736cb592a 100644 --- a/boards/arduino-duemilanove/Makefile.include +++ b/boards/arduino-duemilanove/Makefile.include @@ -3,16 +3,19 @@ export CPU = atmega328p USEMODULE += boards_common_arduino-atmega -#export needed for flash rule -export PORT_LINUX ?= /dev/ttyUSB0 -export PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) -export PROGRAMMER_SPEED ?= 57600 +# configure the terminal program +PORT_LINUX ?= /dev/ttyUSB0 +PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) +BAUD ?= 9600 -export FFLAGS += -p m328p - -# 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 ?= arduino +# PROGRAMMER defaults to arduino which is the internal flasher via USB +# 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 BOOTLOADER_SIZE ?= 2K ROM_RESERVED ?= $(BOOTLOADER_SIZE) diff --git a/boards/arduino-mega2560/Makefile.include b/boards/arduino-mega2560/Makefile.include index 3a7a4aafd8..676e8dc12d 100644 --- a/boards/arduino-mega2560/Makefile.include +++ b/boards/arduino-mega2560/Makefile.include @@ -3,16 +3,19 @@ export CPU = atmega2560 USEMODULE += boards_common_arduino-atmega -#export needed for flash rule -export PORT_LINUX ?= /dev/ttyACM0 -export PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) -export PROGRAMMER_SPEED ?= 115200 +# configure the terminal program +PORT_LINUX ?= /dev/ttyACM0 +PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) +BAUD ?= 9600 -export FFLAGS += -p m2560 - -# PROGRAMMER defaults to stk500v2 which is the internal flasher via USB. Can be -# overridden for debugging (which requires changes that require to use an ISP) -export PROGRAMMER ?= stk500v2 +# PROGRAMMER defaults to stk500v2 which is the internal flasher via USB +# 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 BOOTLOADER_SIZE ?= 8K ROM_RESERVED ?= $(BOOTLOADER_SIZE) diff --git a/boards/arduino-uno/Makefile.include b/boards/arduino-uno/Makefile.include index 049373784c..6e0f63b778 100644 --- a/boards/arduino-uno/Makefile.include +++ b/boards/arduino-uno/Makefile.include @@ -3,16 +3,19 @@ export CPU = atmega328p USEMODULE += boards_common_arduino-atmega -# export needed for flash rule -export PORT_LINUX ?= /dev/ttyACM0 -export PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) -export PROGRAMMER_SPEED ?= 115200 +# configure the terminal program +PORT_LINUX ?= /dev/ttyACM0 +PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) +BAUD ?= 9600 -export FFLAGS += -p m328p - -# 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 ?= arduino +# PROGRAMMER defaults to stk500v2 which is the internal flasher via USB +# 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 BOOTLOADER_SIZE ?= 512 ROM_RESERVED ?= $(BOOTLOADER_SIZE) diff --git a/boards/common/arduino-atmega/Makefile.include b/boards/common/arduino-atmega/Makefile.include index 9c90f6b8c1..09b7483db3 100644 --- a/boards/common/arduino-atmega/Makefile.include +++ b/boards/common/arduino-atmega/Makefile.include @@ -3,19 +3,10 @@ include $(RIOTBOARD)/common/arduino-atmega/Makefile.dep INCLUDES += -I$(RIOTBOARD)/common/arduino-atmega/include -# refine serial port information -export 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) +# Disable auto erase for flash and avoid error if signature doesn't match +FFLAGS_EXTRA += -F -D -export PROGRAMMER_FLAGS = -P $(PORT) -b $(PROGRAMMER_SPEED) - -OFLAGS += -j .text -j .data -export FFLAGS += -c $(PROGRAMMER) $(PROGRAMMER_FLAGS) -F -D -U flash:w:$(HEXFILE) +# include avrdude flashing tool +include $(RIOTMAKE)/tools/avrdude.inc.mk diff --git a/boards/jiminy-mega256rfr2/Makefile.include b/boards/jiminy-mega256rfr2/Makefile.include index e3def21be4..43861c0577 100644 --- a/boards/jiminy-mega256rfr2/Makefile.include +++ b/boards/jiminy-mega256rfr2/Makefile.include @@ -15,7 +15,8 @@ export FFLAGS += -p atmega256rfr2 # For 8MHz F_CPU following Baudrate have good error rates # 76923 # 38400 -export 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) @@ -25,4 +26,4 @@ export PROGRAMMER ?= wiring BOOTLOADER_SIZE ?= 4K ROM_RESERVED ?= $(BOOTLOADER_SIZE) -include $(RIOTBOARD)/common/arduino-atmega/Makefile.include +include $(RIOTMAKE)/tools/avrdude.inc.mk -- GitLab