From 0ad9c87e9acbf85e1b7feb27edeea691aee93ae4 Mon Sep 17 00:00:00 2001 From: Jona Raemdonck Date: Wed, 13 Mar 2019 17:26:02 +0100 Subject: [PATCH] openocd: add debug_adapter gpio Requires openocd to be configured with "--sysfsgpio" during installation Allows for configuration of gpio selection through the setting of environment variables SWCLK, SWDIO and RST. --- .../tools/openocd-adapters/sysfsgpio.inc.mk | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 makefiles/tools/openocd-adapters/sysfsgpio.inc.mk diff --git a/makefiles/tools/openocd-adapters/sysfsgpio.inc.mk b/makefiles/tools/openocd-adapters/sysfsgpio.inc.mk new file mode 100644 index 000000000000..7f5795fee31b --- /dev/null +++ b/makefiles/tools/openocd-adapters/sysfsgpio.inc.mk @@ -0,0 +1,24 @@ +# GPIO debug adapter +export SWCLK ?= 21 +export SWDIO ?= 20 +export RST ?= 16 + +export OPENOCD_ADAPTER_INIT ?= \ + -c 'interface sysfsgpio' \ + -c 'sysfsgpio_swd_nums $(SWCLK) $(SWDIO)' \ + -c 'sysfsgpio_srst_num $(RST)' \ + -c 'reset_config srst_only srst_push_pull' \ + -c 'transport select swd' \ + -c 'adapter_nsrst_delay 100' \ + -c 'adapter_nsrst_assert_width 100' + +# if no openocd specific configuration file, check for default locations: +# 1. Using the default dist/openocd.cfg (automatically set by openocd.sh) +# 2. Using the common cpu specific config file +ifeq (,$(OPENOCD_CONFIG)) + # if no openocd default configuration is provided by the board, + # use the STM32 common one + ifeq (0,$(words $(wildcard $(RIOTBOARD)/$(BOARD)/dist/openocd.cfg))) + export OPENOCD_CONFIG := $(RIOTBASE)/boards/common/stm32/dist/$(CPU).cfg + endif +endif