Chapter 9. Building on other
platforms
While the main supported platform for developing for the RP2040 is the Raspberry Pi, support for other platforms, such
as Apple macOS and Microsoft Windows, is available.
9.1. Building on Apple macOS
Using macOS to build code for RP2040 is very similar to Linux.
9.1.1. Installing the Toolchain
Installation depends on Homebrew, if you don’t have
Homebrew installed you should go ahead and install it,
$ /bin/bash -c "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Then install the toolchain,
$ brew install cmake
$ brew tap ArmMbed/homebrew-formulae
$ brew install arm-none-eabi-gcc
However after that you can follow the Raspberry Pi instructions to build code for the RP2040. Once the toolchain is
installed there are no differences between macOS and Linux to, so see
Section 2.1 and follow the instructions from
there to fetch the SDK and build the "Blink" example.
9.1.2. Using Visual Studio Code
The Visual Studio Code (VSCode) is a cross platform environment and runs on macOS, as well as Linux, and Microsoft
Windows. Go ahead and
download the macOS version, unzip it, and drag it to your Applications Folder.
Navigate to Applications and click on the icon to start Visual Studio Code.
9.1.3. Building with CMake Tools
After starting Visual Studio Code you then need to install the CMake Tools extension. Click on the Extensions icon in the
left-hand toolbar (or type
Cmd + Shift + X), and search for "CMake Tools" and click on the entry in the list, and then click
on the install button.
We now need to set the
PICO_SDK_PATH environment variable. Navigate to the pico-examples directory and create a .vscode
directory and add a file called settings.json to tell CMake Tools to location of the SDK. Additionally point Visual Studio
at the CMake Tools extension.
{
Ê "cmake.environment": {
Getting started with Raspberry Pi Pico
9.1. Building on Apple macOS 36