Everything in this file comes from the Getting started with Raspberry Pi Pico for C/C++ development guide. This webpage contains all the same content, just organized into an enumerated list.
This webpage walks you through installing the toolchain, SDK, Raspberry Pi examples, and Hunter's examples on your Mac. It then describes how to build those examples and load them onto the RP2040.
Install Homebrew (if it's not already installed).
- Open up a Terminal and run
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
- You will need to add Homebrew to your PATH. Do so by running the following two commands:
which brew
(this tells you where homebrew lives on your machine)echo 'eval "$([path to homebrew from command above] shellenv)"' >> /Users/USERNAME/.zprofile
(remembering to substitute your username)eval "$(/opt/homebrew/bin/brew shellenv)"
Install the toolchain
- Open up a Terminal and run
brew install cmake
brew tap ArmMbed/homebrew-formulae
brew install arm-none-eabi-gcc
Create a directory in which you will store the SDK and your projects. I put mine in ~/Pico
.
$ mkdir Pico
Navigate into the directory you just created
$ cd ./Pico/
Clone the SDK
$ git clone -b master https://github.com/raspberrypi/pico-sdk.git
$ cd pico-sdk
$ git submodule update --init
$ cd ..
Clone the Raspberry Pi company's examples
$ git clone -b master https://github.com/raspberrypi/pico-examples.git
Clone Hunter's examples
$ git clone -b master https://github.com/vha3/Hunter-Adams-RP2040-Demos.git
Navigate into the pico-examples
directory
$ cd ~/Pico/pico-examples/
Create a directory called build
$ mkdir build
Navigate into the new build
directory
$ cd ~/Pico/pico-examples/build/
Specify the PICO_SDK_PATH
$ export PICO_SDK_PATH=../../pico-sdk
Prepare your cmake build directory
$ cmake ..
Make all the Raspberry Pi company examples
$ make
Navigate into the Hunter-Adams-RP2040-Demos
directory
$ cd ~/Pico/Hunter-Adams-RP2040-Demos/
Create a directory called build
$ mkdir build$
Navigate into the new build
directory
$ cd ~/Pico/Hunter-Adams-RP2040-Demos/build/
Specify the PICO_SDK_PATH
if you haven't already done this previously
$ export PICO_SDK_PATH=../../pico-sdk
Prepare your cmake build directory
$ cmake ..
Make all Hunter's examples
$ make
build
directory. Look in particular for the .uf2 file for whichever project you'd like to program.