Debugging the Pico W using a "Debug Probe" and Visual Studio Code

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi right I'm gonna just walk through the process of creating a new project building and debugging with Visual Studio code on a Raspberry Pi Pico w okay so first things first we need the debug server listening and running now if you haven't measured your sorry modified your new Dev rules you might need sudo on the front of this one I've got mine set up already so open OCD and we'll you'll notice that it's using the cmsys DAP config that's because I'm also using a debug probe now there are a number of debug options for Raspberry Pi Pico this is the official debug probe that comes with the USB and two two connectors on the other side um in all the little sort of semi-transparent plastic case right so that one is distinct from the Pico probe which is where you use the second picot as a debugger it's different firmware I believe right so I'm going to run that and for the duration of all my working on this board I'm just going to leave that running now okay so that's effectively a little server listening on Port 3333 for GDB to talk to it and then it will talk to the Pico by proxy right so leaving that alone now um let's now go and create a project so I've got this Pico folder and one of the repositories that I cloned was the Pico project generator which is a little Python program so I'm going to open that whoops I'm going to use minus minus okay give it a name um Flash y or Blinky mine's at pico w I'm gonna have a timer and have the Pico W onboard LED now that notice that specific to the Pico W because the LED is actually connected to the Wi-Fi chip I assume to save pins make sure you've got console console over you are selected and not over USB so that we can use the serial terminal while debugging click create a vs code project now unfortunately this has either got swd or Pico probe and it's neither of those right we have a confusingly debug probe which is different to the picot probe and certainly different to the bit banging method sometimes used as well for now leave it on picaprope for now and we'll fix it in a minute click ok and that'll create the project now if we look in here there it is that's inside this folder so I'm just going to move that somewhere else so I put it somewhere like Dev folder there you go I'll get rid of some of this and we'll pop it in there right now job number one so it's not to confuse Visual Studio code delete the build folder all right don't want that we'll do a completely clean build here and we want cmake the visual studio Visual Studio code take control of cmake okay so in here we're going to uh make a few changes now just so you know I've got hidden files hidden in Ubuntu here if I click that one you'll see the dot vs code folder is here with four Json files this one needs to be replaced okay so when we I picked Pico probe that's the launch.json for Pico Pro which ain't gonna work we need remote debug whereas this is the remote debugger here right okay so in a minute that one's going to go so let's open vs code code now let's go fix it now oh hang on before I do that let's replace that file so back to the control n for new window go into the picot folder now it's in the Pico examples under IDE vs code they've got this one as well launch Remote open OCD so copy that control C I'm going to control V and in here so this is to replace this two to rename okay so that one's almost correct I say almost okay let's do it code Dot let's go fix it it's a very simple change you'll see that the GDB Target here uh doesn't have a IP address well actually it's on the same machine so it's localhost save that right now we're nearly there so created a project I fixed launch.json I'm running the debugger it's listening on Port 3333 let's now um let's now have a little play so I am going to first of all select kit all right so you might need to do scan for kits mine's already done and it's GCC arm none eabi very important you pick the right one make sure you're on the debug release right and we are almost there so just go to the run and debug or Ctrl shift d and click the green button or press F5 now first time you do this it's this one here you flashy dot elf I don't know what a flashy elf is sounds quite seasonal doesn't it um and off we go if we want to see the printf output I've got minicom set up with the right defaults I restart the program I just run run so this line should print it out hello world and that's it as I said leave the debugger just running in the background you can close Visual Studio code and restart it and it doesn't matter so that's my walkthrough and uh to say that was kind of tricky to work out yeah it was a day and a half right so I hope that saves someone else sometime
Info
Channel: Embedded at Plymouth
Views: 3,708
Rating: undefined out of 5
Keywords: embedded, Beaglebone, angstrom, Linux
Id: T09zMnDtpZ4
Channel Id: undefined
Length: 7min 40sec (460 seconds)
Published: Wed Jun 28 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.