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

dist/tools/openocd/stlink: handle new and old Openocd version

This commit is contained in:
Jelle Haandrikman 2020-08-26 12:05:38 +02:00 committed by Francisco Molina
parent 48e5bbc8ba
commit f18d3f5663
No known key found for this signature in database
GPG Key ID: 3E94EAC3DBDEEDA8
2 changed files with 17 additions and 3 deletions

12
dist/tools/openocd/adapters/stlink.cfg vendored Normal file
View File

@ -0,0 +1,12 @@
# OpenOCD currently uses a single configuration file for all ST-Link
# adapters. However not all supported distributions use the latest
# OpenOCD.
# If the default script isn't available then use the old method via
# specifying the correct version.
try {
source [find interface/stlink.cfg]
} on error {} {
puts "WARNING: using old version of OpenOCD"
puts "Using STLINK_VERSION $stlink_version"
source [find interface/stlink-v${stlink_version}.cfg]
}

View File

@ -1,9 +1,11 @@
# ST-Link debug adapter
# Use st-link v2-1 by default
# Set the default version for the old OpenOCD versions
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]'
# Determine which configuration file to use for OpenOCD.
# Also pass the correct version of the ST-Link adapter to the script.
OPENOCD_ADAPTER_INIT ?= -c 'set stlink_version $(STLINK_VERSION);source $(RIOTBASE)/dist/tools/openocd/adapters/stlink.cfg'
# If swd / jtag is selected by the board, prefix it with hla_
ifneq (,$(filter swd jtag,$(OPENOCD_TRANSPORT)))