From 57de166ea152cfc01a09cee10a8ab6f71792e907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Nohlg=C3=A5rd?= Date: Fri, 6 Oct 2017 14:53:26 +0200 Subject: [PATCH 1/3] makefiles: Refactor openocd tool handling Attempt to decouple board configuration from debugger interface configuration by specifying the DEBUG_IFACE variable for the debug hardware interface to use. --- dist/tools/openocd/openocd.sh | 20 ++++++++--- makefiles/tools/openocd-adapters/README.md | 2 ++ makefiles/tools/openocd-adapters/dap.inc.mk | 7 ++++ makefiles/tools/openocd-adapters/jlink.inc.mk | 7 ++++ makefiles/tools/openocd-adapters/mulle.inc.mk | 33 +++++++++++++++++++ .../tools/openocd-adapters/stlink.inc.mk | 10 ++++++ makefiles/tools/openocd.inc.mk | 4 +++ 7 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 makefiles/tools/openocd-adapters/README.md create mode 100644 makefiles/tools/openocd-adapters/dap.inc.mk create mode 100644 makefiles/tools/openocd-adapters/jlink.inc.mk create mode 100644 makefiles/tools/openocd-adapters/mulle.inc.mk create mode 100644 makefiles/tools/openocd-adapters/stlink.inc.mk diff --git a/dist/tools/openocd/openocd.sh b/dist/tools/openocd/openocd.sh index babf0bb224c4..14de9fd164d8 100755 --- a/dist/tools/openocd/openocd.sh +++ b/dist/tools/openocd/openocd.sh @@ -66,6 +66,10 @@ : ${OPENOCD_CONFIG:=${RIOTBOARD}/${BOARD}/dist/openocd.cfg} # Default OpenOCD command : ${OPENOCD:=openocd} +# Extra board initialization commands to pass to OpenOCD +: ${OPENOCD_EXTRA_INIT:=} +# Debugger interface initialization commands to pass to OpenOCD +: ${OPENOCD_ADAPTER_INIT:=} # The setsid command is needed so that Ctrl+C in GDB doesn't kill OpenOCD : ${SETSID:=setsid} # GDB command, usually a separate command for each platform (e.g. arm-none-eabi-gdb) @@ -152,7 +156,9 @@ do_flash() { fi fi # flash device - sh -c "${OPENOCD} -f '${OPENOCD_CONFIG}' \ + sh -c "${OPENOCD} \ + ${OPENOCD_ADAPTER_INIT} \ + -f '${OPENOCD_CONFIG}' \ ${OPENOCD_EXTRA_INIT} \ -c 'tcl_port 0' \ -c 'telnet_port 0' \ @@ -186,7 +192,9 @@ do_debug() { # don't trap on Ctrl+C, because GDB keeps running trap '' INT # start OpenOCD as GDB server - ${SETSID} sh -c "${OPENOCD} -f '${OPENOCD_CONFIG}' \ + ${SETSID} sh -c "${OPENOCD} \ + ${OPENOCD_ADAPTER_INIT} \ + -f '${OPENOCD_CONFIG}' \ ${OPENOCD_EXTRA_INIT} \ -c 'tcl_port ${TCL_PORT}' \ -c 'telnet_port ${TELNET_PORT}' \ @@ -211,7 +219,9 @@ do_debug() { do_debugserver() { test_config # start OpenOCD as GDB server - sh -c "${OPENOCD} -f '${OPENOCD_CONFIG}' \ + sh -c "${OPENOCD} \ + ${OPENOCD_ADAPTER_INIT} \ + -f '${OPENOCD_CONFIG}' \ ${OPENOCD_EXTRA_INIT} \ -c 'tcl_port ${TCL_PORT}' \ -c 'telnet_port ${TELNET_PORT}' \ @@ -224,7 +234,9 @@ do_debugserver() { do_reset() { test_config # start OpenOCD and invoke board reset - sh -c "${OPENOCD} -f '${OPENOCD_CONFIG}' \ + sh -c "${OPENOCD} \ + ${OPENOCD_ADAPTER_INIT} \ + -f '${OPENOCD_CONFIG}' \ ${OPENOCD_EXTRA_INIT} \ -c 'tcl_port 0' \ -c 'telnet_port 0' \ diff --git a/makefiles/tools/openocd-adapters/README.md b/makefiles/tools/openocd-adapters/README.md new file mode 100644 index 000000000000..b9d2bdd08c1d --- /dev/null +++ b/makefiles/tools/openocd-adapters/README.md @@ -0,0 +1,2 @@ +This directory contains definitions of debugger hardware interfaces to be used +by the OpenOCD integration. diff --git a/makefiles/tools/openocd-adapters/dap.inc.mk b/makefiles/tools/openocd-adapters/dap.inc.mk new file mode 100644 index 000000000000..c93fc61a9fc7 --- /dev/null +++ b/makefiles/tools/openocd-adapters/dap.inc.mk @@ -0,0 +1,7 @@ +# CMSIS DAP debug adapter +OPENOCD_ADAPTER_INIT ?= -c 'source [find interface/cmsis-dap.cfg]' +# 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)' +endif +export OPENOCD_ADAPTER_INIT diff --git a/makefiles/tools/openocd-adapters/jlink.inc.mk b/makefiles/tools/openocd-adapters/jlink.inc.mk new file mode 100644 index 000000000000..c57e0119d7b7 --- /dev/null +++ b/makefiles/tools/openocd-adapters/jlink.inc.mk @@ -0,0 +1,7 @@ +# Segger J-Link debug adapter +OPENOCD_ADAPTER_INIT ?= -c 'source [find interface/jlink.cfg]' +# Add serial matching command, only if DEBUG_ADAPTER_ID was specified +ifneq (,$(DEBUG_ADAPTER_ID)) + OPENOCD_ADAPTER_INIT += -c 'jlink serial $(DEBUG_ADAPTER_ID)' +endif +export OPENOCD_ADAPTER_INIT diff --git a/makefiles/tools/openocd-adapters/mulle.inc.mk b/makefiles/tools/openocd-adapters/mulle.inc.mk new file mode 100644 index 000000000000..3004e09b348b --- /dev/null +++ b/makefiles/tools/openocd-adapters/mulle.inc.mk @@ -0,0 +1,33 @@ +# OpenOCD settings for Mulle programmer board. +# Try to determine which OpenOCD config file we should use based on the +# programmer board serial number. + +# Fall back to PROGRAMMER_SERIAL for backwards compatibility +export DEBUG_ADAPTER_ID ?= $(PROGRAMMER_SERIAL) + +ifneq (,$(DEBUG_ADAPTER_ID)) + # Makefile-way of comparing numbers, using lexicographical sorting since we + # don't have any arithmetic comparisons. + # Programmers with serial 100 -- 148 are version 0.60 + # Programmers with serial 301 -- 330 are version 0.70 + ifeq "100" "$(word 1, $(sort 100 $(DEBUG_ADAPTER_ID)))" + # >= 100 + ifneq "149" "$(word 1, $(sort 149 $(DEBUG_ADAPTER_ID)))" + # < 149 + PROGRAMMER_VERSION = 0.60 + else + # >= 149 + PROGRAMMER_VERSION = 0.70 + endif + endif +endif +# Default to version 0.70 programmer +PROGRAMMER_VERSION ?= 0.70 + +OPENOCD_ADAPTER_INIT ?= -f '$(RIOTBASE)/boards/mulle/dist/openocd/mulle-programmer-$(PROGRAMMER_VERSION).cfg' + +# Add serial matching command, only if DEBUG_ADAPTER_ID was specified +ifneq (,$(DEBUG_ADAPTER_ID)) + OPENOCD_ADAPTER_INIT += -c 'ftdi_serial $(DEBUG_ADAPTER_ID)' +endif +export OPENOCD_ADAPTER_INIT diff --git a/makefiles/tools/openocd-adapters/stlink.inc.mk b/makefiles/tools/openocd-adapters/stlink.inc.mk new file mode 100644 index 000000000000..b9ef8d1ee004 --- /dev/null +++ b/makefiles/tools/openocd-adapters/stlink.inc.mk @@ -0,0 +1,10 @@ +# ST-Link debug adapter +# 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' +# 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 +export OPENOCD_ADAPTER_INIT diff --git a/makefiles/tools/openocd.inc.mk b/makefiles/tools/openocd.inc.mk index f2b694115f27..3208716d2bb7 100644 --- a/makefiles/tools/openocd.inc.mk +++ b/makefiles/tools/openocd.inc.mk @@ -8,3 +8,7 @@ export FFLAGS ?= flash export DEBUGGER_FLAGS ?= debug export DEBUGSERVER_FLAGS ?= debug-server export RESET_FLAGS ?= reset + +ifneq (,$(DEBUG_ADAPTER)) + include $(RIOTMAKE)/tools/openocd-adapters/$(DEBUG_ADAPTER).inc.mk +endif From 697f0b00f3bde77290a7b76536479aa5a68324a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Nohlg=C3=A5rd?= Date: Sun, 8 Oct 2017 07:58:02 +0200 Subject: [PATCH 2/3] edbg: Use DEBUG_ADAPTER_ID to select which USB programmer to use --- makefiles/boards/sam0.inc.mk | 37 ++++++++++++++++++++++-------------- makefiles/tools/edbg.inc.mk | 8 ++++++++ 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/makefiles/boards/sam0.inc.mk b/makefiles/boards/sam0.inc.mk index 75cf7dc1059a..d8fb7dea1bcd 100644 --- a/makefiles/boards/sam0.inc.mk +++ b/makefiles/boards/sam0.inc.mk @@ -1,25 +1,34 @@ # set default port depending on operating system PORT_LINUX ?= /dev/ttyACM0 PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) +# Use DEBUG_ADAPTER_ID to specify the programmer serial number to use: +# export DEBUG_ADAPTER_ID="ATML..." + +# The SERIAL setting is only available for backwards compatibility with older +# settings. +ifneq (,$(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)) + endif + PORT_LINUX := $(SERIAL_TTY) + export DEBUG_ADAPTER_ID ?= $(SERIAL) +endif # setup serial terminal include $(RIOTMAKE)/tools/serial.inc.mk -# Add board selector (USB serial) to OpenOCD options if specified. -# Use /dist/tools/usb-serial/list-ttys.sh to find out serial number. -# Usage: SERIAL="ATML..." 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)) - endif - PORT_LINUX := $(SERIAL_TTY) -endif +# Default for these boards is to use a CMSIS-DAP programmer +export DEBUG_ADAPTER ?= dap -# set this to either openocd or edbg -PROGRAMMER ?= edbg +# EDBG can only be used with a compatible Atmel programmer +ifeq ($(DEBUG_ADAPTER),dap) + # set this to either openocd or edbg + PROGRAMMER ?= edbg +else + PROGRAMMER ?= openocd +endif # use edbg if selected and a device type has been set ifeq ($(PROGRAMMER),edbg) diff --git a/makefiles/tools/edbg.inc.mk b/makefiles/tools/edbg.inc.mk index 353be21a90a0..91c4f27ce727 100644 --- a/makefiles/tools/edbg.inc.mk +++ b/makefiles/tools/edbg.inc.mk @@ -3,6 +3,14 @@ EDBG ?= $(RIOT_EDBG) FLASHER ?= $(EDBG) OFLAGS ?= -O binary HEXFILE = $(ELFFILE:.elf=.bin) +# Use USB serial number to select device when more than one is connected +# Use /dist/tools/usb-serial/list-ttys.sh to find out serial number. +# Usage: +# export DEBUG_ADAPTER_ID="ATML..." +# BOARD= make flash +ifneq (,$(DEBUG_ADAPTER_ID)) + EDBG_ARGS += --serial $(DEBUG_ADAPTER_ID) +endif FFLAGS ?= $(EDBG_ARGS) -t $(EDBG_DEVICE_TYPE) -b -e -v -p -f $(HEXFILE) ifeq ($(RIOT_EDBG),$(FLASHER)) From f4e9cad85a29382fbbf3c75b5403aa73002a99ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Nohlg=C3=A5rd?= Date: Fri, 6 Oct 2017 14:59:07 +0200 Subject: [PATCH 3/3] boards: Separate boards from debug adapter configuration --- boards/airfy-beacon/Makefile.include | 3 + boards/airfy-beacon/dist/openocd.cfg | 3 - boards/arduino-zero/dist/openocd.cfg | 6 -- boards/b-l072z-lrwan1/Makefile.include | 3 + boards/b-l072z-lrwan1/dist/openocd.cfg | 4 -- boards/bluepill/Makefile.include | 3 + boards/bluepill/dist/openocd.cfg | 3 - boards/frdm-common/Makefile.include | 8 +-- .../frdm-common/dist/old-openocd-jlink-kx.cfg | 48 -------------- ...-openocd-dap-kx.cfg => old-openocd-kx.cfg} | 4 +- boards/frdm-common/dist/openocd-jlink-kx.cfg | 22 ------- .../{openocd-dap-kx.cfg => openocd-kx.cfg} | 1 - boards/limifrog-v1/Makefile.include | 3 + boards/limifrog-v1/dist/openocd.cfg | 3 - boards/maple-mini/Makefile.include | 3 + boards/maple-mini/dist/openocd.cfg | 4 -- boards/msbiot/Makefile.include | 3 + boards/msbiot/dist/openocd.cfg | 7 +- boards/mulle/Makefile.include | 49 +++----------- boards/mulle/dist/openocd.cfg | 12 ++++ .../dist/openocd/mulle-programmer-0.60.cfg | 28 ++++++++ .../dist/openocd/mulle-programmer-0.60.conf | 65 ------------------- .../dist/openocd/mulle-programmer-0.70.cfg | 27 ++++++++ .../dist/openocd/mulle-programmer-0.70.conf | 63 ------------------ boards/nucleo-common/Makefile.include.serial | 27 ++++++++ boards/nucleo-common/dist/openocd-f0.cfg | 3 + boards/nucleo-common/dist/openocd-f1.cfg | 3 + boards/nucleo-common/dist/openocd-f2.cfg | 3 + boards/nucleo-common/dist/openocd-f3.cfg | 3 + boards/nucleo-common/dist/openocd-f4.cfg | 3 + boards/nucleo-common/dist/openocd-f7.cfg | 3 + boards/nucleo-common/dist/openocd-l0.cfg | 3 + boards/nucleo-common/dist/openocd-l1.cfg | 3 + boards/nucleo-common/dist/openocd-l4.cfg | 3 + boards/nucleo-f030/dist/openocd.cfg | 1 - boards/nucleo-f070/dist/openocd.cfg | 1 - boards/nucleo-f072/dist/openocd.cfg | 2 - boards/nucleo-f091/dist/openocd.cfg | 2 - boards/nucleo-f103/dist/openocd.cfg | 3 - boards/nucleo-f302/dist/openocd.cfg | 1 - boards/nucleo-f303/dist/openocd.cfg | 2 - boards/nucleo-f334/dist/openocd.cfg | 2 - boards/nucleo-f401/dist/openocd.cfg | 2 - boards/nucleo-f410/dist/openocd.cfg | 1 - boards/nucleo-f411/dist/openocd.cfg | 1 - boards/nucleo-f446/dist/openocd.cfg | 1 - boards/nucleo-l053/dist/openocd.cfg | 7 -- boards/nucleo-l073/dist/openocd.cfg | 7 -- boards/nucleo-l152/dist/openocd.cfg | 2 - boards/nucleo-l476/dist/openocd.cfg | 5 -- boards/nucleo144-f207/dist/openocd.cfg | 7 -- boards/nucleo144-f303/dist/openocd.cfg | 1 - boards/nucleo144-f412/dist/openocd.cfg | 1 - boards/nucleo144-f413/dist/openocd.cfg | 1 - boards/nucleo144-f429/dist/openocd.cfg | 1 - boards/nucleo144-f446/dist/openocd.cfg | 1 - boards/nucleo144-f722/dist/openocd.cfg | 5 -- boards/nucleo144-f746/dist/openocd.cfg | 5 -- boards/nucleo144-f767/dist/openocd.cfg | 5 -- boards/nucleo32-f031/dist/openocd.cfg | 1 - boards/nucleo32-f042/dist/openocd.cfg | 1 - boards/nucleo32-f303/dist/openocd.cfg | 1 - boards/nucleo32-l031/dist/openocd.cfg | 7 -- boards/nucleo32-l432/dist/openocd.cfg | 7 -- boards/pba-d-01-kw2x/Makefile.include | 2 + boards/pba-d-01-kw2x/dist/openocd.cfg | 1 - boards/samd21-xpro/dist/openocd.cfg | 2 +- boards/saml21-xpro/dist/openocd.cfg | 2 +- boards/samr21-xpro/dist/openocd.cfg | 2 +- boards/seeeduino_arch-pro/Makefile.include | 2 + boards/seeeduino_arch-pro/dist/openocd.cfg | 1 - boards/sodaq-autonomo/dist/openocd.cfg | 37 ----------- boards/stm32f0discovery/Makefile.include | 3 + boards/stm32f0discovery/dist/openocd.cfg | 6 +- boards/stm32f3discovery/Makefile.include | 3 + boards/stm32f3discovery/dist/openocd.cfg | 5 +- boards/stm32f4discovery/Makefile.include | 3 + boards/stm32f4discovery/dist/openocd.cfg | 8 ++- boards/stm32f7discovery/Makefile.include | 3 + boards/stm32f7discovery/dist/openocd.cfg | 4 -- boards/yunjia-nrf51822/Makefile.include | 3 + boards/yunjia-nrf51822/dist/openocd.cfg | 3 - 82 files changed, 197 insertions(+), 406 deletions(-) delete mode 100644 boards/frdm-common/dist/old-openocd-jlink-kx.cfg rename boards/frdm-common/dist/{old-openocd-dap-kx.cfg => old-openocd-kx.cfg} (92%) delete mode 100644 boards/frdm-common/dist/openocd-jlink-kx.cfg rename boards/frdm-common/dist/{openocd-dap-kx.cfg => openocd-kx.cfg} (94%) create mode 100644 boards/mulle/dist/openocd.cfg create mode 100644 boards/mulle/dist/openocd/mulle-programmer-0.60.cfg delete mode 100644 boards/mulle/dist/openocd/mulle-programmer-0.60.conf create mode 100644 boards/mulle/dist/openocd/mulle-programmer-0.70.cfg delete mode 100644 boards/mulle/dist/openocd/mulle-programmer-0.70.conf create mode 100644 boards/nucleo-common/dist/openocd-f0.cfg create mode 100644 boards/nucleo-common/dist/openocd-f1.cfg create mode 100644 boards/nucleo-common/dist/openocd-f2.cfg create mode 100644 boards/nucleo-common/dist/openocd-f3.cfg create mode 100644 boards/nucleo-common/dist/openocd-f4.cfg create mode 100644 boards/nucleo-common/dist/openocd-f7.cfg create mode 100644 boards/nucleo-common/dist/openocd-l0.cfg create mode 100644 boards/nucleo-common/dist/openocd-l1.cfg create mode 100644 boards/nucleo-common/dist/openocd-l4.cfg delete mode 100644 boards/nucleo-f030/dist/openocd.cfg delete mode 100644 boards/nucleo-f070/dist/openocd.cfg delete mode 100644 boards/nucleo-f072/dist/openocd.cfg delete mode 100644 boards/nucleo-f091/dist/openocd.cfg delete mode 100644 boards/nucleo-f103/dist/openocd.cfg delete mode 100644 boards/nucleo-f302/dist/openocd.cfg delete mode 100644 boards/nucleo-f303/dist/openocd.cfg delete mode 100644 boards/nucleo-f334/dist/openocd.cfg delete mode 100644 boards/nucleo-f401/dist/openocd.cfg delete mode 100644 boards/nucleo-f410/dist/openocd.cfg delete mode 100644 boards/nucleo-f411/dist/openocd.cfg delete mode 100644 boards/nucleo-f446/dist/openocd.cfg delete mode 100644 boards/nucleo-l053/dist/openocd.cfg delete mode 100644 boards/nucleo-l073/dist/openocd.cfg delete mode 100644 boards/nucleo-l152/dist/openocd.cfg delete mode 100644 boards/nucleo-l476/dist/openocd.cfg delete mode 100644 boards/nucleo144-f207/dist/openocd.cfg delete mode 100644 boards/nucleo144-f303/dist/openocd.cfg delete mode 100644 boards/nucleo144-f412/dist/openocd.cfg delete mode 100644 boards/nucleo144-f413/dist/openocd.cfg delete mode 100644 boards/nucleo144-f429/dist/openocd.cfg delete mode 100644 boards/nucleo144-f446/dist/openocd.cfg delete mode 100644 boards/nucleo144-f722/dist/openocd.cfg delete mode 100644 boards/nucleo144-f746/dist/openocd.cfg delete mode 100644 boards/nucleo144-f767/dist/openocd.cfg delete mode 100644 boards/nucleo32-f031/dist/openocd.cfg delete mode 100644 boards/nucleo32-f042/dist/openocd.cfg delete mode 100644 boards/nucleo32-f303/dist/openocd.cfg delete mode 100644 boards/nucleo32-l031/dist/openocd.cfg delete mode 100644 boards/nucleo32-l432/dist/openocd.cfg diff --git a/boards/airfy-beacon/Makefile.include b/boards/airfy-beacon/Makefile.include index 759cf37a4df5..e4c6cac363b1 100644 --- a/boards/airfy-beacon/Makefile.include +++ b/boards/airfy-beacon/Makefile.include @@ -9,5 +9,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) # setup serial terminal include $(RIOTMAKE)/tools/serial.inc.mk +export DEBUG_ADAPTER ?= stlink +export STLINK_VERSION ?= 2 + # this board uses openocd include $(RIOTMAKE)/tools/openocd.inc.mk diff --git a/boards/airfy-beacon/dist/openocd.cfg b/boards/airfy-beacon/dist/openocd.cfg index 6d346ee828da..d16a15a3ecc0 100644 --- a/boards/airfy-beacon/dist/openocd.cfg +++ b/boards/airfy-beacon/dist/openocd.cfg @@ -1,6 +1,3 @@ -source [find interface/stlink-v2.cfg] -transport select hla_swd - set WORKAREASIZE 0x4000 source [find target/nrf51.cfg] $_TARGETNAME configure -rtos auto diff --git a/boards/arduino-zero/dist/openocd.cfg b/boards/arduino-zero/dist/openocd.cfg index 89c41c3b5c55..b99bc995ceaf 100644 --- a/boards/arduino-zero/dist/openocd.cfg +++ b/boards/arduino-zero/dist/openocd.cfg @@ -1,7 +1 @@ -source [find interface/cmsis-dap.cfg] - -set CHIPNAME at91samd21g18 -set ENDIAN little -set telnet_port 0 - source [find target/at91samdXX.cfg] diff --git a/boards/b-l072z-lrwan1/Makefile.include b/boards/b-l072z-lrwan1/Makefile.include index e72fdd77c8d9..6ffa293ea022 100644 --- a/boards/b-l072z-lrwan1/Makefile.include +++ b/boards/b-l072z-lrwan1/Makefile.include @@ -9,5 +9,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) # setup serial terminal include $(RIOTMAKE)/tools/serial.inc.mk +export DEBUG_ADAPTER ?= stlink +export STLINK_VERSION ?= 2-1 + # this board uses openocd include $(RIOTMAKE)/tools/openocd.inc.mk diff --git a/boards/b-l072z-lrwan1/dist/openocd.cfg b/boards/b-l072z-lrwan1/dist/openocd.cfg index b4c77067577c..507daa5d38ea 100644 --- a/boards/b-l072z-lrwan1/dist/openocd.cfg +++ b/boards/b-l072z-lrwan1/dist/openocd.cfg @@ -1,7 +1,3 @@ -source [find interface/stlink-v2-1.cfg] - -transport select hla_swd - source [find target/stm32l0.cfg] reset_config srst_only diff --git a/boards/bluepill/Makefile.include b/boards/bluepill/Makefile.include index 394d1257accf..85c59e3a0393 100644 --- a/boards/bluepill/Makefile.include +++ b/boards/bluepill/Makefile.include @@ -26,5 +26,8 @@ ifeq ($(PROGRAMMER),dfu-util) export FFLAGS = -d 1d50:6017 -s 0x08002000:leave -D "$(HEXFILE)" else # this board uses openocd by default +export DEBUG_ADAPTER ?= stlink +export STLINK_VERSION ?= 2 + include $(RIOTMAKE)/tools/openocd.inc.mk endif diff --git a/boards/bluepill/dist/openocd.cfg b/boards/bluepill/dist/openocd.cfg index a93406dfb5fc..ad3f024bf131 100644 --- a/boards/bluepill/dist/openocd.cfg +++ b/boards/bluepill/dist/openocd.cfg @@ -1,6 +1,3 @@ -source [find interface/stlink-v2.cfg] -transport select hla_swd - source [find target/stm32f1x.cfg] reset_config none separate diff --git a/boards/frdm-common/Makefile.include b/boards/frdm-common/Makefile.include index b88ed26267fc..5b994901fe94 100644 --- a/boards/frdm-common/Makefile.include +++ b/boards/frdm-common/Makefile.include @@ -4,8 +4,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) # Use the shared OpenOCD configuration # Using dap or jlink depends on which firmware the OpenSDA debugger is running -export FRDM_IFACE ?= dap -#export FRDM_IFACE ?= jlink +export DEBUG_ADAPTER ?= dap +#export DEBUG_ADAPTER ?= jlink # OpenOCD v0.10.0 and newer have built-in support for disabling the Kinetis # watchdog automatically. However, current stable releases of Ubuntu and Debian @@ -29,11 +29,11 @@ flash: $(RIOTCPU)/$(CPU)/dist/wdog-disable.bin # Reset the default goal. .DEFAULT_GOAL := -export OPENOCD_CONFIG ?= $(RIOTBOARD)/frdm-common/dist/old-openocd-$(FRDM_IFACE)-$(CPU_FAMILY).cfg +export OPENOCD_CONFIG ?= $(RIOTBOARD)/frdm-common/dist/old-openocd-$(CPU_FAMILY).cfg endif # Configuration for OpenOCD v0.10.0 and newer -export OPENOCD_CONFIG ?= $(RIOTBOARD)/frdm-common/dist/openocd-$(FRDM_IFACE)-$(CPU_FAMILY).cfg +export OPENOCD_CONFIG ?= $(RIOTBOARD)/frdm-common/dist/openocd-$(CPU_FAMILY).cfg # Check the flash configuration field before flashing export PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/$(CPU)/dist/check-fcfield-elf.sh diff --git a/boards/frdm-common/dist/old-openocd-jlink-kx.cfg b/boards/frdm-common/dist/old-openocd-jlink-kx.cfg deleted file mode 100644 index 4e785eb3ac70..000000000000 --- a/boards/frdm-common/dist/old-openocd-jlink-kx.cfg +++ /dev/null @@ -1,48 +0,0 @@ -# -# Freescale Kinetis Kxx devices on a Segger J-Link adapter -# -source [find interface/jlink.cfg] - -source [find target/swj-dp.tcl] - -if { [info exists CHIPNAME] } { - set _CHIPNAME $CHIPNAME -} else { - set _CHIPNAME kx -} - -if { [info exists CPUTAPID] } { - set _CPUTAPID $CPUTAPID -} else { - set _CPUTAPID 0x2ba01477 -} - -set _TARGETNAME $_CHIPNAME.cpu - -swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_CPUTAPID - -target create $_TARGETNAME cortex_m -chain-position $_CHIPNAME.cpu - -$_CHIPNAME.cpu configure -event examine-start { puts "START..." ; } - -# It is important that "kinetis mdm check_security" is called for -# 'examine-end' event and not 'eximine-start'. Calling it in 'examine-start' -# causes "kinetis mdm check_security" to fail the first time openocd -# calls it when it tries to connect after the CPU has been power-cycled. -$_CHIPNAME.cpu configure -event examine-end { - kinetis mdm check_security -} - -$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 0x1000 -work-area-backup 0 - -flash bank $_CHIPNAME.flash kinetis 0 0 0 0 $_TARGETNAME - -cortex_m reset_config sysresetreq -#reset_config srst_only srst_nogate connect_assert_srst - -adapter_khz 1000 - -$_TARGETNAME configure -event gdb-attach { - halt -} -$_TARGETNAME configure -rtos auto diff --git a/boards/frdm-common/dist/old-openocd-dap-kx.cfg b/boards/frdm-common/dist/old-openocd-kx.cfg similarity index 92% rename from boards/frdm-common/dist/old-openocd-dap-kx.cfg rename to boards/frdm-common/dist/old-openocd-kx.cfg index 0e6e918aa7db..72ef31280416 100644 --- a/boards/frdm-common/dist/old-openocd-dap-kx.cfg +++ b/boards/frdm-common/dist/old-openocd-kx.cfg @@ -1,8 +1,6 @@ # -# Freescale Kinetis Kxx devices on a CMSIS-DAP adapter +# Freescale Kinetis Kxx devices when using old OpenOCD versions (<0.10.0) # -source [find interface/cmsis-dap.cfg] - source [find target/swj-dp.tcl] if { [info exists CHIPNAME] } { diff --git a/boards/frdm-common/dist/openocd-jlink-kx.cfg b/boards/frdm-common/dist/openocd-jlink-kx.cfg deleted file mode 100644 index 2580e6835f13..000000000000 --- a/boards/frdm-common/dist/openocd-jlink-kx.cfg +++ /dev/null @@ -1,22 +0,0 @@ -# -# NXP Kinetis Freedom developer board -# -# OpenSDA is the on-board debugger, some boards have a CMSIS-DAP compatible -# interface, other boards comes pre-flashed with a Segger J-Link compatible -# firmware. The OpenSDA controller can be re-flashed to provide either of the two. -# Both interfaces work with OpenOCD, but we need to tell which one we have on -# our debugger. - -# J-Link compatible firmware binaries for OpenSDA can be found at: -# https://www.segger.com/downloads/jlink#JLinkOpenSDABoardSpecificFirmwares -source [find interface/jlink.cfg] - -# Kinetis K series CPUs -source [find target/kx.cfg] - -reset_config srst_only - -$_TARGETNAME configure -event gdb-attach { - halt -} -$_TARGETNAME configure -rtos auto diff --git a/boards/frdm-common/dist/openocd-dap-kx.cfg b/boards/frdm-common/dist/openocd-kx.cfg similarity index 94% rename from boards/frdm-common/dist/openocd-dap-kx.cfg rename to boards/frdm-common/dist/openocd-kx.cfg index 942f1d11b947..021f22074e26 100644 --- a/boards/frdm-common/dist/openocd-dap-kx.cfg +++ b/boards/frdm-common/dist/openocd-kx.cfg @@ -9,7 +9,6 @@ # CMSIS-DAP (DAPLink) compatible OpenSDA firmware binary images can be found at: # http://www.nxp.com/opensda -source [find interface/cmsis-dap.cfg] # Kinetis K series CPUs source [find target/kx.cfg] diff --git a/boards/limifrog-v1/Makefile.include b/boards/limifrog-v1/Makefile.include index 1855b1f352cb..623dad11cc60 100644 --- a/boards/limifrog-v1/Makefile.include +++ b/boards/limifrog-v1/Makefile.include @@ -9,5 +9,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) # setup serial terminal include $(RIOTMAKE)/tools/serial.inc.mk +export DEBUG_ADAPTER ?= stlink +export STLINK_VERSION ?= 2 + # this board uses openocd include $(RIOTMAKE)/tools/openocd.inc.mk diff --git a/boards/limifrog-v1/dist/openocd.cfg b/boards/limifrog-v1/dist/openocd.cfg index 530d12f68982..404ad7fc2043 100644 --- a/boards/limifrog-v1/dist/openocd.cfg +++ b/boards/limifrog-v1/dist/openocd.cfg @@ -1,6 +1,3 @@ -source [find interface/stlink-v2.cfg] -transport select hla_swd - set WORKAREASIZE 0x2800 source [find target/stm32l1.cfg] $_TARGETNAME configure -rtos auto diff --git a/boards/maple-mini/Makefile.include b/boards/maple-mini/Makefile.include index ba4a3e1b7528..ce0aa455791a 100644 --- a/boards/maple-mini/Makefile.include +++ b/boards/maple-mini/Makefile.include @@ -9,5 +9,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) # setup serial terminal include $(RIOTMAKE)/tools/serial.inc.mk +export DEBUG_ADAPTER ?= stlink +export STLINK_VERSION ?= 2-1 + # this board uses openocd include $(RIOTMAKE)/tools/openocd.inc.mk diff --git a/boards/maple-mini/dist/openocd.cfg b/boards/maple-mini/dist/openocd.cfg index 0b1c4fdf9e75..43022477c485 100644 --- a/boards/maple-mini/dist/openocd.cfg +++ b/boards/maple-mini/dist/openocd.cfg @@ -1,7 +1,3 @@ -source [find interface/stlink-v2-1.cfg] - -transport select hla_swd - source [find target/stm32f1x.cfg] reset_config srst_only diff --git a/boards/msbiot/Makefile.include b/boards/msbiot/Makefile.include index d87c020ab074..d92fcb56e61e 100644 --- a/boards/msbiot/Makefile.include +++ b/boards/msbiot/Makefile.include @@ -9,5 +9,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) # setup serial terminal include $(RIOTMAKE)/tools/serial.inc.mk +export DEBUG_ADAPTER ?= stlink +export STLINK_VERSION ?= 2 + # this board uses openocd include $(RIOTMAKE)/tools/openocd.inc.mk diff --git a/boards/msbiot/dist/openocd.cfg b/boards/msbiot/dist/openocd.cfg index a2f4a9204699..6c808696167f 100644 --- a/boards/msbiot/dist/openocd.cfg +++ b/boards/msbiot/dist/openocd.cfg @@ -1,2 +1,7 @@ -source [find board/stm32f4discovery.cfg] +# increase working area to 64KB +set WORKAREASIZE 0x10000 + +source [find target/stm32f4x.cfg] + +reset_config srst_only $_TARGETNAME configure -rtos auto diff --git a/boards/mulle/Makefile.include b/boards/mulle/Makefile.include index 620be56ca0fc..ed3d0b144d0f 100644 --- a/boards/mulle/Makefile.include +++ b/boards/mulle/Makefile.include @@ -1,9 +1,6 @@ # define the cpu used by the Mulle board export CPU = kinetis -# Default GDB port -export GDBPORT ?= 3333 - # MULLE_SERIAL is used to select which specific Mulle board we are compiling for. ifdef MULLE_SERIAL CFLAGS += -DMULLE_SERIAL=$(MULLE_SERIAL) @@ -22,53 +19,26 @@ endif export CPU_MODEL -# OpenOCD settings for Mulle board. -# Try to determine which version of the OpenOCD config file we should use. -# Specify PROGRAMMER_VERSION or PROGRAMMER_SERIAL to choose a specific programmer board. -ifeq ($(PROGRAMMER_VERSION),) - ifneq ($(PROGRAMMER_SERIAL),) - # Makefile-way of comparing numbers, using lexicographical sorting since we don't have any arithmetic comparisons. - # Programmers with serial 100 -- 148 are version 0.60 - # Programmers with serial 301 -- 330 are version 0.70 - ifeq "100" "$(word 1, $(sort 100 $(PROGRAMMER_SERIAL)))" - # >= 100 - ifneq "149" "$(word 1, $(sort 149 $(PROGRAMMER_SERIAL)))" - # < 149 - PROGRAMMER_VERSION = 0.60 - else - # >= 149 - PROGRAMMER_VERSION = 0.70 - endif - endif - endif - # Default to version 0.70 programmer - PROGRAMMER_VERSION ?= 0.70 -endif - -export OPENOCD_CONFIG = $(RIOTBOARD)/$(BOARD)/dist/openocd/mulle-programmer-$(PROGRAMMER_VERSION).conf - -# Add serial matching command -ifneq ($(PROGRAMMER_SERIAL),) - OPENOCD_EXTRA_INIT += -c 'ftdi_serial $(PROGRAMMER_SERIAL)' -endif - -OPENOCD_EXTRA_INIT += $(CPU_OOCD_FLAGS) - +# Default debug adapter choice is to use the Mulle programmer board +export DEBUG_ADAPTER ?= mulle # Host OS name OS := $(shell uname) +# Fall back to PROGRAMMER_SERIAL for backwards compatibility +export DEBUG_ADAPTER_ID ?= $(PROGRAMMER_SERIAL) + ifeq ($(PORT),) # try to find tty name by serial number, only works on Linux currently. ifeq ($(OS),Linux) - ifneq ($(PROGRAMMER_SERIAL),) - PORT := $(firstword $(shell $(RIOTBASE)/dist/tools/usb-serial/find-tty.sh '^$(PROGRAMMER_SERIAL)$$')) + ifneq ($(DEBUG_ADAPTER_ID),) + PORT := $(firstword $(shell $(RIOTBASE)/dist/tools/usb-serial/find-tty.sh '^$(DEBUG_ADAPTER_ID)$$')) else # find-tty.sh will return the first USB tty if no serial is given. PORT := $(firstword $(shell $(RIOTBASE)/dist/tools/usb-serial/find-tty.sh)) endif else ifeq ($(OS),Darwin) - ifneq ($(PROGRAMMER_SERIAL),) - PORT := /dev/tty.usbserial-$(PROGRAMMER_SERIAL)B + ifneq ($(DEBUG_ADAPTER_ID),) + PORT := /dev/tty.usbserial-$(DEBUG_ADAPTER_ID)B else PORT := $(firstword $(sort $(wildcard /dev/tty.usbserial*))) endif @@ -86,7 +56,6 @@ endif export OPENOCD_PRE_VERIFY_CMDS += \ -c 'load_image $(RIOTCPU)/$(CPU)/dist/wdog-disable.bin 0x20000000 bin' \ -c 'resume 0x20000000' -export OPENOCD_EXTRA_INIT export PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/$(CPU)/dist/check-fcfield-elf.sh .PHONY: flash diff --git a/boards/mulle/dist/openocd.cfg b/boards/mulle/dist/openocd.cfg new file mode 100644 index 000000000000..6beedf6ae62a --- /dev/null +++ b/boards/mulle/dist/openocd.cfg @@ -0,0 +1,12 @@ +# Copyright 2017 Eistec AB +# +# OpenOCD configuration for Eistec Mulle board with Kinetis K MCU +# + +source [find target/kx.cfg] + +# The nTRST functionality can only be used if the MCU has been configured by +# setting the correct pin multiplexing function on the TRST pin (PTA5 on Kinetis K60). +# If you have configured the TRST pin correctly you can change srst_only to +# trst_and_srst +reset_config srst_only diff --git a/boards/mulle/dist/openocd/mulle-programmer-0.60.cfg b/boards/mulle/dist/openocd/mulle-programmer-0.60.cfg new file mode 100644 index 000000000000..172bb8c5f25a --- /dev/null +++ b/boards/mulle/dist/openocd/mulle-programmer-0.60.cfg @@ -0,0 +1,28 @@ +# +# Mulle programmer board v0.60 +# +# The Mulle programming board uses a FTDI FT2232H chip for USB UART and JTAG +# combined functionality. +# + +# Reduce this if you are having problems with losing connection to the Mulle +adapter_khz 1000 + +# JTAG interface configuration + +interface ftdi +ftdi_device_desc "Mulle Programmer v0.60" +ftdi_vid_pid 0x0403 0x6010 + +ftdi_channel 1 +ftdi_layout_init 0x0008 0x005b + +# These are the pins that are used for SRST and TRST. Note that the Mulle +# programming board inverts the reset signal between the FTDI chip and the MCU, +# so we need to use -ndata here to tell OpenOCD that the signals are active HIGH. +ftdi_layout_signal nTRST -ndata 0x0010 +ftdi_layout_signal nSRST -ndata 0x0040 + +# In the eyes of OpenOCD, the reset signal is push-pull, because of the hardware +# design however, it is actually open drain. +reset_config srst_push_pull diff --git a/boards/mulle/dist/openocd/mulle-programmer-0.60.conf b/boards/mulle/dist/openocd/mulle-programmer-0.60.conf deleted file mode 100644 index 2393b73abf93..000000000000 --- a/boards/mulle/dist/openocd/mulle-programmer-0.60.conf +++ /dev/null @@ -1,65 +0,0 @@ -# -# Mulle programming board. -# -# The Mulle programming board uses a FTDI FT2232H chip for USB UART and JTAG -# combined functionality. -# - -# Reduce this if you are having problems with losing connection to the Mulle -adapter_khz 1000 - -# JTAG interface configuration - -interface ftdi -ftdi_device_desc "Mulle Programmer v0.60" -ftdi_vid_pid 0x0403 0x6010 - -ftdi_channel 1 -ftdi_layout_init 0x0008 0x005b - -# These are the pins that are used for SRST and TRST. Note that the Mulle -# programming board inverts the reset signal between the FTDI chip and the MCU, -# so we need to use -ndata here to tell OpenOCD that the signals are active HIGH. -ftdi_layout_signal nTRST -ndata 0x0010 -ftdi_layout_signal nSRST -ndata 0x0040 - -# In the eyes of OpenOCD, the reset signal is push-pull, because of the hardware -# design however, it is actually open drain. -# The trst pin can only be used if the MCU has been configured by setting the -# correct pin multiplexing function on the TRST pin (PTA5). -# If you have configured the TRST pin correctly you can change srst_only to -# trst_and_srst -reset_config srst_only srst_push_pull srst_gates_jtag - -# MCU -gdb_memory_map enable -gdb_flash_program enable - -source [find target/k60.cfg] - -# -# Bank definition for the 'program flash' (instructions and/or data) -# OpenOCD 0.9.0 has a definition of the first flash bank in target/kx.cfg, but -# not OpenOCD 0.8.0 and earlier. -# -catch {flash bank $_CHIPNAME.flash kinetis 0 0 0 0 $_TARGETNAME} -catch {flash bank $_CHIPNAME.flash2 kinetis 0 0 0 0 $_TARGETNAME} - -# Work-area is a space in RAM used for flash programming -# By default use 4 kB -if { [info exists WORKAREASIZE] } { - set _WORKAREASIZE $WORKAREASIZE -} else { - set _WORKAREASIZE 0x1000 -} - -$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0 - -# The following section makes new gdb connections cause the MCU to do a system -# reset, in order to be in a known state. -# Comment this out in order to be able to debug an already started program. -$_TARGETNAME configure -event gdb-attach { - echo "Resetting because of gdb-attach event..." - # To make flash probe and gdb load to flash work we need a reset init. - reset init -} diff --git a/boards/mulle/dist/openocd/mulle-programmer-0.70.cfg b/boards/mulle/dist/openocd/mulle-programmer-0.70.cfg new file mode 100644 index 000000000000..f0c2b2c6b72e --- /dev/null +++ b/boards/mulle/dist/openocd/mulle-programmer-0.70.cfg @@ -0,0 +1,27 @@ +# +# Mulle programmer board v0.70 +# +# The Mulle programming board uses a FTDI FT2232H chip for USB UART and JTAG +# combined functionality. +# + +# Reduce this if you are having problems with losing connection to the Mulle +adapter_khz 1000 + +# JTAG interface configuration + +interface ftdi +ftdi_device_desc "Mulle Programmer v0.70" +ftdi_vid_pid 0x0403 0x6010 + +ftdi_channel 1 +ftdi_layout_init 0x0008 0x005b + +# These are the pins that are used for SRST and TRST. Active low on programmer +# boards v0.70 and up (used to be active high on v0.60) +ftdi_layout_signal nTRST -data 0x0010 +ftdi_layout_signal nSRST -data 0x0040 + +# In the eyes of OpenOCD, the reset signal is push-pull, because of the hardware +# design however, it is actually open drain. +reset_config srst_push_pull diff --git a/boards/mulle/dist/openocd/mulle-programmer-0.70.conf b/boards/mulle/dist/openocd/mulle-programmer-0.70.conf deleted file mode 100644 index bd4805ee7b71..000000000000 --- a/boards/mulle/dist/openocd/mulle-programmer-0.70.conf +++ /dev/null @@ -1,63 +0,0 @@ -# -# Mulle programming board. -# -# The Mulle programming board uses a FTDI FT2232H chip for USB UART and JTAG -# combined functionality. -# - -# Reduce this if you are having problems with losing connection to the Mulle -adapter_khz 1000 - -# JTAG interface configuration - -interface ftdi -ftdi_device_desc "Mulle Programmer v0.70" -ftdi_vid_pid 0x0403 0x6010 - -ftdi_channel 1 -ftdi_layout_init 0x0008 0x005b - -# These are the pins that are used for SRST and TRST. Active LOW on programmer -# boards v0.70 and up (used to be active HIGH) -ftdi_layout_signal nTRST -data 0x0010 -ftdi_layout_signal nSRST -data 0x0040 - -# In the eyes of OpenOCD, the reset signal is push-pull, because of the hardware -# design however, it is actually open drain. -# The trst pin can only be used if the MCU has been configured by setting the -# correct pin multiplexing function on the TRST pin (PTA5). -# If you have configured the TRST pin correctly you can change srst_only to -# trst_and_srst -reset_config srst_only srst_push_pull srst_gates_jtag - -# MCU -gdb_memory_map enable -gdb_flash_program enable - -source [find target/k60.cfg] - -# -# Bank definition for the 'program flash' (instructions and/or data) -# OpenOCD 0.9.0 has a definition of the first flash bank in target/kx.cfg, but -# not OpenOCD 0.8.0 and earlier. -# -catch {flash bank $_CHIPNAME.flash kinetis 0 0 0 0 $_TARGETNAME} - -# Work-area is a space in RAM used for flash programming -# By default use 4 kB -if { [info exists WORKAREASIZE] } { - set _WORKAREASIZE $WORKAREASIZE -} else { - set _WORKAREASIZE 0x1000 -} - -$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0 - -# The following section makes new gdb connections cause the MCU to do a system -# reset, in order to be in a known state. -# Comment this out in order to be able to debug an already started program. -$_TARGETNAME configure -event gdb-attach { - echo "Resetting because of gdb-attach event..." - # To make flash probe and gdb load to flash work we need a reset init. - reset init -} diff --git a/boards/nucleo-common/Makefile.include.serial b/boards/nucleo-common/Makefile.include.serial index 1c5e4d00d0ba..20bc2220d4e8 100644 --- a/boards/nucleo-common/Makefile.include.serial +++ b/boards/nucleo-common/Makefile.include.serial @@ -5,5 +5,32 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) # setup serial terminal include $(RIOTMAKE)/tools/serial.inc.mk +# All Nucleo boards have an on-board ST-link v2-1 adapter +export DEBUG_ADAPTER ?= stlink +export STLINK_VERSION ?= 2-1 + +# Choose OpenOCD board configuration depending on CPU type +ifeq (,$(OPENOCD_CONFIG)) + ifeq ($(CPU),stm32f0) + export OPENOCD_CONFIG := $(RIOTBOARD)/nucleo-common/dist/openocd-f0.cfg + else ifeq ($(CPU),stm32f1) + export OPENOCD_CONFIG := $(RIOTBOARD)/nucleo-common/dist/openocd-f1.cfg + else ifeq ($(CPU),stm32f2) + export OPENOCD_CONFIG := $(RIOTBOARD)/nucleo-common/dist/openocd-f2.cfg + else ifeq ($(CPU),stm32f3) + export OPENOCD_CONFIG := $(RIOTBOARD)/nucleo-common/dist/openocd-f3.cfg + else ifeq ($(CPU),stm32f4) + export OPENOCD_CONFIG := $(RIOTBOARD)/nucleo-common/dist/openocd-f4.cfg + else ifeq ($(CPU),stm32f7) + export OPENOCD_CONFIG := $(RIOTBOARD)/nucleo-common/dist/openocd-f7.cfg + else ifeq ($(CPU),stm32l0) + export OPENOCD_CONFIG := $(RIOTBOARD)/nucleo-common/dist/openocd-l0.cfg + else ifeq ($(CPU),stm32l1) + export OPENOCD_CONFIG := $(RIOTBOARD)/nucleo-common/dist/openocd-l1.cfg + else ifeq ($(CPU),stm32l4) + export OPENOCD_CONFIG := $(RIOTBOARD)/nucleo-common/dist/openocd-l4.cfg + endif +endif + # this board uses openocd include $(RIOTMAKE)/tools/openocd.inc.mk diff --git a/boards/nucleo-common/dist/openocd-f0.cfg b/boards/nucleo-common/dist/openocd-f0.cfg new file mode 100644 index 000000000000..2e2e8789c039 --- /dev/null +++ b/boards/nucleo-common/dist/openocd-f0.cfg @@ -0,0 +1,3 @@ +source [find target/stm32f0x.cfg] +reset_config srst_only +$_TARGETNAME configure -rtos auto diff --git a/boards/nucleo-common/dist/openocd-f1.cfg b/boards/nucleo-common/dist/openocd-f1.cfg new file mode 100644 index 000000000000..5dfac4c711f9 --- /dev/null +++ b/boards/nucleo-common/dist/openocd-f1.cfg @@ -0,0 +1,3 @@ +source [find target/stm32f1x.cfg] +reset_config srst_only +$_TARGETNAME configure -rtos auto diff --git a/boards/nucleo-common/dist/openocd-f2.cfg b/boards/nucleo-common/dist/openocd-f2.cfg new file mode 100644 index 000000000000..55eef9085162 --- /dev/null +++ b/boards/nucleo-common/dist/openocd-f2.cfg @@ -0,0 +1,3 @@ +source [find target/stm32f2x.cfg] +reset_config srst_only +$_TARGETNAME configure -rtos auto diff --git a/boards/nucleo-common/dist/openocd-f3.cfg b/boards/nucleo-common/dist/openocd-f3.cfg new file mode 100644 index 000000000000..a497ce7b9f3f --- /dev/null +++ b/boards/nucleo-common/dist/openocd-f3.cfg @@ -0,0 +1,3 @@ +source [find target/stm32f3x.cfg] +reset_config srst_only +$_TARGETNAME configure -rtos auto diff --git a/boards/nucleo-common/dist/openocd-f4.cfg b/boards/nucleo-common/dist/openocd-f4.cfg new file mode 100644 index 000000000000..8313d98b3eab --- /dev/null +++ b/boards/nucleo-common/dist/openocd-f4.cfg @@ -0,0 +1,3 @@ +source [find target/stm32f4x.cfg] +reset_config srst_only +$_TARGETNAME configure -rtos auto diff --git a/boards/nucleo-common/dist/openocd-f7.cfg b/boards/nucleo-common/dist/openocd-f7.cfg new file mode 100644 index 000000000000..2a1ac13f4591 --- /dev/null +++ b/boards/nucleo-common/dist/openocd-f7.cfg @@ -0,0 +1,3 @@ +source [find target/stm32f7x.cfg] +reset_config srst_only +$_TARGETNAME configure -rtos auto diff --git a/boards/nucleo-common/dist/openocd-l0.cfg b/boards/nucleo-common/dist/openocd-l0.cfg new file mode 100644 index 000000000000..13fea1b4a9b6 --- /dev/null +++ b/boards/nucleo-common/dist/openocd-l0.cfg @@ -0,0 +1,3 @@ +source [find target/stm32l0.cfg] +reset_config srst_only +$_TARGETNAME configure -rtos auto diff --git a/boards/nucleo-common/dist/openocd-l1.cfg b/boards/nucleo-common/dist/openocd-l1.cfg new file mode 100644 index 000000000000..aecf84620644 --- /dev/null +++ b/boards/nucleo-common/dist/openocd-l1.cfg @@ -0,0 +1,3 @@ +source [find target/stm32l1.cfg] +reset_config srst_only +$_TARGETNAME configure -rtos auto diff --git a/boards/nucleo-common/dist/openocd-l4.cfg b/boards/nucleo-common/dist/openocd-l4.cfg new file mode 100644 index 000000000000..5d8b973e0178 --- /dev/null +++ b/boards/nucleo-common/dist/openocd-l4.cfg @@ -0,0 +1,3 @@ +source [find target/stm32l4x.cfg] +reset_config srst_only +$_TARGETNAME configure -rtos auto diff --git a/boards/nucleo-f030/dist/openocd.cfg b/boards/nucleo-f030/dist/openocd.cfg deleted file mode 100644 index 4f0cfb3a023b..000000000000 --- a/boards/nucleo-f030/dist/openocd.cfg +++ /dev/null @@ -1 +0,0 @@ -source [find board/st_nucleo_f0.cfg] diff --git a/boards/nucleo-f070/dist/openocd.cfg b/boards/nucleo-f070/dist/openocd.cfg deleted file mode 100644 index 4f0cfb3a023b..000000000000 --- a/boards/nucleo-f070/dist/openocd.cfg +++ /dev/null @@ -1 +0,0 @@ -source [find board/st_nucleo_f0.cfg] diff --git a/boards/nucleo-f072/dist/openocd.cfg b/boards/nucleo-f072/dist/openocd.cfg deleted file mode 100644 index ba0fc41dfb0d..000000000000 --- a/boards/nucleo-f072/dist/openocd.cfg +++ /dev/null @@ -1,2 +0,0 @@ -source [find board/st_nucleo_f0.cfg] -$_TARGETNAME configure -rtos auto diff --git a/boards/nucleo-f091/dist/openocd.cfg b/boards/nucleo-f091/dist/openocd.cfg deleted file mode 100644 index ba0fc41dfb0d..000000000000 --- a/boards/nucleo-f091/dist/openocd.cfg +++ /dev/null @@ -1,2 +0,0 @@ -source [find board/st_nucleo_f0.cfg] -$_TARGETNAME configure -rtos auto diff --git a/boards/nucleo-f103/dist/openocd.cfg b/boards/nucleo-f103/dist/openocd.cfg deleted file mode 100644 index befcac3250eb..000000000000 --- a/boards/nucleo-f103/dist/openocd.cfg +++ /dev/null @@ -1,3 +0,0 @@ -#source [find board/st_nucleo_f1.cfg] -source [find board/st_nucleo_f103rb.cfg] -$_TARGETNAME configure -rtos auto diff --git a/boards/nucleo-f302/dist/openocd.cfg b/boards/nucleo-f302/dist/openocd.cfg deleted file mode 100644 index 248900753531..000000000000 --- a/boards/nucleo-f302/dist/openocd.cfg +++ /dev/null @@ -1 +0,0 @@ -source [find board/st_nucleo_f3.cfg] diff --git a/boards/nucleo-f303/dist/openocd.cfg b/boards/nucleo-f303/dist/openocd.cfg deleted file mode 100644 index 915eebc912fa..000000000000 --- a/boards/nucleo-f303/dist/openocd.cfg +++ /dev/null @@ -1,2 +0,0 @@ -source [find board/st_nucleo_f3.cfg] -$_TARGETNAME configure -rtos auto diff --git a/boards/nucleo-f334/dist/openocd.cfg b/boards/nucleo-f334/dist/openocd.cfg deleted file mode 100644 index 915eebc912fa..000000000000 --- a/boards/nucleo-f334/dist/openocd.cfg +++ /dev/null @@ -1,2 +0,0 @@ -source [find board/st_nucleo_f3.cfg] -$_TARGETNAME configure -rtos auto diff --git a/boards/nucleo-f401/dist/openocd.cfg b/boards/nucleo-f401/dist/openocd.cfg deleted file mode 100644 index 27ae019aeb12..000000000000 --- a/boards/nucleo-f401/dist/openocd.cfg +++ /dev/null @@ -1,2 +0,0 @@ -source [find board/st_nucleo_f4.cfg] -$_TARGETNAME configure -rtos auto diff --git a/boards/nucleo-f410/dist/openocd.cfg b/boards/nucleo-f410/dist/openocd.cfg deleted file mode 100644 index 9a3061f0bf82..000000000000 --- a/boards/nucleo-f410/dist/openocd.cfg +++ /dev/null @@ -1 +0,0 @@ -source [find board/st_nucleo_f4.cfg] diff --git a/boards/nucleo-f411/dist/openocd.cfg b/boards/nucleo-f411/dist/openocd.cfg deleted file mode 100644 index 9a3061f0bf82..000000000000 --- a/boards/nucleo-f411/dist/openocd.cfg +++ /dev/null @@ -1 +0,0 @@ -source [find board/st_nucleo_f4.cfg] diff --git a/boards/nucleo-f446/dist/openocd.cfg b/boards/nucleo-f446/dist/openocd.cfg deleted file mode 100644 index 9a3061f0bf82..000000000000 --- a/boards/nucleo-f446/dist/openocd.cfg +++ /dev/null @@ -1 +0,0 @@ -source [find board/st_nucleo_f4.cfg] diff --git a/boards/nucleo-l053/dist/openocd.cfg b/boards/nucleo-l053/dist/openocd.cfg deleted file mode 100644 index b4c77067577c..000000000000 --- a/boards/nucleo-l053/dist/openocd.cfg +++ /dev/null @@ -1,7 +0,0 @@ -source [find interface/stlink-v2-1.cfg] - -transport select hla_swd - -source [find target/stm32l0.cfg] - -reset_config srst_only diff --git a/boards/nucleo-l073/dist/openocd.cfg b/boards/nucleo-l073/dist/openocd.cfg deleted file mode 100644 index b4c77067577c..000000000000 --- a/boards/nucleo-l073/dist/openocd.cfg +++ /dev/null @@ -1,7 +0,0 @@ -source [find interface/stlink-v2-1.cfg] - -transport select hla_swd - -source [find target/stm32l0.cfg] - -reset_config srst_only diff --git a/boards/nucleo-l152/dist/openocd.cfg b/boards/nucleo-l152/dist/openocd.cfg deleted file mode 100644 index 939ea7d89657..000000000000 --- a/boards/nucleo-l152/dist/openocd.cfg +++ /dev/null @@ -1,2 +0,0 @@ -source [find board/st_nucleo_l1.cfg] -$_TARGETNAME configure -rtos auto diff --git a/boards/nucleo-l476/dist/openocd.cfg b/boards/nucleo-l476/dist/openocd.cfg deleted file mode 100644 index 79ee8f3fb830..000000000000 --- a/boards/nucleo-l476/dist/openocd.cfg +++ /dev/null @@ -1,5 +0,0 @@ -source [find interface/stlink-v2-1.cfg] - -transport select hla_swd - -source [find target/stm32l4x.cfg] diff --git a/boards/nucleo144-f207/dist/openocd.cfg b/boards/nucleo144-f207/dist/openocd.cfg deleted file mode 100644 index 66bc6f2e78a2..000000000000 --- a/boards/nucleo144-f207/dist/openocd.cfg +++ /dev/null @@ -1,7 +0,0 @@ -source [find interface/stlink-v2-1.cfg] - -transport select hla_swd - -source [find target/stm32f2x.cfg] - -reset_config srst_only diff --git a/boards/nucleo144-f303/dist/openocd.cfg b/boards/nucleo144-f303/dist/openocd.cfg deleted file mode 100644 index 248900753531..000000000000 --- a/boards/nucleo144-f303/dist/openocd.cfg +++ /dev/null @@ -1 +0,0 @@ -source [find board/st_nucleo_f3.cfg] diff --git a/boards/nucleo144-f412/dist/openocd.cfg b/boards/nucleo144-f412/dist/openocd.cfg deleted file mode 100644 index 9a3061f0bf82..000000000000 --- a/boards/nucleo144-f412/dist/openocd.cfg +++ /dev/null @@ -1 +0,0 @@ -source [find board/st_nucleo_f4.cfg] diff --git a/boards/nucleo144-f413/dist/openocd.cfg b/boards/nucleo144-f413/dist/openocd.cfg deleted file mode 100644 index 9a3061f0bf82..000000000000 --- a/boards/nucleo144-f413/dist/openocd.cfg +++ /dev/null @@ -1 +0,0 @@ -source [find board/st_nucleo_f4.cfg] diff --git a/boards/nucleo144-f429/dist/openocd.cfg b/boards/nucleo144-f429/dist/openocd.cfg deleted file mode 100644 index 9a3061f0bf82..000000000000 --- a/boards/nucleo144-f429/dist/openocd.cfg +++ /dev/null @@ -1 +0,0 @@ -source [find board/st_nucleo_f4.cfg] diff --git a/boards/nucleo144-f446/dist/openocd.cfg b/boards/nucleo144-f446/dist/openocd.cfg deleted file mode 100644 index 9a3061f0bf82..000000000000 --- a/boards/nucleo144-f446/dist/openocd.cfg +++ /dev/null @@ -1 +0,0 @@ -source [find board/st_nucleo_f4.cfg] diff --git a/boards/nucleo144-f722/dist/openocd.cfg b/boards/nucleo144-f722/dist/openocd.cfg deleted file mode 100644 index d028c1996807..000000000000 --- a/boards/nucleo144-f722/dist/openocd.cfg +++ /dev/null @@ -1,5 +0,0 @@ -source [find interface/stlink-v2-1.cfg] - -transport select hla_swd - -source [find target/stm32f7x.cfg] diff --git a/boards/nucleo144-f746/dist/openocd.cfg b/boards/nucleo144-f746/dist/openocd.cfg deleted file mode 100644 index d028c1996807..000000000000 --- a/boards/nucleo144-f746/dist/openocd.cfg +++ /dev/null @@ -1,5 +0,0 @@ -source [find interface/stlink-v2-1.cfg] - -transport select hla_swd - -source [find target/stm32f7x.cfg] diff --git a/boards/nucleo144-f767/dist/openocd.cfg b/boards/nucleo144-f767/dist/openocd.cfg deleted file mode 100644 index d028c1996807..000000000000 --- a/boards/nucleo144-f767/dist/openocd.cfg +++ /dev/null @@ -1,5 +0,0 @@ -source [find interface/stlink-v2-1.cfg] - -transport select hla_swd - -source [find target/stm32f7x.cfg] diff --git a/boards/nucleo32-f031/dist/openocd.cfg b/boards/nucleo32-f031/dist/openocd.cfg deleted file mode 100644 index 4f0cfb3a023b..000000000000 --- a/boards/nucleo32-f031/dist/openocd.cfg +++ /dev/null @@ -1 +0,0 @@ -source [find board/st_nucleo_f0.cfg] diff --git a/boards/nucleo32-f042/dist/openocd.cfg b/boards/nucleo32-f042/dist/openocd.cfg deleted file mode 100644 index 4f0cfb3a023b..000000000000 --- a/boards/nucleo32-f042/dist/openocd.cfg +++ /dev/null @@ -1 +0,0 @@ -source [find board/st_nucleo_f0.cfg] diff --git a/boards/nucleo32-f303/dist/openocd.cfg b/boards/nucleo32-f303/dist/openocd.cfg deleted file mode 100644 index 248900753531..000000000000 --- a/boards/nucleo32-f303/dist/openocd.cfg +++ /dev/null @@ -1 +0,0 @@ -source [find board/st_nucleo_f3.cfg] diff --git a/boards/nucleo32-l031/dist/openocd.cfg b/boards/nucleo32-l031/dist/openocd.cfg deleted file mode 100644 index b4c77067577c..000000000000 --- a/boards/nucleo32-l031/dist/openocd.cfg +++ /dev/null @@ -1,7 +0,0 @@ -source [find interface/stlink-v2-1.cfg] - -transport select hla_swd - -source [find target/stm32l0.cfg] - -reset_config srst_only diff --git a/boards/nucleo32-l432/dist/openocd.cfg b/boards/nucleo32-l432/dist/openocd.cfg deleted file mode 100644 index fd36a3272e67..000000000000 --- a/boards/nucleo32-l432/dist/openocd.cfg +++ /dev/null @@ -1,7 +0,0 @@ -source [find interface/stlink-v2-1.cfg] - -transport select hla_swd - -source [find target/stm32l4x.cfg] - -reset_config srst_only srst_nogate diff --git a/boards/pba-d-01-kw2x/Makefile.include b/boards/pba-d-01-kw2x/Makefile.include index 84b620e03d06..cbb113375309 100644 --- a/boards/pba-d-01-kw2x/Makefile.include +++ b/boards/pba-d-01-kw2x/Makefile.include @@ -28,6 +28,8 @@ export OPENOCD_PRE_VERIFY_CMDS += \ export OPENOCD_EXTRA_INIT export PRE_FLASH_CHECK_SCRIPT = $(RIOTCPU)/$(CPU)/dist/check-fcfield-elf.sh +export DEBUG_ADAPTER ?= dap + # Add board selector (USB serial) to OpenOCD options if specified. # Use /dist/tools/usb-serial/list-ttys.sh to find out serial number. # Usage: SERIAL="0200..." BOARD="pba-d-01-kw2x" make flash diff --git a/boards/pba-d-01-kw2x/dist/openocd.cfg b/boards/pba-d-01-kw2x/dist/openocd.cfg index f2fb040b80c9..e201325bbd75 100644 --- a/boards/pba-d-01-kw2x/dist/openocd.cfg +++ b/boards/pba-d-01-kw2x/dist/openocd.cfg @@ -1,7 +1,6 @@ # # Freescale Kinetis kw2xdxxx devices # -source [find interface/cmsis-dap.cfg] # # K21 devices support both JTAG and SWD transports. diff --git a/boards/samd21-xpro/dist/openocd.cfg b/boards/samd21-xpro/dist/openocd.cfg index 699263398510..5219231a7e35 100644 --- a/boards/samd21-xpro/dist/openocd.cfg +++ b/boards/samd21-xpro/dist/openocd.cfg @@ -1,2 +1,2 @@ -source [find board/atmel_samd21_xplained_pro.cfg] +source [find target/at91samdXX.cfg] $_TARGETNAME configure -rtos auto diff --git a/boards/saml21-xpro/dist/openocd.cfg b/boards/saml21-xpro/dist/openocd.cfg index 3186498088a5..5219231a7e35 100644 --- a/boards/saml21-xpro/dist/openocd.cfg +++ b/boards/saml21-xpro/dist/openocd.cfg @@ -1,2 +1,2 @@ -source [find board/atmel_saml21_xplained_pro.cfg] +source [find target/at91samdXX.cfg] $_TARGETNAME configure -rtos auto diff --git a/boards/samr21-xpro/dist/openocd.cfg b/boards/samr21-xpro/dist/openocd.cfg index 597b433bc929..5219231a7e35 100644 --- a/boards/samr21-xpro/dist/openocd.cfg +++ b/boards/samr21-xpro/dist/openocd.cfg @@ -1,2 +1,2 @@ -source [find board/atmel_samr21_xplained_pro.cfg] +source [find target/at91samdXX.cfg] $_TARGETNAME configure -rtos auto diff --git a/boards/seeeduino_arch-pro/Makefile.include b/boards/seeeduino_arch-pro/Makefile.include index 73f97a001bc8..2e6bcda111e2 100644 --- a/boards/seeeduino_arch-pro/Makefile.include +++ b/boards/seeeduino_arch-pro/Makefile.include @@ -8,6 +8,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) # setup serial terminal include $(RIOTMAKE)/tools/serial.inc.mk +DEBUG_ADAPTER ?= dap + # this board uses openocd include $(RIOTMAKE)/tools/openocd.inc.mk diff --git a/boards/seeeduino_arch-pro/dist/openocd.cfg b/boards/seeeduino_arch-pro/dist/openocd.cfg index 52bdbff354ce..358384a10920 100644 --- a/boards/seeeduino_arch-pro/dist/openocd.cfg +++ b/boards/seeeduino_arch-pro/dist/openocd.cfg @@ -1,4 +1,3 @@ -source [find interface/cmsis-dap.cfg] source [find target/lpc17xx.cfg] adapter_khz 500 diff --git a/boards/sodaq-autonomo/dist/openocd.cfg b/boards/sodaq-autonomo/dist/openocd.cfg index 1cbbeb67a4b9..b99bc995ceaf 100644 --- a/boards/sodaq-autonomo/dist/openocd.cfg +++ b/boards/sodaq-autonomo/dist/openocd.cfg @@ -1,38 +1 @@ -# -# SODAQ Autonomo -# -# Copyright (c) 2016 SODAQ. All right reserved. -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# - -# -# To program the Autonomo you need openocd v0.9.0 or higher -# Here is an example bash script: -# #!/bin/bash -# ELF=${1?} -# OPENOCD_CMD="telnet_port disabled; init; halt; at91samd bootloader 0; program {{$ELF}} verify reset; shutdown" -# openocd -d2 -f boards/sodaq-autonomo/dist/openocd.cfg -c "$OPENOCD_CMD" - -source [find interface/cmsis-dap.cfg] - -# chip name -set CHIPNAME at91samd21j18 -set ENDIAN little - -# choose a port here -set telnet_port 0 - source [find target/at91samdXX.cfg] diff --git a/boards/stm32f0discovery/Makefile.include b/boards/stm32f0discovery/Makefile.include index 628b16fa30e6..d959daf28103 100644 --- a/boards/stm32f0discovery/Makefile.include +++ b/boards/stm32f0discovery/Makefile.include @@ -9,5 +9,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) # setup serial terminal include $(RIOTMAKE)/tools/serial.inc.mk +export DEBUG_ADAPTER ?= stlink +export STLINK_VERSION ?= 2 + # this board uses openocd include $(RIOTMAKE)/tools/openocd.inc.mk diff --git a/boards/stm32f0discovery/dist/openocd.cfg b/boards/stm32f0discovery/dist/openocd.cfg index 9a408c9d139d..5caf9a521a69 100644 --- a/boards/stm32f0discovery/dist/openocd.cfg +++ b/boards/stm32f0discovery/dist/openocd.cfg @@ -1,2 +1,6 @@ -source [find board/stm32f0discovery.cfg] +set WORKAREASIZE 0x2000 +source [find target/stm32f0x.cfg] + +reset_config srst_only + $_TARGETNAME configure -rtos auto diff --git a/boards/stm32f3discovery/Makefile.include b/boards/stm32f3discovery/Makefile.include index 6e6ca2a41996..03adf30a9347 100644 --- a/boards/stm32f3discovery/Makefile.include +++ b/boards/stm32f3discovery/Makefile.include @@ -9,5 +9,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) # setup serial terminal include $(RIOTMAKE)/tools/serial.inc.mk +export DEBUG_ADAPTER ?= stlink +export STLINK_VERSION ?= 2 + # this board uses openocd include $(RIOTMAKE)/tools/openocd.inc.mk diff --git a/boards/stm32f3discovery/dist/openocd.cfg b/boards/stm32f3discovery/dist/openocd.cfg index d164f1c152e5..a9f35532594e 100644 --- a/boards/stm32f3discovery/dist/openocd.cfg +++ b/boards/stm32f3discovery/dist/openocd.cfg @@ -1,2 +1,5 @@ -source [find board/stm32f3discovery.cfg] +source [find target/stm32f3x.cfg] + +reset_config srst_only + $_TARGETNAME configure -rtos auto diff --git a/boards/stm32f4discovery/Makefile.include b/boards/stm32f4discovery/Makefile.include index def388e08d6f..b0b98b366228 100644 --- a/boards/stm32f4discovery/Makefile.include +++ b/boards/stm32f4discovery/Makefile.include @@ -9,5 +9,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) # setup serial terminal include $(RIOTMAKE)/tools/serial.inc.mk +export DEBUG_ADAPTER ?= stlink +export STLINK_VERSION ?= 2 + # this board uses openocd include $(RIOTMAKE)/tools/openocd.inc.mk diff --git a/boards/stm32f4discovery/dist/openocd.cfg b/boards/stm32f4discovery/dist/openocd.cfg index a2f4a9204699..fac86c6f00cf 100644 --- a/boards/stm32f4discovery/dist/openocd.cfg +++ b/boards/stm32f4discovery/dist/openocd.cfg @@ -1,2 +1,8 @@ -source [find board/stm32f4discovery.cfg] +# increase working area to 64KB +set WORKAREASIZE 0x10000 + +source [find target/stm32f4x.cfg] + +reset_config srst_only + $_TARGETNAME configure -rtos auto diff --git a/boards/stm32f7discovery/Makefile.include b/boards/stm32f7discovery/Makefile.include index 5e292b70bf33..ccae756d4bb3 100644 --- a/boards/stm32f7discovery/Makefile.include +++ b/boards/stm32f7discovery/Makefile.include @@ -9,5 +9,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) # setup serial terminal include $(RIOTMAKE)/tools/serial.inc.mk +export DEBUG_ADAPTER ?= stlink +export STLINK_VERSION ?= 2-1 + # this board uses openocd include $(RIOTMAKE)/tools/openocd.inc.mk diff --git a/boards/stm32f7discovery/dist/openocd.cfg b/boards/stm32f7discovery/dist/openocd.cfg index d028c1996807..7a6f129663fa 100644 --- a/boards/stm32f7discovery/dist/openocd.cfg +++ b/boards/stm32f7discovery/dist/openocd.cfg @@ -1,5 +1 @@ -source [find interface/stlink-v2-1.cfg] - -transport select hla_swd - source [find target/stm32f7x.cfg] diff --git a/boards/yunjia-nrf51822/Makefile.include b/boards/yunjia-nrf51822/Makefile.include index 759cf37a4df5..e4c6cac363b1 100644 --- a/boards/yunjia-nrf51822/Makefile.include +++ b/boards/yunjia-nrf51822/Makefile.include @@ -9,5 +9,8 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) # setup serial terminal include $(RIOTMAKE)/tools/serial.inc.mk +export DEBUG_ADAPTER ?= stlink +export STLINK_VERSION ?= 2 + # this board uses openocd include $(RIOTMAKE)/tools/openocd.inc.mk diff --git a/boards/yunjia-nrf51822/dist/openocd.cfg b/boards/yunjia-nrf51822/dist/openocd.cfg index 6d346ee828da..d16a15a3ecc0 100644 --- a/boards/yunjia-nrf51822/dist/openocd.cfg +++ b/boards/yunjia-nrf51822/dist/openocd.cfg @@ -1,6 +1,3 @@ -source [find interface/stlink-v2.cfg] -transport select hla_swd - set WORKAREASIZE 0x4000 source [find target/nrf51.cfg] $_TARGETNAME configure -rtos auto