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

Merge pull request #14480 from benpicco/openocd-adapters_swd

openocd-adapters: select transport based on adapter
This commit is contained in:
benpicco 2020-08-04 11:37:32 +02:00 committed by GitHub
commit 52bf3096cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 39 additions and 14 deletions

View File

@ -10,9 +10,6 @@
# CMSIS-DAP (DAPLink) compatible OpenSDA firmware binary images can be found at:
# http://www.nxp.com/opensda
# Kinetis L only supports SWD
transport select swd
# Kinetis L series CPUs
source [find target/klx.cfg]

View File

@ -1,3 +1 @@
transport select swd
source [find target/nrf52.cfg]

View File

@ -25,4 +25,10 @@ To flash the board with OpenOCD, use the `PROGRAMMER` variable:
PROGRAMMER=openocd make BOARD=<nrf52 board> -C examples/hello-world flash
```
It is also possible to use the SWD interface of a ST-LINK/V2 in-circuit
debugger/programmer with OpenOCD to flash a nrf52 board:
```
PROGRAMMER=openocd DEBUG_ADAPTER=stlink make BOARD=<nrf52 board> -C examples/hello-world flash
```
*/

View File

@ -3,6 +3,7 @@ DEBUG_ADAPTER ?= dap
PROGRAMMER ?= openocd
JLINK_DEVICE := LPC2388
OPENOCD_TRANSPORT := jtag
include $(RIOTBOARD)/common/msba2/Makefile.include
include $(RIOTMAKE)/tools/openocd.inc.mk

View File

@ -1,5 +1,3 @@
transport select jtag
source [find target/lpc2xxx.cfg]
# parameters:
# - core_freq_khz - frequency of core in kHz during flashing, usually equal to connected crystal or internal oscillator, e.g. 12000

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