{"id":21058986,"url":"https://github.com/robotdad/piconotes","last_synced_at":"2025-07-21T03:04:02.468Z","repository":{"id":75329157,"uuid":"469515667","full_name":"robotdad/piconotes","owner":"robotdad","description":"Notes on the Raspberry Pi Pico use with VS Code","archived":false,"fork":false,"pushed_at":"2024-06-18T00:36:18.000Z","size":987,"stargazers_count":21,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-14T00:41:28.922Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robotdad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-13T22:56:31.000Z","updated_at":"2024-12-11T04:00:54.000Z","dependencies_parsed_at":"2025-03-14T00:40:22.978Z","dependency_job_id":"69814640-335e-471c-96b2-28e4760cb391","html_url":"https://github.com/robotdad/piconotes","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/robotdad/piconotes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robotdad%2Fpiconotes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robotdad%2Fpiconotes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robotdad%2Fpiconotes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robotdad%2Fpiconotes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robotdad","download_url":"https://codeload.github.com/robotdad/piconotes/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robotdad%2Fpiconotes/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266231762,"owners_count":23896473,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T17:09:38.942Z","updated_at":"2025-07-21T03:04:02.463Z","avatar_url":"https://github.com/robotdad.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pi Pico projects in VS Code from WSL\n\nThis is a summary of steps for using the Rapberry Pi Pico in VS Code using WSL on Windows. You should absolutely use the the [Pico SDK docs](https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf) as authoritative, but they cover a lot of ground. There are also a couple of things specific to WSL like using usbip to get your device into that enviornment if you want to debug.\n\nWhen using the official SDK guide be aware the docs assume you are on a Rpi, so even on Linux you have to look out for a few things if you aren't on a Pi.\n\nThe steps here may work on Windows 10, they absolutely work on Windows 11.\n\n# Get the SDK and Samples\nIn WSL\nBest to do this in ~/pico\n```\ncd ~\nmkdir pico\ncd pico\n```\n\nGet the SDK\n```\ngit clone -b master --recursive https://github.com/raspberrypi/pico-sdk.git\nGet the samples\ngit clone -b master https://github.com/raspberrypi/pico-examples.git \n```\nInstall tools\n```\nsudo apt install cmake gcc-arm-none-eabi libnewlib-arm-none-eabi build-essential\n```\nCreate an env variable for the SDK location. To have this last across sessions add this to the bottom of your .bashrc file.\n```\nexport PICO_SDK_PATH=~/pico/pico-sdk\n```\n\n##Look at the blink sample in VS Code\nStart VS Code from WSL\n```\ncd pico-examples/\ncode .\n```\n\nYou may get prompted to install WSL tools in VS Code the first time you do this, do it.\n\nYou will want to install the C++ extension pack if not already installed. \n\nWhen prompted by VS Code to \"pick a kit\" you can choose unspecified. The CMake for the projects here will pick the correct compiler provided they are installed.\n\nThe code for blink is in the blink subfolder. IntelliSense should be working. Try going to the definition of the SDK include file, that isn't in your project but because the SDK variable was configured and used in the CMake project it is available to navigate to.\n\nNext to the build icon chose a target, set it to blink.\n\nClick build. Now you have your program.\n\n# Flash your pico\n\nHold down bootsel on the pico and attach it.\n\nThis opens a drive folder that is the pico.\n\nSelect build\\blink in vscode explorer, reveal in Explorer. This may take a moment.\n\nDrag blink.uf2 to the Pi folder, the explorer window will disappear and now your program is running.\n\n# Debug blink with a picoprobe in VS Code\nYou can debug with VS Code if you have 2 picos, setup one to be the debug probe and the other the target. The next section covers how to set that up. This section presumes you have already done the steps in the next session, but you'll probably refernece this section more often.\n\nMake sure you picoprobe is connected to WSL.\n\nIn an admin PowerShell window\n```\nusbipd list\n```\n\nIdentify the busid of the picoprobe\n```\nusbipd wsl attach --busid=3-2\n```\n\nInstall gdb that works for device.\n```\nsudo apt install gdb-multiarch\n```\n\nGo back to the example directory.\n```\ncd ~/pico/pico-examples\n```\n\nCopy the default debug configuration.\n```\ncp ide/vscode/launch-raspberrypi-swd.json .vscode/launch.json\ncode .\n```\n\nInstall the Cortex-Debug extension if you haven't already.\n\nOpen .vccode/launch.json\n\nUnder config files change\n\n\"interface/raspberrypi-swd.cfg\",\n\nTo\n\n\"interface/picoprobe.cfg\",\n\nSave the file.\n\nClick Run and Debug, run Pico Debug.\n\nWhen prompted for a launch target select blink.\n\nIt will break on entry to the program. You can now step, set breakpoints, etc.\n\n\n# Prepare your picoprobe\nYou will need to setup openocd and picoprobe for debugging from VS Code.\n\n## Build openocd\nMake sure these tools are installed in WSL\n```\nsudo apt install automake autoconf build-essential texinfo libtool libftdi-dev libusb-1.0-0- dev\n```\n\nGet the repo\n```\ncd ~/pico\ngit clone https://github.com/raspberrypi/openocd.git --branch rp2040 --depth=1 --no-single-branch\n\ncd openocd\n./bootstrap\n./configure --enable-picoprobe\nmake  -j4\nsudo make install\n```\n\nNote that if you do other embedded stuff you probably do not want to install this. It is difficult to configure paths to use it if you don't though. So if you do install it to make it easier, if you need to remove it from this same directory run\n```\nsudo make uninstall\n```\n\n## Build picoprobe\n```\ncd ~/pico\ngit clone https://github.com/raspberrypi/picoprobe.git \ncd picoprobe/\ncode .\n```\n\nWhen prompted by VS Code to \"pick a kit\" you can choose unspecified.\n\nClick build in the status bar.\n\nRight click the build folder in the explorer and select reveal in explorer.\n\nHold down bootsel and connect the pico that is going to be the probe. \n\nDrag picoprobe.uf2 to the drive folder of the pico that opened.\n\n## Get driver for the pico probe\nThe picoprobe needs a driver.\n\nUse [Zadig](http://zadig.akeo.ie/) per Pi instructions on Windows, yes drivers stink.\n\n## Setup USB picoprobe for use in WSL\n[These are the official docs for connecting USB devices in WSL](https://docs.microsoft.com/en-us/windows/wsl/connect-usb).\n\n### Install usbip in Windows\n\nWe will connect the picoprobe into WSL using usbip which requires some software in Windows.\n\nIn a PowerShell window:\n```\nwinget install --interactive --exact dorssel.usbipd-win\n```\n\nIn an admin PowerShell window\n```\nusbipd list\n```\n\nIdentify the busid of the picoprobe\n```\nusbipd wsl attach --busid=3-2\n```\n\nIn WSL you can validate it is now there with lsusb.\n\n### Setup udev rules in WSL\nWhile you don't need drivers in WSL you do need to setup udev rules. \nThis is so that openocd can be run as a regular user to access the hardware without sudo. This is important as VS Code shouldn't be run as sudo.\nUse these rules: [openocd/60-openocd.rules](https://github.com/raspberrypi/openocd/blob/rp2040/contrib/60-openocd.rules). If you are an embedded dev using WSL or Linux that is the most comprehensive list I've ever seen of udev rules for debug probes.\n\nIn WSL:\n```\ncd ~\nwget https://raw.githubusercontent.com/raspberrypi/openocd/rp2040/contrib/60-openocd.rules\nsudo mv 60-openocd.rules /etc/udev/rules.d/\nsudo service udev restart\nudevadm control --reload\n```\n\nYou may want to shutdown and restart WSL at this point to make sure the rules kickin.\n\nConnect the target\nRefer to the [Pico SDK docs](https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf) for details.\n\n![pico wiring diagram](images/picoprobe-wiring.png)\n\n![picoprobe in use](images/picoprobe-use.png)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobotdad%2Fpiconotes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobotdad%2Fpiconotes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobotdad%2Fpiconotes/lists"}