From fc923baa4222dc880e5e18aa87b7730552720af0 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Mon, 2 Sep 2019 21:44:58 +0200 Subject: [PATCH 1/4] boards/nucleo: generalize use of connect_assert_srst for flashing This allows to flash/reset even over a crashed or sleeping firmware --- boards/common/nucleo/Makefile.include | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/boards/common/nucleo/Makefile.include b/boards/common/nucleo/Makefile.include index 34cc7539a8..21397cfefe 100644 --- a/boards/common/nucleo/Makefile.include +++ b/boards/common/nucleo/Makefile.include @@ -12,6 +12,10 @@ PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*))) # setup serial terminal include $(RIOTMAKE)/tools/serial.inc.mk +# nucleo boards can become un-flashable after a hardfault, +# use connect_assert_srst to always be able to flash or reset the boards. +export OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 + # all Nucleo boards have an on-board ST-link adapter DEBUG_ADAPTER ?= stlink From 01642b90751f9853076ff64118bb9c2d34954008 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Mon, 2 Sep 2019 21:45:32 +0200 Subject: [PATCH 2/4] boards/nucleo-f091rc: remove duplicate use of connect_assert_srst --- boards/nucleo-f091rc/Makefile.include | 4 ---- 1 file changed, 4 deletions(-) diff --git a/boards/nucleo-f091rc/Makefile.include b/boards/nucleo-f091rc/Makefile.include index d01fb044ac..8db8eaed90 100644 --- a/boards/nucleo-f091rc/Makefile.include +++ b/boards/nucleo-f091rc/Makefile.include @@ -1,6 +1,2 @@ -# nucleo-f091rc can become un-flashable after a hardfault, use connect_assert_srst -# to always be able to flash or reset the board. -export OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 - # load the common Makefile.include for Nucleo boards include $(RIOTBOARD)/common/nucleo64/Makefile.include From 281273f362970930048be229aa02e07f045f4412 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Mon, 2 Sep 2019 21:46:15 +0200 Subject: [PATCH 3/4] boards/stm32: remove use of connect_assert_srst for flashing stm32l0 --- boards/common/stm32/dist/stm32l0.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/common/stm32/dist/stm32l0.cfg b/boards/common/stm32/dist/stm32l0.cfg index 12d015d33c..22d5c471b7 100644 --- a/boards/common/stm32/dist/stm32l0.cfg +++ b/boards/common/stm32/dist/stm32l0.cfg @@ -5,5 +5,5 @@ try { puts "WARNING: Your Openocd version does not support dual bank flash on your board. Falling back to single bank flashing." source [find target/stm32l0.cfg] } -reset_config srst_only connect_assert_srst +reset_config srst_only $_TARGETNAME configure -rtos auto From e45388e210ef2a66a6d182afac081a24f0d60fde Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Mon, 2 Sep 2019 21:46:54 +0200 Subject: [PATCH 4/4] boards/stm32l0: use connect_assert_srst when flashing --- boards/b-l072z-lrwan1/Makefile.include | 5 +++-- boards/i-nucleo-lrwan1/Makefile.include | 5 +++-- boards/lsn50/Makefile.include | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/boards/b-l072z-lrwan1/Makefile.include b/boards/b-l072z-lrwan1/Makefile.include index e4a0c43e56..4d4531fcd9 100644 --- a/boards/b-l072z-lrwan1/Makefile.include +++ b/boards/b-l072z-lrwan1/Makefile.include @@ -11,8 +11,9 @@ include $(RIOTMAKE)/tools/serial.inc.mk # this board has an on-board ST-link adapter DEBUG_ADAPTER ?= stlink -# call a 'reset halt' command before starting the debugger -export OPENOCD_DBG_START_CMD = -c 'reset halt' +# this board can become un-flashable after a hardfault, +# use connect_assert_srst to always be able to flash or reset the board. +export OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 # this board uses openocd include $(RIOTMAKE)/tools/openocd.inc.mk diff --git a/boards/i-nucleo-lrwan1/Makefile.include b/boards/i-nucleo-lrwan1/Makefile.include index e2b9138636..02d5c8c0ca 100644 --- a/boards/i-nucleo-lrwan1/Makefile.include +++ b/boards/i-nucleo-lrwan1/Makefile.include @@ -11,8 +11,9 @@ include $(RIOTMAKE)/tools/serial.inc.mk # to flash this board, use an ST-link adapter DEBUG_ADAPTER ?= stlink -# call a 'reset halt' command before starting the debugger -export OPENOCD_DBG_START_CMD = -c 'reset halt' +# this board can become un-flashable after a hardfault, +# use connect_assert_srst to always be able to flash or reset the boards. +export OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 # this board uses openocd include $(RIOTMAKE)/tools/openocd.inc.mk diff --git a/boards/lsn50/Makefile.include b/boards/lsn50/Makefile.include index 3cb4ee060e..d05c0d3417 100644 --- a/boards/lsn50/Makefile.include +++ b/boards/lsn50/Makefile.include @@ -11,8 +11,9 @@ include $(RIOTMAKE)/tools/serial.inc.mk # By default, flash this board using an ST-link adapter DEBUG_ADAPTER ?= stlink -# call a 'reset halt' command before starting the debugger -export OPENOCD_DBG_START_CMD = -c 'reset halt' +# this board can become un-flashable after a hardfault, +# use connect_assert_srst to always be able to flash or reset the boards. +export OPENOCD_RESET_USE_CONNECT_ASSERT_SRST ?= 1 # this board uses openocd include $(RIOTMAKE)/tools/openocd.inc.mk