Intro to Raspberry Pi Pico and RP2040 - C/C++ Part 2: Debug with Picoprobe | Digi-Key Electronics

preview_player
Показать описание


Note that you will need a second Raspberry Pi Pico device to act as the debugger.

We will program one Pico with the picoprobe firmware to act as the debugger. That device will be connected to the target device (which will run the blink program we created in the first tutorial) over SWD. We can use VS Code as a graphical debugger environment, which will call functions in GDB. GDB will send commands to OpenOCD, which runs as a server in the background. OpenOCD communicates with the picoprobe firmware over USB in order to control the target Pico.

From there, you can install the Cortex-Debug and C/C++ extensions in VS Code. These will allow you to run OpenOCD and GDB in the background while giving you graphical tools to step through lines of code and peek at memory values.

Product Links:

Related Videos:
Intro to Raspberry Pi Pico and RP2040:

Related Project Links:

Related Videos:

Related Articles:

Learn more:
Рекомендации по теме
Комментарии
Автор

Words can't describe how beginner unfriendly developing for pi-pico is. Thanks for the tutorial!

Edit. For anyone trying to build openocd on M1 macs, do:
# export
instead of:
# export
As you can see the path changed.
I spend too much time on this and it could obiously be avoided if we got binaries instead of forcing us to build everything...

ProTimax
Автор

I wouldn't be an embedded sw engineer without the help of this guy

luispinto
Автор

I am truly shocked that there are only 12 comments here.
You sir, have done an Awesome job explaining this.
I'd be lying if I said I made it through without a hitch. There were a few times that my output didn't even vaguely resemble yours. But I did finally make it through and can now move on to more serious work with the pico.

THANK YOU!

YoutubeBorkedMyOldHandle_why
Автор

Shawn, there is absolutely no way on earth I could have gotten this working without your excellent detailed help!!! You seem to anticipate most of the glitches that pop up, and prepare us for that.
THANK YOU!

saustin
Автор

It's amazing that it's the only tutorial on the internet that works for debugging pico

alperenalperen
Автор

This is a very valuable series for me. It will be particularly practical once the Pico is out of the perpetual backorder phase and the 2040 ecosystem grows, which no doubt it will.

bertbrecht
Автор

Thank you for making the effort to put the material together, its always good to watch your stuff because it gets to the point and provides info that may not be in the manuals.

Cant say that this wasn't without pains for me, mostly because the repos changed, but that I could still get around. The achilles heel was when openocd couldn't detect the target.
After reinstalling both, checking hardware etc. the solution was one config entry in
src/interface/cmsis-dap.cfg adding adapter speed 5000 to what little config there actually is. And now we're good to go.

mark-theeverydayimagineer
Автор

Wow, this is super cool! Digikey is so lucky to have Shawn.

BS-myky
Автор

Thank you very much. It was very hard and difficult to build the tools, but at the end it works like a magic. I think that the tools Build tutorials need to be updated and add some more details to it spacially the part after building Openocd the pico tool and libusb.

AhmadAsmndr
Автор

THIS IS A GEM! Awesome setup of arguably the best set of tools for one of the best/popular microcontrollers.

DavidHolman-ukwn
Автор

Thanks for the tutorial.

I had a little trouble with the linux installation on your site and more specificaly regarding the building of openocd. I found out I was missing the package pkg-config.

I don't know if others experienced this problem but though i'd share. It's all written in the readme

MsieurSmiley
Автор

Good things should not come too easily. Thanks for presenting this about as simply as it could be.
During January I went through the hell of getting the Pico SDK setup on w10 and VSC. It works, but I don't know how! Anyway - sub'd.

skf
Автор

Now you can just use the Raspberry VScode extension. I can’t imagine how finicky it was back then

capybara
Автор

thanks bro that is exactly what i need as im way too lazy to read

glugblub
Автор

Seems awfully complicated to set up compared to other IDEs I've used in the past like for the STM32, SAM, Kinetis, etc. How about using a commercial SWD debugger like J-Link which comes with OpenOCD.

aerosynth
Автор

In order to debug non-Pi devices (ex. stm32), would you just need to change the launch json file to point to the target's svd and cfg files?

I understand openocd uses the universal arm protocol 'CMSIS-DAP', but is it necessary to modify or rebuild openocd/msys2 tool whenever you debug a different Arm device (cortex m0<>m3<>m7)?

BTW, George Hotz has a great 2016 video where he shows a different way to debug.. he made a qemu-based tool (qira) that allows for 'timeless' debugging!

bennguyen
Автор

Any tips on the debugger showing assembly instead of my C source code? 🙈

Your Videos are perfect. <3

FruchtcocktailUndCo
Автор

too much work, i will just use printf then 😅

vuhoangdung
Автор

Thanks for the video!!! I have a question that I still can't solve, how can I set in visual code a different RP2040 based board, such as the adafruit feather. Thank you very much.

sebastianabrilvera
Автор

Good tutorial. You should also mention that for the serial to be present and to be able to connect to it with Serial terminal, you need both PICOs to be connected via USB to the PC.
There's also a serial monitor extension for VSCode, which can be used instead of Putty, or any other serial term.

galatei