From c897773daf84276facf81b589d899d3e11945a3f Mon Sep 17 00:00:00 2001 From: Francisco Acosta Date: Mon, 14 May 2018 19:25:21 +0200 Subject: [PATCH 1/6] makefiles: add atmega arch generic makefile --- makefiles/arch/atmega.inc.mk | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 makefiles/arch/atmega.inc.mk diff --git a/makefiles/arch/atmega.inc.mk b/makefiles/arch/atmega.inc.mk new file mode 100644 index 0000000000..b45178e301 --- /dev/null +++ b/makefiles/arch/atmega.inc.mk @@ -0,0 +1,50 @@ +# Target architecture for the build. Use avr if you are unsure. +TARGET_ARCH ?= avr + +CFLAGS_CPU = -mmcu=$(CPU) $(CFLAGS_FPU) +CFLAGS_LINK = -ffunction-sections -fdata-sections -fno-builtin -fshort-enums +CFLAGS_DBG ?= -ggdb -g3 +CFLAGS_OPT ?= -Os + +CFLAGS += $(CFLAGS_CPU) $(CFLAGS_LINK) $(CFLAGS_DBG) $(CFLAGS_OPT) +ASFLAGS += $(CFLAGS_CPU) $(CFLAGS_DBG) +LINKFLAGS += $(CFLAGS_CPU) $(CFLAGS_DBG) $(CFLAGS_OPT) -static -lgcc -e reset_handler -Wl,--gc-sections +OFLAGS += -j .text -j .data + +# Tell the build system that the CPU depends on the atmega common files: +USEMODULE += atmega_common + +# export the peripheral drivers to be linked into the final binary +USEMODULE += atmega_common_periph +USEMODULE += periph_common + +# Export the peripheral drivers to be linked into the final binary, for now +# only atmega126rfr2 has periph drivers +ifeq ($(CPU), atmega256rfr2) + USEMODULE += periph +endif + +# the atmel port uses stdio_uart +USEMODULE += stdio_uart + +# explicitly tell the linker to link the syscalls and startup code. +# without this the interrupt vectors will not be linked correctly! +UNDEF += $(BINDIR)/atmega_common/startup.o + +# Use ROM_LEN and RAM_LEN during link +$(if $(ROM_LEN),,$(error ROM_LEN is not defined)) +$(if $(RAM_LEN),,$(error RAM_LEN is not defined)) +LINKFLAGS += $(LINKFLAGPREFIX)--defsym=__TEXT_REGION_LENGTH__=$(ROM_LEN)$(if $(ROM_RESERVED),-$(ROM_RESERVED)) +LINKFLAGS += $(LINKFLAGPREFIX)--defsym=__DATA_REGION_LENGTH__=$(RAM_LEN) + +# Use newer linker script to have ROM/RAM configuration symbols in binutils<2.26 +LDSCRIPT_COMPAT = $(if $(shell $(TARGET_ARCH)-ld --verbose | grep __TEXT_REGION_LENGTH__),,\ + -T$(RIOTCPU)/$(CPU)/ldscripts_compat/avr_2.26.ld) +LINKFLAGS += $(LDSCRIPT_COMPAT) + +ifeq ($(LTO),1) + # avr-gcc <4.8.3 has a bug when using LTO which causes a warning to be printed always: + # '_vector_25' appears to be a misspelled signal handler [enabled by default] + # See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59396 + LINKFLAGS += -Wno-error +endif From 6bbf372d7d1aab5782781a105b3787eff5a954d3 Mon Sep 17 00:00:00 2001 From: Francisco Acosta Date: Mon, 14 May 2018 19:27:10 +0200 Subject: [PATCH 2/6] makefiles: factor out avrdude configuration Allows to use avrdude as a flashing tool in any context (e.g. not dependent on arduino or atmega) though it only works (AFAIK) on atmega, but I thought it's better to have it here as we have other flashing tools. --- makefiles/tools/avrdude.inc.mk | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 makefiles/tools/avrdude.inc.mk diff --git a/makefiles/tools/avrdude.inc.mk b/makefiles/tools/avrdude.inc.mk new file mode 100644 index 0000000000..b45c685f48 --- /dev/null +++ b/makefiles/tools/avrdude.inc.mk @@ -0,0 +1,16 @@ +FLASHER = avrdude +DIST_PATH = $(RIOTBOARD)/$(BOARD)/dist +DEBUGSERVER_PORT = 4242 +DEBUGSERVER = $(DIST_PATH)/debug_srv.sh +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) + +# don't force to flash HEXFILE, but set it as default +FLASHFILE ?= $(HEXFILE) +FFLAGS += -c $(PROGRAMMER) $(PROGRAMMER_FLAGS) -U flash:w:$(HEXFILE) From 2bdcdddd76e5c97c7bff8b51284186164d6bdc44 Mon Sep 17 00:00:00 2001 From: Francisco Acosta Date: Tue, 15 May 2018 00:21:09 +0200 Subject: [PATCH 3/6] cpu/atmega*: make use of common atmega.inc.mk and remove redundancies Everything is now defined in atmega.inc.mk, following the common RIOT-like reusability of rules and variables (e.g. cortexm.inc.mk). --- cpu/atmega256rfr2/periph/Makefile | 2 +- cpu/atmega328p/Makefile.include | 2 +- cpu/atmega_common/Makefile.include | 39 ++---------------------------- 3 files changed, 4 insertions(+), 39 deletions(-) diff --git a/cpu/atmega256rfr2/periph/Makefile b/cpu/atmega256rfr2/periph/Makefile index 48422e909a..a36df249ac 100644 --- a/cpu/atmega256rfr2/periph/Makefile +++ b/cpu/atmega256rfr2/periph/Makefile @@ -1 +1 @@ -include $(RIOTBASE)/Makefile.base +include $(RIOTMAKE)/periph.mk diff --git a/cpu/atmega328p/Makefile.include b/cpu/atmega328p/Makefile.include index 058b45a115..20119203dd 100644 --- a/cpu/atmega328p/Makefile.include +++ b/cpu/atmega328p/Makefile.include @@ -5,4 +5,4 @@ RAM_LEN = 2K ROM_LEN = 32K # CPU depends on the atmega common module, so include it -include $(RIOTCPU)/atmega_common/Makefile.include \ No newline at end of file +include $(RIOTCPU)/atmega_common/Makefile.include diff --git a/cpu/atmega_common/Makefile.include b/cpu/atmega_common/Makefile.include index 4d3ed2832d..5c02288d19 100644 --- a/cpu/atmega_common/Makefile.include +++ b/cpu/atmega_common/Makefile.include @@ -1,44 +1,9 @@ -# Target architecture for the build. Use avr if you are unsure. -export TARGET_ARCH ?= avr - -export CFLAGS_CPU = -mmcu=$(CPU) $(CFLAGS_FPU) -export CFLAGS_LINK = -ffunction-sections -fdata-sections -fno-builtin -fshort-enums -export CFLAGS_DBG ?= -ggdb -g3 -export CFLAGS_OPT ?= -Os - -export CFLAGS += $(CFLAGS_CPU) $(CFLAGS_LINK) $(CFLAGS_DBG) $(CFLAGS_OPT) -export ASFLAGS += $(CFLAGS_CPU) $(CFLAGS_DBG) -LINKFLAGS += $(CFLAGS_CPU) $(CFLAGS_DBG) $(CFLAGS_OPT) -static -lgcc -e reset_handler -Wl,--gc-sections - -# export the peripheral drivers to be linked into the final binary -export USEMODULE += atmega_common_periph -export USEMODULE += periph_common - -# the atmel port uses stdio_uart -export USEMODULE += stdio_uart - # include module specific includes export INCLUDES += -I$(RIOTCPU)/atmega_common/include \ -isystem$(RIOTCPU)/atmega_common/avr_libc_extra/include \ -isystem$(RIOTCPU)/atmega_common/avr_libc_extra/include/vendor -ifeq ($(LTO),1) - # avr-gcc <4.8.3 has a bug when using LTO which causes a warning to be printed always: - # '_vector_25' appears to be a misspelled signal handler [enabled by default] - # See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59396 - LINKFLAGS += -Wno-error -endif - -# Use ROM_LEN and RAM_LEN during link -$(if $(ROM_LEN),,$(error ROM_LEN is not defined)) -$(if $(RAM_LEN),,$(error RAM_LEN is not defined)) -LINKFLAGS += $(LINKFLAGPREFIX)--defsym=__TEXT_REGION_LENGTH__=$(ROM_LEN)$(if $(ROM_RESERVED),-$(ROM_RESERVED)) -LINKFLAGS += $(LINKFLAGPREFIX)--defsym=__DATA_REGION_LENGTH__=$(RAM_LEN) - -# Use newer linker script to have ROM/RAM configuration symbols in binutils<2.26 -LDSCRIPT_COMPAT = $(if $(shell $(TARGET_ARCH)-ld --verbose | grep __TEXT_REGION_LENGTH__),,\ - -T$(RIOTCPU)/$(CPU)/ldscripts_compat/avr_2.26.ld) -LINKFLAGS += $(LDSCRIPT_COMPAT) - # avr libc needs some RIOT-specific support code USEMODULE += avr_libc_extra + +include $(RIOTMAKE)/arch/atmega.inc.mk From 1a98d64cd56f3ba69ef820c1f5d980fc51ee74f7 Mon Sep 17 00:00:00 2001 From: Francisco Acosta Date: Tue, 15 May 2018 02:16:27 +0200 Subject: [PATCH 4/6] 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 From d208cba4649f0cee7b24d1d639c9c0ec54a25678 Mon Sep 17 00:00:00 2001 From: Francisco Acosta Date: Tue, 15 May 2018 02:31:33 +0200 Subject: [PATCH 5/6] boards: leverage avrdude.inc.mk for atmega based boards. Additionally, it removes unnecessary exports and cleans up waspmote-pro toolchain variables (not needed) which are taken from atmega_common. --- boards/jiminy-mega256rfr2/Makefile.include | 29 +++++++++-------- boards/mega-xplained/Makefile.include | 33 +++++++++---------- boards/waspmote-pro/Makefile.include | 38 +++++++--------------- 3 files changed, 42 insertions(+), 58 deletions(-) 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 From 7139393394985177af1f3022ba8ae9b47c2a5d4d Mon Sep 17 00:00:00 2001 From: Francisco Acosta Date: Mon, 5 Nov 2018 18:04:43 +0100 Subject: [PATCH 6/6] boards: include potential features from CPU for atmega boards Features must be provided by the board if they're actually available on board. Other features might be provided by the CPU. Some grouping is also removed as it is not necessary. --- boards/common/arduino-atmega/Makefile.features | 3 --- boards/jiminy-mega256rfr2/Makefile.features | 6 ++---- boards/mega-xplained/Makefile.features | 5 +---- boards/waspmote-pro/Makefile.features | 5 +---- 4 files changed, 4 insertions(+), 15 deletions(-) diff --git a/boards/common/arduino-atmega/Makefile.features b/boards/common/arduino-atmega/Makefile.features index ec1f08f176..d47ec4565f 100644 --- a/boards/common/arduino-atmega/Makefile.features +++ b/boards/common/arduino-atmega/Makefile.features @@ -11,6 +11,3 @@ ifeq (,$(filter jiminy-mega256rfr2,$(BOARD))) FEATURES_PROVIDED += arduino FEATURES_PROVIDED += periph_pwm endif - -# The board MPU family (used for grouping by the CI system) -FEATURES_MCU_GROUP = avr8 diff --git a/boards/jiminy-mega256rfr2/Makefile.features b/boards/jiminy-mega256rfr2/Makefile.features index 358ba448f5..5ad360ac35 100644 --- a/boards/jiminy-mega256rfr2/Makefile.features +++ b/boards/jiminy-mega256rfr2/Makefile.features @@ -1,10 +1,8 @@ +# This board is based on an atmega CPU, thus import the features from it include $(RIOTBOARD)/common/arduino-atmega/Makefile.features # Put defined MCU peripherals here (in alphabetical order) # Peripherals are defined in common/arduino-atmega/Makefile.features # Add only additional Peripherals -# The board MPU family (used for grouping by the CI system) -FEATURES_MCU_GROUP = avr6 - -include $(RIOTCPU)/atmega256rfr2/Makefile.features +-include $(RIOTCPU)/atmega256rfr2/Makefile.features diff --git a/boards/mega-xplained/Makefile.features b/boards/mega-xplained/Makefile.features index 7a8d6d41bf..56b3086778 100644 --- a/boards/mega-xplained/Makefile.features +++ b/boards/mega-xplained/Makefile.features @@ -8,7 +8,4 @@ FEATURES_PROVIDED += periph_uart # Various other features (if any) -# The board MPU family (used for grouping by the CI system) -FEATURES_MCU_GROUP = avr8 - -include $(RIOTCPU)/atmega1284p/Makefile.features +-include $(RIOTCPU)/atmega1284p/Makefile.features diff --git a/boards/waspmote-pro/Makefile.features b/boards/waspmote-pro/Makefile.features index c4cd23b264..86895b34bb 100644 --- a/boards/waspmote-pro/Makefile.features +++ b/boards/waspmote-pro/Makefile.features @@ -8,7 +8,4 @@ FEATURES_PROVIDED += periph_uart # Various other features (if any) -# The board MPU family (used for grouping by the CI system) -FEATURES_MCU_GROUP = avr8 - -include $(RIOTCPU)/atmega1281/Makefile.features +-include $(RIOTCPU)/atmega1281/Makefile.features