From f81baf2bf6b0ec6d78dbcb4d8e49213157dc85e0 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Wed, 16 Oct 2019 14:49:01 +0200 Subject: [PATCH 1/2] boards/frdm: remove OpenOCD < 0.10 specific code OpenOCD 0.10 is out from early 2017, all stable Linux distros provide this version now. --- boards/common/frdm/Makefile.include | 17 -------- boards/common/frdm/dist/old-openocd-kx.cfg | 46 ---------------------- 2 files changed, 63 deletions(-) delete mode 100644 boards/common/frdm/dist/old-openocd-kx.cfg diff --git a/boards/common/frdm/Makefile.include b/boards/common/frdm/Makefile.include index 8a90d4149c..d57d9dc6b9 100644 --- a/boards/common/frdm/Makefile.include +++ b/boards/common/frdm/Makefile.include @@ -7,23 +7,6 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) DEBUG_ADAPTER ?= dap #DEBUG_ADAPTER ?= jlink -# OpenOCD v0.10.0 and newer have built-in support for disabling the Kinetis -# watchdog automatically. Some older releases of Ubuntu and Debian have only -# version 0.9.0 or earlier OpenOCD packages (Ubuntu 17.04, Debian Jessie) -# Set this to 1 if you are using one of these older releases. -USE_OLD_OPENOCD ?= 0 - -ifeq (1,$(USE_OLD_OPENOCD)) -# We need special handling of the watchdog if we want to speed up the flash -# verification by using the MCU to compute the image checksum after flashing. -# wdog-disable.bin is a precompiled binary which will disable the watchdog and -# return control to the debugger (OpenOCD) -export OPENOCD_PRE_VERIFY_CMDS += \ - -c 'load_image $(RIOTCPU)/$(CPU)/dist/wdog-disable.bin 0x20000000 bin' \ - -c 'resume 0x20000000' -export OPENOCD_CONFIG ?= $(RIOTBOARD)/common/frdm/dist/old-openocd-$(CPU_FAMILY).cfg -endif - # Configuration for OpenOCD v0.10.0 and newer export OPENOCD_CONFIG ?= $(RIOTBOARD)/common/frdm/dist/openocd-$(CPU_FAMILY).cfg diff --git a/boards/common/frdm/dist/old-openocd-kx.cfg b/boards/common/frdm/dist/old-openocd-kx.cfg deleted file mode 100644 index 72ef312804..0000000000 --- a/boards/common/frdm/dist/old-openocd-kx.cfg +++ /dev/null @@ -1,46 +0,0 @@ -# -# Freescale Kinetis Kxx devices when using old OpenOCD versions (<0.10.0) -# -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 From 4c794c1122cb8f3399b4fbe5bc4bad4c50eb87ed Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Wed, 16 Oct 2019 14:53:42 +0200 Subject: [PATCH 2/2] boards/frdm: document more the OpenOCD version requirement Add the need to have a built from source version of OpenOCD for kw41z and give the url of the commit adding the change in OpenOCD --- boards/common/frdm/Makefile.include | 3 +++ 1 file changed, 3 insertions(+) diff --git a/boards/common/frdm/Makefile.include b/boards/common/frdm/Makefile.include index d57d9dc6b9..7769a8e6ed 100644 --- a/boards/common/frdm/Makefile.include +++ b/boards/common/frdm/Makefile.include @@ -8,6 +8,9 @@ DEBUG_ADAPTER ?= dap #DEBUG_ADAPTER ?= jlink # Configuration for OpenOCD v0.10.0 and newer +# For KW41Z, an OpenOCD version built from source is required. The support for +# kw41z was introduced in +# https://github.com/ntfreak/openocd/2c8602ed9f084d6680cec7d0ca1d5dc71c865a5f export OPENOCD_CONFIG ?= $(RIOTBOARD)/common/frdm/dist/openocd-$(CPU_FAMILY).cfg # Check the flash configuration field before flashing