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

Merge pull request #7073 from kaspar030/add_edbg_support

tools: add edbg support
This commit is contained in:
Hauke Petersen 2017-05-24 17:35:43 +02:00 committed by GitHub
commit c57d67fab8
8 changed files with 48 additions and 2 deletions

View File

@ -2,4 +2,7 @@
export CPU = samd21
export CPU_MODEL = samd21j18a
# set edbg device type
EDBG_DEVICE_TYPE = atmel_cm0p
include $(RIOTMAKE)/boards/sam0.inc.mk

View File

@ -2,4 +2,7 @@
export CPU = samd21
export CPU_MODEL = samr21g18a
# set edbg device type
EDBG_DEVICE_TYPE = atmel_cm0p
include $(RIOTMAKE)/boards/sam0.inc.mk

1
dist/tools/edbg/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
edbg

13
dist/tools/edbg/Makefile vendored Normal file
View File

@ -0,0 +1,13 @@
PKG_NAME=edbg
PKG_URL=https://github.com/ataradov/edbg
PKG_VERSION=d499ffd8297233b65dd91fd58fb98b9f9a03fec1
PKG_LICENSE=BSD-3-Clause
PKG_BUILDDIR=$(CURDIR)/bin
.PHONY: all
all: git-download
"$(MAKE)" -C $(PKG_BUILDDIR)
mv $(PKG_BUILDDIR)/edbg .
include $(RIOTBASE)/pkg/pkg.mk

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

View File

@ -1,4 +1,4 @@
export FLASHER = $(RIOTBASE)/dist/tools/openocd/openocd.sh
export FLASHER ?= $(RIOTBASE)/dist/tools/openocd/openocd.sh
export DEBUGGER = $(RIOTBASE)/dist/tools/openocd/openocd.sh
export DEBUGSERVER = $(RIOTBASE)/dist/tools/openocd/openocd.sh
export RESET = $(RIOTBASE)/dist/tools/openocd/openocd.sh

View File

@ -9,3 +9,8 @@ $(RIOTBASE)/dist/tools/bossa/bossac:
@echo "[INFO] bossac binary not found - building it from source"
@make -C $(RIOTBASE)/dist/tools/bossa
@echo "[INFO] bossac binary successfully build!"
$(RIOTBASE)/dist/tools/edbg/edbg:
@echo "[INFO] edbg binary not found - building it from source now"
CC= CFLAGS= make -C $(RIOTBASE)/dist/tools/edbg
@echo "[INFO] edbg binary successfully build!"