From 168829f865770dcb1f595205ee65b296be0d3aa4 Mon Sep 17 00:00:00 2001 From: crasbe Date: Fri, 8 Nov 2024 16:04:08 +0100 Subject: [PATCH] boards/nrf52: always recover device before flashing with OpenOCD --- boards/common/nrf52/Makefile.include | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/boards/common/nrf52/Makefile.include b/boards/common/nrf52/Makefile.include index 8e17d28b28..dfd99b916b 100644 --- a/boards/common/nrf52/Makefile.include +++ b/boards/common/nrf52/Makefile.include @@ -18,8 +18,12 @@ else PROGRAMMER ?= openocd endif -# setup OpenOCD for flashing. Version 0.10 of OpenOCD doesn't contain support -# for nrf52dk and nrf52840dk boards. To use OpenOCD with these a version -# build from source (master > 2018, August the 13rd) is required. +# Setup OpenOCD for flashing. The nRF52 series is supported from OpenOCD v0.11 +# onwards. OPENOCD_DEBUG_ADAPTER ?= jlink OPENOCD_CONFIG = $(RIOTBOARD)/common/nrf52/dist/openocd.cfg + +# From Build Code Fxx and later, the nRF52 device is automatically locked after +# a power cycle and has to be recovered with a separate command after the +# initialization. Otherwise the Flash can not be accessed. +OPENOCD_POST_INIT_CMDS = -c 'nrf52_recover'