Skip to main content

Firmware Development

GP2040-CE is written in C++ and set up as a standard Pico SDK project.

See Getting Started with the Raspberry Pi Pico.

Environment Setup

Most of this will be parroting the above linked PDF from the Raspberry Pi Foundation.

  1. Download and install CMake.

  2. Install NodeJS

  3. Install NPM

  4. Download and install pico-setup-windows-x64-standalone.

  5. Download and install VSCode.

  6. Download and install Windows Terminal.

  7. Open Windows Terminal.

  8. Download the GP2040-CE-main repository by running the following commands in the Windows Terminal. This will download the folder to C:\Users\user\GP2040-CE.

    git clone https://github.com/OpenStickCommunity/GP2040-CE.git
    cd GP2040-CE
    git submodule update --init

After installing the Raspberry Pi Pico SDK, you should now have a shortcut to "Pico-Visual Studio Code" (search for it using Windows Search).

  1. Open "Pico-Visual Studio Code" via Windows search. This is a shortcut with pre-configured environment variables (this will be explained later).
  2. Navigate to the Extensions window by pressing Ctrl+Shift+X.
  3. Install "CMake Tools" by Microsoft.
  4. Open the GP2040-CE folder you downloaded earlier via "File > Open Folder."

Building

Environment Variables

A number of new environment variables have been setup to control parts of the build flow.

NameDefaultDescription
GP2040_BOARDCONFIGPicoThe boards.h config file to use for the build.
SKIP_WEBBUILDFALSEDetermines whether the web configurator is built during the cmake configuration step.
SKIP_SUBMODULESFALSEDetermines whether the submodule init command is run automatically during the cmake configuration step.

SDK Variables

There are a few SDK variables we take advantage of for our builds.

NameDefaultDescription
PICO_BOARDpicoThis is the embedded board that the RP2040 chip is part of. By default, it assumes the Pico. This variable would match the <boardname.h> file in the board's configs folder.

After installing the Raspberry Pi Pico SDK, you should now have a shortcut to "Pico-Visual Studio Code" (search for it using Windows Search). This shortcut should already have everything configured, allowing you to skip to step 7. If you're experiencing compilation issues, consider following the manual steps outlined here.

Ensure the PICO_SDK_PATH environment variable is set:

  1. Search for "Edit environment variables for your account" in Windows.
  2. Under "User Variables," click "New...".
  3. In the dialog that appears, enter PICO_SDK_PATH for the Variable Name.
  4. Click "Browse Directory" and navigate to C:\Program Files\Raspberry Pi\Pico SDK v1.5.1\pico-sdk for the Variable Value.
  5. Create another new variable.
  6. Enter GP2040_BOARDCONFIG for the Variable Name.
  7. Enter Pico (or the name of your edited config folder) for the Variable Value.

You can also set the variable within VSCode:

  1. Press Ctrl + , to open the settings.
  2. Use the search bar to find "CMake."
  3. Scroll until you see "CMake: Configure Environment."
  4. Click "Add Item."
  5. Key: GP2040_BOARDCONFIG
  6. Value: Pico (or your working folder name).

When prompted, choose GCC 10.3.1 ARM NONE EABI for "Select a kit for GP2040-CE"

From inside VSCode:

  1. Click the CMake icon on the left sidebar of VSCode.
  2. You'll see three icons at the top-right corner of the CMake project outline. Click the "Configure All Projects" icon (looks like a page with an arrow).
  3. Wait for the configuration process to complete. If progress isn't visible, open a new terminal in VSCode by clicking on the "Terminal" menu, then "New Terminal". A new terminal window will open at the bottom, navigate the "Output" tab.
  4. Click "Build All Projects" in the CMake project outline.
  5. The files should be in a new folder named "build" inside the GP2040-CE folder