Video Tutorial
Why do you want to debug the Pico?
Debugging is an integral part of software development. It offers a peak ‘under the hood’ of your code so to speak by allowing you to inspect variables that are set whilst the program is actually running on your hardware. Debugging also allows you to set breakpoints in your code which essentially pauses the code execution at any point you want. This tutorial walks you through how to debug the Raspberry Pi Pico using a Picoprobe and OpenOCD in the VSCode environment.
Prebuilt OpenOCD for windows and PicoProbe
You can download the ZIP file here. Ensure to extract the files somewhere sensible as you will need the files elsewhere.
You can build your own version of OpenOCD by following the steps in Appendix A of the getting started guide. My pre-built folder is simply intended as a time saver but if you are going to build your own version then you will have to source the libusb-1.0.dll file from libusb.
settings.json
Add the following lines of code to your settings.json file which you can access by using the ctrl+, shortcut and clicking the open JSON file button in the top right corner of the VSCode window. Alter the “PATH TO openocd.exe” to wherever your openocd.exe is, including the openocd.exe for example: “c:/pico/openocd.openocd.exe”.
"cortex-debug.openocdPath": "PATH TO openocd.exe",
"cortex-debug.gdbPath": "arm-none-eabi-gdb"
launch.json
As above, replace the “PATH TO X” with the actual path to X. And the location of the elf file to the actual path of the ELF file.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Cortex Debug",
"cwd": "${workspaceRoot}",
"executable": "${workspaceRoot}/LOCATION OF ELF",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
"device": "Pico2040",
"runToMain": true,
"configFiles": ["interface/picoprobe.cfg", "target/rp2040.cfg"],
"searchDir": ["PATH TO tcl folder"],
"svdFile": "PATH TO rp2040.svd",
}
]
}
Love your posts! … HOWEVER, above on this page is “launch.json” and “searchDir”: [“PATH TO tcl folder”], “svdFile”: “PATH TO rp2040.svd”, … What is “tcl folder”? … What/where is “rp2040.svd”?… Trying to get Windoze 10 VIS STUDIO code thru PICO probe to target PICO per your YouTube vid’s… Thank you!
Hi, I am stock at the point around 5:30 in the video “How to Debug the Raspberry Pi Pico Using Another Pico! – Picoprobe and VSCode Tutorial” where I (try to) execute…..
C:\path_to_elf_file arm-none-eabi-gdb hello_serial.elf
I get an error message box saying:
arm-none-eabi-gdb.exe System error
due to missing python27.dll.
I have succesfully set up the full VScode and debugging system on two older Windows 10 pc prior to this third and new Windows 10 pc installation each time following your videos. This is the first time I get this error.
Can you help me?
My problem is solved! I had somehow downloaded and installed a mingw-version of the arm gcc compiler. I have changed that and it works for me now!
Great videos to get started, thanks!
Hi! I get the same problem as You did. I have fallowed all the instructions in the “getting started guide” and this tutorial, tried reinstalling all components numerous times, using precompiled openocd etc., but still get this error. It is quite frustrating.
I want to try out your fix, but, as I am very new to all of this, I do not know how to install a non mingw version of the arm gcc compiler. I mean I used the current version of the compiler using “gcc-arm-11.2-2022.02-mingw-w64-i686-arm-none-eabi.exe” installer from the site mentioned in the “getting started guide”.
Could you tell me what compiler did you install and from where?
Thank You in advance!
Got it working! Noticed in the video that the compiler version used is “10 2020-q4-major”…
Removed the newer 11.2 2022.02 version and installed the one from the video. And, behold, I have a working picoprobe!
Very nice Video, easy to follow. This was very helpful.