diff --git a/boards/dwm1001/Makefile.include b/boards/dwm1001/Makefile.include index 5008dc2c52..3316cfd802 100644 --- a/boards/dwm1001/Makefile.include +++ b/boards/dwm1001/Makefile.include @@ -1,2 +1,7 @@ +# Set UICR.PSELRESET[0] and UICR.PSELRESET[1] registers at 0x10001200 +# to pin P0.21 (0x15), which is connected to the onboard Reset button +JLINK_POST_FLASH = Write4 0x10001200 00000015 00000015 +OPENOCD_PRE_VERIFY_CMDS = -c 'flash fillw 0x10001200 0x00000015 2' + # include common configuration for nrf52 based boards include $(RIOTBOARD)/common/nrf52/Makefile.include diff --git a/boards/nrf52840dk/Makefile.include b/boards/nrf52840dk/Makefile.include index 7a7fc118c9..8752184f6a 100644 --- a/boards/nrf52840dk/Makefile.include +++ b/boards/nrf52840dk/Makefile.include @@ -6,4 +6,9 @@ TTY_BOARD_FILTER := --model J-Link # the debug adapter DEBUG_ADAPTER_ID_IS_TTY_SERIAL := 1 +# Set UICR.PSELRESET[0] and UICR.PSELRESET[1] registers at 0x10001200 +# to pin P0.18 (0x12), which is connected to the onboard Reset button +JLINK_POST_FLASH = Write4 0x10001200 00000012 00000012 +OPENOCD_PRE_VERIFY_CMDS = -c 'flash fillw 0x10001200 0x00000012 2' + include $(RIOTBOARD)/common/nrf52xxxdk/Makefile.include diff --git a/boards/nrf52dk/Makefile.include b/boards/nrf52dk/Makefile.include index c86c0c8eab..856268ece0 100644 --- a/boards/nrf52dk/Makefile.include +++ b/boards/nrf52dk/Makefile.include @@ -2,4 +2,9 @@ # USB serials to only select the UART bridge of integrated J-Link debugger. TTY_BOARD_FILTER := --model J-Link +# Set UICR.PSELRESET[0] and UICR.PSELRESET[1] registers at 0x10001200 +# to pin P0.21 (0x15), which is connected to the onboard Reset button +JLINK_POST_FLASH = Write4 0x10001200 00000015 00000015 +OPENOCD_PRE_VERIFY_CMDS = -c 'flash fillw 0x10001200 0x00000015 2' + include $(RIOTBOARD)/common/nrf52xxxdk/Makefile.include diff --git a/boards/reel/Makefile.include b/boards/reel/Makefile.include index 44957c666a..cc3b3a1a46 100644 --- a/boards/reel/Makefile.include +++ b/boards/reel/Makefile.include @@ -2,5 +2,9 @@ OPENOCD_DEBUG_ADAPTER ?= dap PROGRAMMER ?= openocd +# Set UICR.PSELRESET[0] and UICR.PSELRESET[1] registers at 0x10001200 +# to pin P0.18 (0x12), which is connected to the onboard Reset button +OPENOCD_PRE_VERIFY_CMDS = -c 'flash fillw 0x10001200 0x00000012 2' + # use the common nrf52 config for the rest include $(RIOTBOARD)/common/nrf52/Makefile.include diff --git a/boards/waveshare-nrf52840-eval-kit/Makefile b/boards/waveshare-nrf52840-eval-kit/Makefile index f8fcbb53a0..92f109f77c 100644 --- a/boards/waveshare-nrf52840-eval-kit/Makefile +++ b/boards/waveshare-nrf52840-eval-kit/Makefile @@ -1,3 +1,8 @@ MODULE = board +# Set UICR.PSELRESET[0] and UICR.PSELRESET[1] registers at 0x10001200 +# to pin P0.18 (0x12), which is connected to the onboard Reset button +JLINK_POST_FLASH = Write4 0x10001200 00000012 00000012 +OPENOCD_PRE_VERIFY_CMDS = -c 'flash fillw 0x10001200 0x00000012 2' + include $(RIOTBASE)/Makefile.base diff --git a/dist/tools/buildsystem_sanity_check/check.sh b/dist/tools/buildsystem_sanity_check/check.sh index 90de6e90d2..0d0b4013ab 100755 --- a/dist/tools/buildsystem_sanity_check/check.sh +++ b/dist/tools/buildsystem_sanity_check/check.sh @@ -119,7 +119,7 @@ UNEXPORTED_VARIABLES+=('OPENOCD_PRE_FLASH_CHECK_SCRIPT') UNEXPORTED_VARIABLES+=('PYOCD_FLASH_TARGET_TYPE') UNEXPORTED_VARIABLES+=('PYOCD_ADAPTER_INIT') UNEXPORTED_VARIABLES+=('JLINK_DEVICE' 'JLINK_IF') -UNEXPORTED_VARIABLES+=('JLINK_PRE_FLASH' 'JLINK_RESET_FILE') +UNEXPORTED_VARIABLES+=('JLINK_PRE_FLASH' 'JLINK_POST_FLASH' 'JLINK_RESET_FILE') UNEXPORTED_VARIABLES+=('GIT_CACHE' 'GIT_CACHE_DIR') UNEXPORTED_VARIABLES+=('LINKXX') UNEXPORTED_VARIABLES+=('APPDEPS' 'BUILDDEPS' 'DEBUGDEPS') diff --git a/dist/tools/nrf52_resetpin_cfg/README.md b/dist/tools/nrf52_resetpin_cfg/README.md index e7634c924e..fb5e4213eb 100644 --- a/dist/tools/nrf52_resetpin_cfg/README.md +++ b/dist/tools/nrf52_resetpin_cfg/README.md @@ -5,6 +5,10 @@ Simply compile, flash, and run this tool on your nRF52x-based board. It will program the given `RESET_PIN` into the NRF_UICR->PSELRESET registers, hence allowing for hardware resets using a button connected to that pin. +> [!WARNING] +> This tool only works with early nRF52 chips with build codes before Fxx. +> Later build codes automatically erase the UICR register on each flashing +> operation. Context =======