From d7d796b80d80e2a66fa5ccdf5d7e10b046569aac Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Thu, 18 May 2017 12:10:10 +0200 Subject: [PATCH] makefiles: add edbg tool support --- makefiles/boards/sam0.inc.mk | 13 ++++++++++++- makefiles/tools/edbg.inc.mk | 10 ++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 makefiles/tools/edbg.inc.mk diff --git a/makefiles/boards/sam0.inc.mk b/makefiles/boards/sam0.inc.mk index 89a76ea42c..ef7578e528 100644 --- a/makefiles/boards/sam0.inc.mk +++ b/makefiles/boards/sam0.inc.mk @@ -10,6 +10,7 @@ include $(RIOTMAKE)/tools/serial.inc.mk # Usage: SERIAL="ATML..." BOARD= make flash ifneq (,$(SERIAL)) export OPENOCD_EXTRA_INIT += "-c cmsis_dap_serial $(SERIAL)" + EDBG_ARGS += "--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)) @@ -17,5 +18,15 @@ ifneq (,$(SERIAL)) PORT_LINUX := $(SERIAL_TTY) endif -# this board uses openocd +# set this to either openocd or edbg +PROGRAMMER ?= edbg + +# use edbg if selected and a device type has been set +ifeq ($(PROGRAMMER),edbg) + ifneq (,$(EDBG_DEVICE_TYPE)) + include $(RIOTMAKE)/tools/edbg.inc.mk + endif +endif + +# this board uses openocd for debug and possibly flashing include $(RIOTMAKE)/tools/openocd.inc.mk diff --git a/makefiles/tools/edbg.inc.mk b/makefiles/tools/edbg.inc.mk new file mode 100644 index 0000000000..353be21a90 --- /dev/null +++ b/makefiles/tools/edbg.inc.mk @@ -0,0 +1,10 @@ +RIOT_EDBG = $(RIOTBASE)/dist/tools/edbg/edbg +EDBG ?= $(RIOT_EDBG) +FLASHER ?= $(EDBG) +OFLAGS ?= -O binary +HEXFILE = $(ELFFILE:.elf=.bin) +FFLAGS ?= $(EDBG_ARGS) -t $(EDBG_DEVICE_TYPE) -b -e -v -p -f $(HEXFILE) + +ifeq ($(RIOT_EDBG),$(FLASHER)) + FLASHDEPS += $(RIOT_EDBG) +endif