Hi there,
So , that is right in line with what I’m thinking , the OpenOCD pulls a config, AFAIK Openocd, when flashing
" With OpenOCD, the program
command sector-erases whatever regions it’s about to write, so your west flash -r openocd …
already erased the necessary pages before programming."
If you want to force a full-chip erase (e.g., to clear leftovers/UICR), you’ve got a few options:
west flash -d build_xiao -r openocd --erase
or, Pure OpenOCD: mass erase only (Adjust the interface path if needed.)
openocd -f interface/cmsis-dap.cfg -f target/nrf54l.cfg ^
-c "init; halt; flash erase_sector 0 0 last; shutdown"
That erases all sectors of flash bank 0. After that, program as usual:
openocd -s "C:/ncs/toolchains/c1a76fddb2/opt/share/openocd/scripts" `
-f interface/cmsis-dap.cfg `
-f target/<TARGET_FILE> `
-c "adapter speed 1000; init; halt; nrf54l mass_erase; sleep 200; reset halt; exit"
Chocolatey OpenOCD, which doesn’t have Nordic’s nRF54L scripts. Use the OpenOCD that ships with NCS and point it at its scripts folder.
to Program
openocd -s "C:/ncs/toolchains/c1a76fddb2/opt/share/openocd/scripts" `
-f interface/cmsis-dap.cfg `
-f target/<TARGET_FILE> `
-c "adapter speed 1000; init; halt; program D:/Nordic/myapps/workspace/T_ROLO/build_xiao/merged.hex verify reset exit"
Notes
- If
nordic_nrf54l.cfg
(or similar) isn’t present, your OpenOCD build may be too old. Use the OpenOCD bundled with NCS (the onewest flash
uses), which lives under the same…\opt\
toolchain tree you referenced above. - You can also try a board cfg if one exists, e.g.
-f board/seeed_xiao_nrf54l15.cfg
. - Keep
adapter speed 1000
(or lower) if you see SWD reliability issues. - Use a mass erase only when you suspect residue (e.g., in config/UICR areas) is causing odd behavior. Otherwise, the normal
west flash -r openocd
flow is fine and faster.
J-Link’ng it means,
-ERASE and WRITE…(loadfile c:\path\to\gold\merged.hex)
HTH
GL PJ