openocd icon indicating copy to clipboard operation
openocd copied to clipboard

added stock Pico SDK rp2040.cfg to enable flashing with picoprobe

Open gherlein opened this issue 6 months ago • 0 comments

The stock rp2040.cfg file is missing from the Zephyr fork of openocd. This prevents "west flash" from working using a PicoProbe (or a Pico set up as a PicoProbe). Zephyr will by default craft the following openocd command (replace gherlein with your own username):

/home/gherlein/zephyr-sdk-0.16.8/sysroots/x86_64-pokysdk-linux/usr/bin/openocd
-s /home/gherlein/zephyrproject/zephyr/boards/raspberrypi/rpi_pico/support
-s /home/gherlein/zephyr-sdk-0.16.8/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts
-f /home/gherlein/zephyrproject/zephyr/boards/raspberrypi/rpi_pico/support/openocd.cfg
-c 'source [find interface/cmsis-dap.cfg]'
-c 'transport select swd'
-c 'source [find target/rp2040.cfg]'
-c 'set_adapter_speed_if_not_set 2000'
'-c init'
'-c targets'
-c 'reset init'
-c 'flash write_image erase /home/gherlein/src/zephyr/blinky/build/zephyr/zephyr.hex'
-c 'reset run'
-c shutdown

That results in

Open On-Chip Debugger 0.12.0-g4d87f6d (2024-06-13-19:50)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
set_adapter_speed_if_not_set
swd
Can't find target/rp2040.cfg

This is because this repo lacks that file - it only has rp2040-core0.cfg. This patch copies the file from a working tree installed by the Raspberry Pi Pico SDK into zephyr-sdk-0.16.8/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts/target/ which then results in proper flashing using openocd via west.

gherlein avatar Jul 27 '24 13:07 gherlein