This is a placeholder topic for “Raspberry Pi Debug Probe” comments.
The Raspberry Pi Debug Probe is an inexpensive, all-in-one USB to serial debug and UART bridge…
Read moreThis is a placeholder topic for “Raspberry Pi Debug Probe” comments.
The Raspberry Pi Debug Probe is an inexpensive, all-in-one USB to serial debug and UART bridge…
Read moreHi Joe,
What kind of projects were you using this with? And what exact problems were you having?
Windows definitely feels like it is fighting against you with a lot of tasks.
Posting your problems in a way that other Makers can help out instead of bagging a very affordable debugging probe is the way to go.
Sometimes projects can be like that, you hit a roadblock, spend a ton of time on a seemingly simple task.
The most classic example I can think of is using ADCs on the ESP32 (base) with WiFi enabled one of the ADCs are disabled.
Given the debug probe is a week old and relies on open-source software there ought to be bugs, the community is here to help.
hello Liam …
thank you for your support Liam it is appreciated.
my project, a month old now, is writing C code
on the Pico, so i also want to learn what debugging
tools are available for it.
debugging tools have certainly been a roadblock for
many Pico users. although the windows environment is
not friendly to the Pico there are many Linux users
who have had similar issues with Picoprobe and the
new Debug Probe.
the windows toolchain is a challenge but it can be set up.
eventually debugging may be a lot easier.
regards
joe
–
UTC+10
Hi Joe,
Completely understand issues with toolchains, it would be nice having a single file that unpacks all of the dependencies, loads up manuals and resources and prepares the development environment.
With time documentation will come!
Liam
introduction
I have deleted my original post concerning the Raspberry Pi Debug Probe because as Liam told me, time resolves everything and that is the case with the Debug Probe.
My present post is about the Windows environment [Windows 11 in my case] and programming the Pico in C.
I can confirm that the Debug Probe works with normal OpenOCD and GDB on the command line and in Visual Studio Code.
Now, before you jump for joy, know that the path is strewn with entangling vines.
Notice that it is a Raspberry Pi Debug Probe. The Raspberry Pi Debug Probe documentation is at Raspberry Pi Documentation - Raspberry Pi Debug Probe The documentation assumes you will be using a Raspberry Pi to build and debug in C. Very little of it refers to Windows. A lot of translation is needed but it is useful for reference. The hybrid software mentioned in the MS Windows sections is not necessary since we have the latest versions of OpenOCD and the ARM GCC compiler.
Toolchain
If you have the Pico toolchain in place and working well you can skip down to ‘The Debug Probe’ below.
Before we get to the Debug Probe we need to have the toolchain for the Pico in place and working well. The best toolchain setup document I have found is Hunter Adam’s PicoSetup part of https://ece4760.github.io/ His document is a clarification of Getting Started with Raspberry Pi Pico, chapter 9.2 https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf
The first install, ARM GCC compiler, is now at Arm GNU Toolchain Downloads – Arm Developer
Along with this read Raspberry Pi Pico and RP2040 - C/C++ Part 1: Blink and VS Code https://www.digikey.com/en/maker/projects/raspberry-pi-pico-and-rp2040-cc-part-1-blink-and-vs-code/7102fb8bca95452e9df6150f39ae8422 by Shawn Hymel for another viewpoint.
Read both of these critically and filter for your own system.
I did not use the install script because i like to know where things are going and it gives a better idea of the layout of the toolchain. Follow the sequence up to “Install the SDK”. Here you need to stop and consider where you will place your pico folder. You will spend a lot of time here so you do not want a long path name. For me it is i:\pico on an external drive set aside for my microcontroller work.
Continue the sequence down to “Building the example projects from the Command Line”.
I did not do a complete build of the examples on the command line because, again, i like to know what is going on. And, the examples folders are a great resource for your understanding of the toolchain and practice at the command line.
Despite what our reference documents say i have set a direct path to the pico sdk - PICO_SDK_PATH=I:\pico\pico-sdk
in the environment variables.
Getting Started with Raspberry Pi Pico, chapter 8, explains the creation of one’s own projects. Work through this. Be wary of notes in the code. Make a folder inside your /pico folder where you will place your own projects, make a folder inside that for your chapter 8 files called ‘test’.
Remember you need to be in a Developer Command Prompt for VS 2022
window. For me nmake
is here - C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\bin\Hostx86\x86\nmake.exe
and the Developer Command Prompt makes this available with the one word command nmake
In the ‘test’ folder the sequence is:
mkdir build
cd build
cmake -G "NMake Makefiles" ..
nmake
Copy a folder from the examples folder to your own folder. Copy CMakeLists.txt and pico_sdk_import.cmake you made for chapter 8 and edit CMakeLists.txt for the present project. Do a search/replace for ‘test’ and replace with ‘blink’ for example. Do the command line sequence to build the program.
Follow Hunter’s Building the example projects from Visual Studio Code
down to his #11. Then go to Shawn Hymel’s document and follow along from ‘Configure VS Code’.
Do the command line builds and VSCode builds until you feel comfortable with them.
Remember that the pico examples have a cmake setup which builds and makes them in one large process. But we can build and make them as individual projects as i have described and this is very good practise for our understanding of the build and make process we will likely use for our own projects.
The Debug Probe
If you have the Pico toolchain in place and working well we can begin use of the Debug Probe. Again, this has a number of gremlins. The first is USB connections. You must have secure USB connections for the Debug Probe. In the many in/out events you have made with the Pico you may have come across these gremlins.
The Raspberry Pi Debug Probe documentation Raspberry Pi Documentation - Raspberry Pi Debug Probe is very Linux and Raspberry Pi focused and is far from helpful for Windows software or the hardware setup.
I can confirm that the Debug Probe works with normal OpenOCD and GDB on the command line and in Visual Studio Code. By ‘normal’ i mean openocd from https://openocd.org/ and Releases · xpack-dev-tools/openocd-xpack · GitHub [11 down in the ‘Assets’] and GDB from Arm GNU Toolchain Downloads – Arm Developer arm-gnu-toolchain-12.2.rel1-mingw-w64-i686-arm-none-eabi.exe
The important things are that you have firm USB connections and that you feel relatively at ease with the command line and VSCode.
Serial Port Notifier How To Detect the COM Port for Any Serial Device in Windows | Tom's Hardware will tell us what serial ports are active.
Zadig https://zadig.akeo.ie/ will tells us which driver is attached to which device. In particular we want to know to which port the Debug Probe is attached and which driver it is using. We want that driver to be WinUSB. So check it and install if necessary. The Zadik interface is a bit confusing so take it slow.
Once you have the Debug Probe recognised as a serial port and using the correct driver we can debug the Pico.
Build a Debug version
We need to be in a Developer Command Prompt for VS 2022 window because we a going to call nmake. We will move to the build folder of our project. For me that is I:\pico\pico-files\blink\build
Having already build the project we do
cmake -DCMAKE_BUILD_TYPE=Debug ..
nmake
Debug
The Debug Probe has two leads which i will call ‘left’ and ‘right’ looking at the top of the board with the Raspberry Pi icon on it’s case.
the left lead
yellow -> pin 0
orange -> pin 1 [actually a strange pinkish color]
black -> GND
the right lead
orange black yellow
to the SWD pins at bottom of the Pico
or at middle of the Pico W
Load the .uf2 file to the Pico. Insert the Pico and the Debug Probe.
We need one more command window [just an ordinary command prompt]… In Windows 11 if you mouse move a window to top of screen you have choices to create placement areas for your windows, or mouse hover it’s maximize square [top right].
This second command window you should open from your OpenOCD folder.
.\bin\openocd -f interface\cmsis-dap.cfg -f target\rp2040.cfg -c "adapter speed 5000" -s share
This will start OpenOCD waiting for GDB to connect.
Move back to the Developer Command Prompt for VS 2022 window, the build folder of our project.
arm-none-eabi-gdb “blink.elf” [or whatever the project .elf file is].
I:\pico\pico-files\blink\build>arm-none-eabi-gdb "blink.elf"
GNU gdb (Arm GNU Toolchain 12.2.Rel1 (Build arm-12.24)) 12.1.90.20221210-git
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=i686-w64-mingw32 --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.linaro.org/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from blink.elf...
(gdb) target extended-remote localhost:3333
Remote debugging using localhost:3333
0x000000ea in ?? ()
(gdb) load
Loading section .boot2, size 0x100 lma 0x10000000
Loading section .text, size 0x4318 lma 0x10000100
Loading section .rodata, size 0xdac lma 0x10004418
Loading section .binary_info, size 0x24 lma 0x100051c4
Loading section .data, size 0x244 lma 0x100051e8
Start address 0x100001e8, load size 21548
Transfer rate: 8 KB/sec, 3591 bytes/write.
(gdb) monitor reset init
[rp2040.core0] halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0x000000ea msp: 0x20041f00
[rp2040.core1] halted due to debug-request, current mode: Thread
xPSR: 0xf1000000 pc: 0x000000ea msp: 0x20041f00
(gdb) b main
Breakpoint 1 at 0x10000308: file I:\pico\pico-files\blink\main.c, line 4.
Note: automatically using hardware breakpoints for read-only addresses.
(gdb) continue
Continuing.
Breakpoint 1, main () at I:\pico\pico-files\blink\main.c:4
4 int main() {
(gdb)
Now we do our debugging work in gdb …
(gdb) quit
Hi Joe,
I don’t have the courage to try Windows 11 yet, I’ll let Microsoft spend some more time debugging it first.
Sounds like you’ve worked your way through most of the Windows-workflow roadblocks and are making some progress. Thank you for sharing your experiences so that others can more easily navigate those same roadblocks in the future.
Thanks for documenting this workflow for others @joe68898
In the build folder of \pico-examples you will find the individualy projects ready to have nmake
called on them.
We could do that with the multiple build process described in the ‘Getting Started …’ .pdf. But we could go into each \build project folder \pico-examples\build\gpio\hello_7segment
for example, and using the Developer Command Prompt call nmake
for that single project.