diff --git a/boards/arduino-zero/Makefile.include b/boards/arduino-zero/Makefile.include index d8a948a8074efaaaab3fe510b130428c3751a2d3..711af3ea92ff037aab740a47282e0eb1b35d216c 100644 --- a/boards/arduino-zero/Makefile.include +++ b/boards/arduino-zero/Makefile.include @@ -2,24 +2,4 @@ export CPU = samd21 export CPU_MODEL = samd21g18a -# set default port depending on operating system -export PORT_LINUX ?= /dev/ttyACM0 -export PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) - -# setup serial terminal -include $(RIOTMAKE)/tools/serial.inc.mk - -# Add board selector (USB serial) to OpenOCD options if specified. -# Use /dist/tools/usb-serial/list-ttys.sh to find out serial number. -# Usage: SERIAL="<SERIAL>" BOARD="arduino-zero" make flash -ifneq (,$(SERIAL)) - export OPENOCD_EXTRA_INIT += "-c cmsis_dap_serial $(SERIAL)" - SERIAL_TTY = $(shell $(RIOTBASE)/dist/tools/usb-serial/find-tty.sh $(SERIAL)) - ifeq (,$(SERIAL_TTY)) - $(error Did not find a device with serial $(SERIAL)) - endif - PORT_LINUX := $(SERIAL_TTY) -endif - -# this board uses openocd -include $(RIOTMAKE)/tools/openocd.inc.mk +include $(RIOTMAKE)/boards/sam0.inc.mk diff --git a/boards/samd21-xpro/Makefile.include b/boards/samd21-xpro/Makefile.include index e8415c937eca8508a9d1696c3796bb9437a4fbad..06056fc464fa10838866606bf83a6cae470e7820 100644 --- a/boards/samd21-xpro/Makefile.include +++ b/boards/samd21-xpro/Makefile.include @@ -2,24 +2,4 @@ export CPU = samd21 export CPU_MODEL = samd21j18a -# set default port depending on operating system -PORT_LINUX ?= /dev/ttyACM0 -PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) - -# setup serial terminal -include $(RIOTMAKE)/tools/serial.inc.mk - -# Add board selector (USB serial) to OpenOCD options if specified. -# Use /dist/tools/usb-serial/list-ttys.sh to find out serial number. -# Usage: SERIAL="ATML..." BOARD="samd21-xpro" make flash -ifneq (,$(SERIAL)) - export OPENOCD_EXTRA_INIT += "-c cmsis_dap_serial $(SERIAL)" - SERIAL_TTY = $(firstword $(shell $(RIOTBASE)/dist/tools/usb-serial/find-tty.sh $(SERIAL))) - ifeq (,$(SERIAL_TTY)) - $(error Did not find a device with serial $(SERIAL)) - endif - PORT_LINUX := $(SERIAL_TTY) -endif - -# this board uses openocd -include $(RIOTMAKE)/tools/openocd.inc.mk +include $(RIOTMAKE)/boards/sam0.inc.mk diff --git a/boards/saml21-xpro/Makefile.include b/boards/saml21-xpro/Makefile.include index c96d71bec7df93cb13e91e789d90e54b461723f1..d705e25f3bdd5fb8e8594c819f940cfc5b97b232 100644 --- a/boards/saml21-xpro/Makefile.include +++ b/boards/saml21-xpro/Makefile.include @@ -3,9 +3,4 @@ export CPU = saml21 export CPU_MODEL = saml21j18a export CFLAGS += -D__SAML21J18A__ -# setup serial terminal -PORT_LINUX ?= /dev/ttyACM0 -include $(RIOTMAKE)/tools/serial.inc.mk - -# this board uses openocd -include $(RIOTMAKE)/tools/openocd.inc.mk +include $(RIOTMAKE)/boards/sam0.inc.mk diff --git a/boards/samr21-xpro/Makefile.include b/boards/samr21-xpro/Makefile.include index 7f68e0eaa1bf70cfefc92dba352578d9d2d12274..acc6ee400b916fab5966c805f28874fb73b6b984 100644 --- a/boards/samr21-xpro/Makefile.include +++ b/boards/samr21-xpro/Makefile.include @@ -2,24 +2,4 @@ export CPU = samd21 export CPU_MODEL = samr21g18a -# set default port depending on operating system -PORT_LINUX ?= /dev/ttyACM0 -PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) - -# setup serial terminal -include $(RIOTMAKE)/tools/serial.inc.mk - -# Add board selector (USB serial) to OpenOCD options if specified. -# Use /dist/tools/usb-serial/list-ttys.sh to find out serial number. -# Usage: SERIAL="ATML..." BOARD="samr21-xpro" make flash -ifneq (,$(SERIAL)) - export OPENOCD_EXTRA_INIT += "-c cmsis_dap_serial $(SERIAL)" - SERIAL_TTY = $(firstword $(shell $(RIOTBASE)/dist/tools/usb-serial/find-tty.sh $(SERIAL))) - ifeq (,$(SERIAL_TTY)) - $(error Did not find a device with serial $(SERIAL)) - endif - PORT_LINUX := $(SERIAL_TTY) -endif - -# this board uses openocd -include $(RIOTMAKE)/tools/openocd.inc.mk +include $(RIOTMAKE)/boards/sam0.inc.mk diff --git a/boards/sodaq-autonomo/Makefile.include b/boards/sodaq-autonomo/Makefile.include index 83eb6a03145a31fc84c0da502131f9afabc50654..c6121dd6e31e933787d4e28a3324d9941fd723a5 100644 --- a/boards/sodaq-autonomo/Makefile.include +++ b/boards/sodaq-autonomo/Makefile.include @@ -2,26 +2,4 @@ export CPU = samd21 export CPU_MODEL = samd21j18a -# set default port depending on operating system -PORT_LINUX ?= /dev/ttyACM0 -PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) - -export OFLAGS = -O binary - -# setup serial terminal -include $(RIOTMAKE)/tools/serial.inc.mk - -# Add board selector (USB serial) to OpenOCD options if specified. -# Use /dist/tools/usb-serial/list-ttys.sh to find out serial number. -# Usage: SERIAL="AAA..." BOARD="sodaq-autonomo" make flash -ifneq (,$(SERIAL)) - export OPENOCD_EXTRA_INIT += "-c cmsis_dap_serial $(SERIAL)" - SERIAL_TTY = $(shell $(RIOTBASE)/dist/tools/usb-serial/find-tty.sh $(SERIAL)) - ifeq (,$(SERIAL_TTY)) - $(error Did not find a device with serial $(SERIAL)) - endif - PORT_LINUX := $(SERIAL_TTY) -endif - -# this board uses openocd -include $(RIOTMAKE)/tools/openocd.inc.mk +include $(RIOTMAKE)/boards/sam0.inc.mk diff --git a/makefiles/boards/sam0.inc.mk b/makefiles/boards/sam0.inc.mk new file mode 100644 index 0000000000000000000000000000000000000000..89a76ea42c1497bf97dc3f84b74ac4388b7e604a --- /dev/null +++ b/makefiles/boards/sam0.inc.mk @@ -0,0 +1,21 @@ +# set default port depending on operating system +PORT_LINUX ?= /dev/ttyACM0 +PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) + +# setup serial terminal +include $(RIOTMAKE)/tools/serial.inc.mk + +# Add board selector (USB serial) to OpenOCD options if specified. +# Use /dist/tools/usb-serial/list-ttys.sh to find out serial number. +# Usage: SERIAL="ATML..." BOARD=<board> make flash +ifneq (,$(SERIAL)) + export OPENOCD_EXTRA_INIT += "-c cmsis_dap_serial $(SERIAL)" + SERIAL_TTY = $(firstword $(shell $(RIOTBASE)/dist/tools/usb-serial/find-tty.sh $(SERIAL))) + ifeq (,$(SERIAL_TTY)) + $(error Did not find a device with serial $(SERIAL)) + endif + PORT_LINUX := $(SERIAL_TTY) +endif + +# this board uses openocd +include $(RIOTMAKE)/tools/openocd.inc.mk