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

makefiles/tools/openocd-adapters: default to SWD, but make it configurable

This commit is contained in:
Benjamin Valentin 2020-07-09 17:03:15 +02:00 committed by Benjamin Valentin
parent 30ebabb84e
commit 0d59e7dc6e
8 changed files with 32 additions and 7 deletions

View File

@ -1,5 +1,9 @@
# CMSIS DAP debug adapter
OPENOCD_ADAPTER_INIT ?= -c 'source [find interface/cmsis-dap.cfg]'
# default to SWD
OPENOCD_TRANSPORT ?= swd
# Add serial matching command, only if DEBUG_ADAPTER_ID was specified
ifneq (,$(DEBUG_ADAPTER_ID))
OPENOCD_ADAPTER_INIT += -c 'cmsis_dap_serial $(DEBUG_ADAPTER_ID)'

View File

@ -1,6 +1,9 @@
# iotlab-usb debug adapter
OPENOCD_ADAPTER_INIT ?= -c 'source [find interface/ftdi/iotlab-usb.cfg]'
# default to SWD
OPENOCD_TRANSPORT ?= swd
# Add serial matching command, only if DEBUG_ADAPTER_ID was specified
ifneq (,$(DEBUG_ADAPTER_ID))
OPENOCD_ADAPTER_INIT += -c 'ftdi_serial $(DEBUG_ADAPTER_ID)'

View File

@ -1,5 +1,9 @@
# Segger J-Link debug adapter
OPENOCD_ADAPTER_INIT ?= -c 'source [find interface/jlink.cfg]'
# default to SWD
OPENOCD_TRANSPORT ?= swd
# Add serial matching command, only if DEBUG_ADAPTER_ID was specified
ifneq (,$(DEBUG_ADAPTER_ID))
OPENOCD_ADAPTER_INIT += -c 'jlink serial $(DEBUG_ADAPTER_ID)'

View File

@ -26,6 +26,9 @@ PROGRAMMER_VERSION ?= 0.70
OPENOCD_ADAPTER_INIT ?= -f '$(RIOTBASE)/boards/mulle/dist/openocd/mulle-programmer-$(PROGRAMMER_VERSION).cfg'
# Default to SWD
OPENOCD_TRANSPORT ?= swd
# Add serial matching command, only if DEBUG_ADAPTER_ID was specified
ifneq (,$(DEBUG_ADAPTER_ID))
OPENOCD_ADAPTER_INIT += -c 'ftdi_serial $(DEBUG_ADAPTER_ID)'

View File

@ -29,8 +29,10 @@ OPENOCD_ADAPTER_INIT ?= \
-c 'bcm2835gpio_peripheral_base $(PERIPH_BASE)' \
-c 'bcm2835gpio_speed_coeffs $(SPEED_COEFF) $(SPEED_OFFSET)' \
-c 'bcm2835gpio_swd_nums $(SWCLK_PIN ) $(SWDIO_PIN)' \
-c 'bcm2835gpio_srst_num $(SRST_PIN)' \
-c 'transport select swd'
-c 'bcm2835gpio_srst_num $(SRST_PIN)'
# Default to SWD
OPENOCD_TRANSPORT ?= swd
# bcm2835gpio needs access to /dev/mem
export OPENOCD ?= sudo -E openocd

View File

@ -3,15 +3,21 @@
STLINK_VERSION ?= 2-1
# Use STLINK_VERSION to select which stlink version is used
OPENOCD_ADAPTER_INIT ?= \
-c 'source [find interface/stlink-v$(STLINK_VERSION).cfg]' \
-c 'transport select hla_swd'
OPENOCD_ADAPTER_INIT ?= -c 'source [find interface/stlink-v$(STLINK_VERSION).cfg]'
# If swd / jtag is selected by the board, prefix it with hla_
ifneq (,$(filter swd jtag,$(OPENOCD_TRANSPORT)))
OPENOCD_TRANSPORT := hla_$(OPENOCD_TRANSPORT)
endif
# All ST-Link adapters support hla_swd, so use that for simplicity
OPENOCD_TRANSPORT ?= hla_swd
# Add serial matching command, only if DEBUG_ADAPTER_ID was specified
ifneq (,$(DEBUG_ADAPTER_ID))
OPENOCD_ADAPTER_INIT += -c 'hla_serial $(DEBUG_ADAPTER_ID)'
endif
# Some stlink clones cannot signal reset properly,
# In this case, use SRST=none
ifneq (,$(SRST))

View File

@ -6,8 +6,10 @@ SRST_PIN ?= 16
OPENOCD_ADAPTER_INIT ?= \
-c 'interface sysfsgpio' \
-c 'transport select swd' \
-c 'sysfsgpio_swd_nums $(SWCLK_PIN) $(SWDIO_PIN)' \
-c 'sysfsgpio_srst_num $(SRST_PIN)' \
-c 'adapter_nsrst_delay 100' \
-c 'adapter_nsrst_assert_width 100'
# default to SWD
OPENOCD_TRANSPORT ?= swd

View File

@ -11,6 +11,7 @@ RESET_FLAGS ?= reset
ifneq (,$(DEBUG_ADAPTER))
include $(RIOTMAKE)/tools/openocd-adapters/$(DEBUG_ADAPTER).inc.mk
OPENOCD_ADAPTER_INIT += -c 'transport select $(OPENOCD_TRANSPORT)'
endif
OPENOCD_CONFIG ?= $(BOARDDIR)/dist/openocd.cfg