Skip to content

Instantly share code, notes, and snippets.

@hasumikin
Last active November 9, 2022 05:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hasumikin/f508c092ced0b5d51779d472fbaf81e8 to your computer and use it in GitHub Desktop.
Save hasumikin/f508c092ced0b5d51779d472fbaf81e8 to your computer and use it in GitHub Desktop.
Debug a Pi Pico app with Picoprobe(WSL2)

Run Powershell as an admin

  • usbipd list to find the Picoprobe's BUSID
  • If the BUSID is 2-2,
  • usbipd wsl attach --busid 2-2

On a terminal

  • openocd

On another terminal

  • gdb-pico [project].elf
  • In the gdb's REPL
  • c to start
  • monitor reset halt to reboot

Setup

openocd

git clone https://github.com/raspberrypi/openocd.git --branch picoprobe --depth=1 --no-single-branch
cd openocd
./bootstrap
./configure --enable-picoprobe
make -j4
sudo make install

gdb-multiarch

sudo apt install gdb-multiarch

.bash_alias

alias openocd="sudo openocd -f interface/picoprobe.cfg -f target/rp2040.cfg -c 'bindto 0.0.0.0'"
function gdb-pico() {
  gdb-multiarch -ex "target remote localhost:3333" $*
}
alias gdb-pico=gdb-pico
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment