Documentation
Everything in this file originates from the comprehensive guide âGetting started with Raspberry Pi Pico for C/C++ developmentâ. This document presents the same content, but reformatted into a user-friendly, numbered list for easier comprehension.
Getting everything installed
- Install the ARM GCC compiler.
- Ensure proper installation by clicking the box to register the ARM compilerâs path as an environmental variable within the Windows shell when requested to do so. For reference, please examine the image provided below.
- Install CMake.
- When prompted, add CMake to the systemÂ
PATH
 for all users.
- When prompted, add CMake to the systemÂ
- Install Visual Studio Code
- Install Build Tools for Visual Studio 2019
- When the Built Tools for Visual Studio installer prompts you, be sure to select the âC++ build tools onlyâ installation option.
- You must install the full âWindows 10 SDKâ package as the SDK will need to build theÂ
pioasm
 andÂelf2uf2
 tools locally. Removing it from the list of installed items will mean that you will be unable to build Raspberry Pi Pico binaries. - This takes a while.
Install Python 3.7
- When prompted by the installer, add Python 3.7 to the systemÂ
PATH
 for all users.
- You should be additionally disable theÂ
MAX_PATH
 length when prompted at the end of the installation. - When youâre setting up Pwnagotchi, make sure to select the âCustom installationâ option, navigate to the âOptional Featuresâ section, and subsequently choose âInstall for all usersâ under the âAdvanced Featuresâ tab.
- It is possible that you will need to make a symbolic link so that the Makefile can find Python 3. To do so, typeÂ
cmd
 in the Run Window so that the Developer Command Prompt icon appears in the Start Menu. Select the small arrow to the right of the icon, and then select âRun as administrator.â Navigate toÂC:\Program Files\Python37
 and make a symlink by runningC:\Program Files\Python37 > mklink python3.exe python.exe
Only do this if your build fails because Make canât find your python installation.
- Install Git.
- When prompted by the installer, make sure that you change the default editor away fromÂ
vim
 (see below)
- Tick the checkbox to allow Git to be used from third-party tools.
- Check the box âCheckout as is, commit as-isâ (unless you have a strong reason not to)
- Select âUse Windowsâ default console windowâ
- Select âEnable experimental support for pseudo consolesâ
Getting the SDK and examples
- Open Windows PowerShell, and create a directory where youâd like to store all the Pico examples and the SDK. I put mine inÂ
C:\Users\vha3\Pico
- Run the following set of commands:
C:\Users\vha3\Pico> git clone -b master https://github.com/raspberrypi/pico-sdk.git
C:\Users\vha3\Pico> cd pico-sdk
C:\Users\vha3\Pico\pico-sdk> git submodule update --init
C:\Users\vha3\Pico\pico-sdk> cd ..
C:\Users\vha3\Pico> git clone -b master https://github.com/raspberrypi/pico-examples.git
Building the example projects from the Command Line
- From the Windows Menu, selectÂ
Windows > Visual Studio 2019 > Developer Command Prompt
- Navigate to the directory where youâve installed the Pico examples and SDK. For me, it wasÂ
C:\Users\vha3\Pico
. - Set the path to the SDK by running the following:
C:\Users\vha3\Pico > setx PICO_SDK_PATH "..\..\pico-sdk"
- Close the current command prompt window.
- Open a new Command Prompt window by again navigating from the Windows Menu toÂ
Windows > Visual Studio 2019 > Developer Command Prompt
. Closing/re-opening will set the environment variable that we configured above. - Navigate to theÂ
pico-examples
 folder. For me, this was in the directoryÂC:\Users\vha3\Pico\pico-examples
- Build the âHello Worldâ example by running:
C:\Users\vha3\Pico> cd pico-examples
C:\Users\vha3\Pico\pico-examples> mkdir build
C:\Users\vha3\Pico\pico-examples> cd build
C:\Users\vha3\Pico\pico-examples\build> cmake -G "NMake Makefiles" ..
C:\Users\vha3\Pico\pico-examples\build> nmake
- Within theÂ
build
 directory, you will now find aÂhello_world
 directory. You will find directories for each of the other example projects too. These folders will contain the ELF,Âbin
, andÂuf2
 target files for each project. TheÂuf2
 target file can be dragged-and-dropped directly onto an RP2040 board attached to your PC via USB, as explained in the next section.
Programming the Pico
- While holding down theÂ
BOOTSEL
 button, plug the Pico into a USB port. - The Pico will appear as a mass storage device in your file navigator.
- Drag-and-dropÂ
C:\Users\vha3\Pico\pico-examples\build\blink.uf2
 to the Pico, as you would if you were moving a file to a flash drive. - The Pico will automatically reboot, and start running the Blink example, flashing the LED.
Building the example projects from Visual Studio Code
- Navigate via the Windows Menu toÂ
Windows > Visual Studio 2019 > Developer Command Prompt
- When the command prompt window opens, typeÂ
C:\Users\vha3\Pico > code
. This will open Visual Studio Code with all of the correct environment variables set so that the toolchain is correctly configured. - Important reminder: When launching Visual Studio Code, avoid clicking its desktop icon or directly accessing it through the Start Menu. Instead, open it from a Developer Command Prompt Window where the necessary environment variables are already set. This will ensure a smooth and correct configuration of your build environment. To manually configure the environment later, you can adjust the CMake Tools Settings; however, opening VS Code from a Command Prompt Window is the simplest way to get started.
- Click on the Extensions icon in the left-hend toolbar (or typeÂ
Ctrl + Shift + X
) and search for âCMake Toolsâ - Click the âCMake Toolsâ entry in the list, and then click the install button
- Tweak your settings by clicking the spinning gear icon located at the bottom of the navigation panel on the left side of the interface.
- In the Settings pange, click on âExtensionsâ and the âCMake Tools configuration.â
- Scroll down to âCmake: Configure Environmentâ and click on âAdd Itemâ
- Set the Item toÂ
PICO_SDK_PATH
 and set the Value toÂ..\..\pico-sdk
 as shown below
- Scroll down to âCmake: Generatorâ and enter âNMake Makefilesâ into the box.
- Close the Settings panel.
- Navigate toÂ
File > Open Folder
 and navigate to theÂpico-examples
 repo, then hit âOkay.â - You will be prompted to configure the project, as shown below. Click âYesâ and then select âGCC for arm-none-eabiâ for your compiler.
- To start building your projects, click the cog wheel-button labeled âBuildâ situated at the bottom of the window in the blue toolbar. This action will generate a build directory, trigger the CMake process, and then compile the example projects.
- To load an example project onto the Pico, refer to the previous explanation and follow these steps: Within the build directory, select an example project folder and use the drag-and-drop function to transfer it to the Pico.