From 26751c76f2e4c8faa28492026f4777963c9879d3 Mon Sep 17 00:00:00 2001 From: liquidraver <504870+liquidraver@users.noreply.github.com> Date: Fri, 18 Sep 2026 21:40:41 +0200 Subject: [PATCH] cherry pick openocd patch from zephyr main --- .../seeed_lr2021_evk/support/openocd.cfg | 5 +++ ...rd-xiao-nrf54l15-openocd-rram-commit.patch | 33 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 zephcore/patches/zephyr/0016-board-xiao-nrf54l15-openocd-rram-commit.patch diff --git a/zephcore/boards/nrf54l/seeed_lr2021_evk/support/openocd.cfg b/zephcore/boards/nrf54l/seeed_lr2021_evk/support/openocd.cfg index 8ec6b49..cc90c5f 100644 --- a/zephcore/boards/nrf54l/seeed_lr2021_evk/support/openocd.cfg +++ b/zephcore/boards/nrf54l/seeed_lr2021_evk/support/openocd.cfg @@ -66,6 +66,11 @@ if {![using_hla]} { proc nrf54l-load {file} { mww 0x5004b500 0x101 load_image $file + # Commit the final partial 128-bit RRAM write line left by load_image. + # RRAMC.TASKS_COMMITWRITEBUF @ 0x5004b008. Mirrors upstream 1079b21dcda7 + # (see patches/zephyr/0016); without it the image's last line keeps the + # previous firmware's bytes. + mww 0x5004b008 1 } # Define CTRL_AP_NUM explicitly to avoid variable errors diff --git a/zephcore/patches/zephyr/0016-board-xiao-nrf54l15-openocd-rram-commit.patch b/zephcore/patches/zephyr/0016-board-xiao-nrf54l15-openocd-rram-commit.patch new file mode 100644 index 0000000..b9e6d7e --- /dev/null +++ b/zephcore/patches/zephyr/0016-board-xiao-nrf54l15-openocd-rram-commit.patch @@ -0,0 +1,33 @@ +ZephCore: backport of upstream zephyrproject-rtos/zephyr 1079b21dcda7 +("boards: seeed: commit RRAM write buffer after image load", PR #117961, +merged to main 2026-09-01). Not on v4.4-branch, and no backport requested. + +The board's `nrf54l-load` proc enables RRAMC writes with a one-line +(128-bit) write buffer and calls load_image, but never commits the buffer. +The image's final partial line is lost at reset, so those bytes keep +whatever the previously flashed firmware had there. Symptom depends on what +lands in that line: in the XIAO nRF54L15 battery-ADC build it was the +startup value of `sync_evt_pool.__bufs`, and flashing that image over a +debug build bus-faulted at the first BT HCI allocation (BFAR 0xf7ce720d, +the debug image's bytes). Erasing does not help; the lost line then reads +0xFF. Reproduced and fix verified on hardware 2026-09-18. + +DROP THIS PATCH once the Zephyr pin contains 1079b21dcda7 (or upstream's +later refactor ca77b788f93a, which moves the proc to +boards/seeed/common/openocd_nrf54l.cfg as `nrf54l_load`). It will then fail +`git apply --check`, which is fatal at configure time. + +diff --git a/boards/seeed/xiao_nrf54l15/support/openocd.cfg b/boards/seeed/xiao_nrf54l15/support/openocd.cfg +index 8ec6b496f65a..c0e227ff342e 100644 +--- a/boards/seeed/xiao_nrf54l15/support/openocd.cfg ++++ b/boards/seeed/xiao_nrf54l15/support/openocd.cfg +@@ -66,6 +66,9 @@ if {![using_hla]} { + proc nrf54l-load {file} { + mww 0x5004b500 0x101 + load_image $file ++ # Commit the final partial 128-bit RRAM write line left by load_image. ++ # RRAMC.TASKS_COMMITWRITEBUF @ 0x5004b008. ++ mww 0x5004b008 1 + } + + # Define CTRL_AP_NUM explicitly to avoid variable errors