diff --git a/boards/airfy-beacon/Makefile.include b/boards/airfy-beacon/Makefile.include index 759cf37a4d..e4c6cac363 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 6d346ee828..d16a15a3ec 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 89c41c3b5c..b99bc995ce 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 e72fdd77c8..6ffa293ea0 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 b4c7706757..507daa5d38 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 394d1257ac..85c59e3a03 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 a93406dfb5..ad3f024bf1 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 b88ed26267..5b994901fe 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 4e785eb3ac..0000000000 --- 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 0e6e918aa7..72ef312804 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 2580e6835f..0000000000 --- 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 942f1d11b9..021f22074e 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 1855b1f352..623dad11cc 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 530d12f689..404ad7fc20 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 ba4a3e1b75..ce0aa45579 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 0b1c4fdf9e..43022477c4 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 d87c020ab0..d92fcb56e6 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 a2f4a92046..6c80869616 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 620be56ca0..ed3d0b144d 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 0000000000..6beedf6ae6 --- /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 0000000000..172bb8c5f2 --- /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 2393b73abf..0000000000 --- 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 0000000000..f0c2b2c6b7 --- /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 bd4805ee7b..0000000000 --- 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 1c5e4d00d0..20bc2220d4 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 0000000000..2e2e8789c0 --- /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 0000000000..5dfac4c711 --- /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 0000000000..55eef90851 --- /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 0000000000..a497ce7b9f --- /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 0000000000..8313d98b3e --- /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 0000000000..2a1ac13f45 --- /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 0000000000..13fea1b4a9 --- /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 0000000000..aecf846206 --- /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 0000000000..5d8b973e01 --- /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 4f0cfb3a02..0000000000 --- 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 4f0cfb3a02..0000000000 --- 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 ba0fc41dfb..0000000000 --- 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 ba0fc41dfb..0000000000 --- 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 befcac3250..0000000000 --- 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 2489007535..0000000000 --- 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 915eebc912..0000000000 --- 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 915eebc912..0000000000 --- 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 27ae019aeb..0000000000 --- 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 9a3061f0bf..0000000000 --- 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 9a3061f0bf..0000000000 --- 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 9a3061f0bf..0000000000 --- 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 b4c7706757..0000000000 --- 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 b4c7706757..0000000000 --- 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 939ea7d896..0000000000 --- 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 79ee8f3fb8..0000000000 --- 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 66bc6f2e78..0000000000 --- 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 2489007535..0000000000 --- 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 9a3061f0bf..0000000000 --- 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 9a3061f0bf..0000000000 --- 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 9a3061f0bf..0000000000 --- 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 9a3061f0bf..0000000000 --- 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 d028c19968..0000000000 --- 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 d028c19968..0000000000 --- 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 d028c19968..0000000000 --- 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 4f0cfb3a02..0000000000 --- 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 4f0cfb3a02..0000000000 --- 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 2489007535..0000000000 --- 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 b4c7706757..0000000000 --- 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 fd36a3272e..0000000000 --- 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 84b620e03d..cbb1133753 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 f2fb040b80..e201325bbd 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 6992633985..5219231a7e 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 3186498088..5219231a7e 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 597b433bc9..5219231a7e 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 73f97a001b..2e6bcda111 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 52bdbff354..358384a109 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 1cbbeb67a4..b99bc995ce 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 628b16fa30..d959daf281 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 9a408c9d13..5caf9a521a 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 6e6ca2a419..03adf30a93 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 d164f1c152..a9f3553259 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 def388e08d..b0b98b3662 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 a2f4a92046..fac86c6f00 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 5e292b70bf..ccae756d4b 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 d028c19968..7a6f129663 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 759cf37a4d..e4c6cac363 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 6d346ee828..d16a15a3ec 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