After some digging, I found out how to make it so I don't have to run the above using sudo or su.Code:
sudo openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "program blink/blink.elf verify reset exit"
I don't understand the need for 'sudo' with this, and it seems wrong - but it is needed; something about "unable to find matching CMSIS-DAP device"? Any analysis or comments on this would also be welcome.
The issue is by default that USB device is a member of the root group, but if your user is a member of plugdev, you can add a rule to /etc/udev/rules.d to make the device a member of the plugdev group, and give the owner and group permissions to use it.
The openocd.pdf says
The getting started guide has this line to grab the source (slightly different than the debug probe info)Properly installing OpenOCD sets up your operating system to grant it access to the de-
bug adapters. On Linux, this usually involves installing a file in /etc/udev/rules.d, so
OpenOCD has permissions. An example rules file that works for many common adapters
is shipped with OpenOCD in the contrib directory.
Code:
git clone https://github.com/raspberrypi/openocd.git --branch rp2040 --recursive --depth=1
Code:
sudo cp openocd/contrib/60-openocd.rules /etc/udev/rules.d
Code:
lsusbBus 001 Device 003: ID 2e8a:000c Raspberry Pi Debug Probe (CMSIS-DAP)
Code:
# Raspberry Pi Debug Probe (CMSIS-DAP)ATTRS{idVendor}=="2e8a", ATTRS{idProduct}=="000c", MODE="660", GROUP="plugdev", TAG+="uaccess"
Code:
sudo udevadm control --reload-rulessudo udevadm trigger
Code:
groups breakerbreaker : users lp floppy dialout audio video cdrom input plugdev power netdev scanner
Now run openocd with no sudo
Code:
breaker@ace:~$ openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000"Open On-Chip Debugger 0.11.0-g8e3c38f (2023-12-18-22:00)Licensed under GNU GPL v2For bug reports, read http://openocd.org/doc/doxygen/bugs.htmlInfo : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.Info : Hardware thread awareness createdInfo : Hardware thread awareness createdInfo : RP2040 Flash Bank Commandadapter speed: 5000 kHzInfo : Listening on port 6666 for tcl connectionsInfo : Listening on port 4444 for telnet connectionsInfo : Using CMSIS-DAPv2 interface with VID:PID=0x2e8a:0x000c, serial=E6632891E3808730Info : CMSIS-DAP: SWD SupportedInfo : CMSIS-DAP: FW Version = 2.0.0Info : CMSIS-DAP: Interface Initialised (SWD)Info : SWCLK/TCK = 0 SWDIO/TMS = 0 TDI = 0 TDO = 0 nTRST = 0 nRESET = 0Info : CMSIS-DAP: Interface readyInfo : clock speed 5000 kHzInfo : SWD DPIDR 0x0bc12477Info : SWD DLPIDR 0x00000001Info : SWD DPIDR 0x0bc12477Info : SWD DLPIDR 0x10000001Info : rp2040.core0: hardware has 4 breakpoints, 2 watchpointsInfo : rp2040.core1: hardware has 4 breakpoints, 2 watchpointsInfo : starting gdb server for rp2040.core0 on 3333Info : Listening on port 3333 for gdb connections
Statistics: Posted by breaker — Wed Jan 31, 2024 7:43 am