1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

makefiles: add edbg tool support

This commit is contained in:
Kaspar Schleiser 2017-05-18 12:10:10 +02:00
parent 6a9175944c
commit d7d796b80d
2 changed files with 22 additions and 1 deletions

View File

@ -10,6 +10,7 @@ include $(RIOTMAKE)/tools/serial.inc.mk
# Usage: SERIAL="ATML..." BOARD=<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

View File

@ -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