Setting up development environment for Raspberry Pi Pico on M1 mac, with VSCode and OpenOCD

I bought a Raspberry Pi Pico W and a Debug Probe a few days ago, and wanted to set up a development environment on my M1 macOS machine.

So I searched for some guides but most of them were outdated or not complete.

I’m writing this post for tidying things up and keeping a record.

A. Install Pico SDK

First, install macOS packages for development with brew:

$ brew tap ArmMbed/homebrew-formulae
$ brew install cmake arm-none-eabi-gcc

pull Pico SDK from github:

$ git clone -b master
$ cd pico-sdk
$ git submodule update --init

# (optional) pull pico examples
$ cd ..
$ git clone -b master

and put an environment variable in .zshrc:

export PICO_SDK_PATH=/Users/Your-Username/Path-To/pico-sdk

B. Build OpenOCD for Raspberry Pi Pico

Install packages for building OpenOCD:

$ brew install libtool automake libusb wget pkg-config gcc texinfo capstone

pull the source codes and build it:

# NOTE: checkout branch `picoprobe`
$ git clone --branch picoprobe --depth=1
$ cd openocd
$ ./bootstrap
# NOTE: without `CAPSTONE_CFLAGS`, may fail to find capstone header files
$ CAPSTONE_CFLAGS=-I/opt/homebrew/Cellar/capstone/4.0.2/include ./configure --enable-picoprobe --disable-werror
$ make -j4

# (optional) `openocd` will be placed in `/usr/local/bin`
$ sudo make install

and put an environment variable in .zshrc:

export OPENOCD_PATH=/Users/Your-Username/Path-To/OpenOCD-Directory

In my case, I didn’t do sudo make install, so compiled openocd file was placed in the openocd/src/ directory.

(Otherwise, it would be /usr/local/bin/openocd.)

This path to the compiled binary will be used in the following sections.

C. Install VSCode extension

Install this extension in VSCode.

D. Setup VSCode Project

Create a directory named .vscode in your project directory:

$ cd ~/Path-To/Your-Project-Directory
$ mkdir .vscode
$ cd .vscode

and generate launch.json and settings.json in it:

Set the cortex-debug.openocdPath value to the path to the compiled binary.

E. Cabling Debug Probe and Target Pico


Debug Probe’s USB port is connected to the development machine, and its U port is wired with target Pico’s GP0, GP1, and GND pins.


Target Pico’s SWD port is connected to Debug Probe’s D port, and powered with USB port.

F. Let’s Run & Debug!

Open the project in VSCode:

$ code ~/Path-To/Your-Project-Directory

Select active kit for building things:


Select arm-none-eabi here.


Now it can be run and debugged in the ‘Run and Debug’ tab:




G. Troubleshooting

1. Cannot open source files in VSCode

If you see errors complaining about unopenable files,


select Edit "includePath" setting in the quickfix menu,


then add paths in Include path section:



With all these files and configurations, any Pico project can be debugged in the VSCode.

Now is the time to build real things!