Browse Source

Merge pull request #7073 from kaspar030/add_edbg_support

tools: add edbg support
master
Hauke Petersen 5 years ago committed by GitHub
parent
commit
c57d67fab8
  1. 3
      boards/samd21-xpro/Makefile.include
  2. 3
      boards/samr21-xpro/Makefile.include
  3. 1
      dist/tools/edbg/.gitignore
  4. 13
      dist/tools/edbg/Makefile
  5. 13
      makefiles/boards/sam0.inc.mk
  6. 10
      makefiles/tools/edbg.inc.mk
  7. 2
      makefiles/tools/openocd.inc.mk
  8. 5
      makefiles/tools/targets.inc.mk

3
boards/samd21-xpro/Makefile.include

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

3
boards/samr21-xpro/Makefile.include

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

@ -0,0 +1 @@
edbg

13
dist/tools/edbg/Makefile vendored

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

13
makefiles/boards/sam0.inc.mk

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

10
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

2
makefiles/tools/openocd.inc.mk

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

5
makefiles/tools/targets.inc.mk

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

Loading…
Cancel
Save