Building the Firmware
This guide provides detailed instructions for compiling the Debug Probe firmware from the source code. You will need a development environment set up for Raspberry Pi Pico projects.
Prerequisites
Before you begin, ensure you have the following tools installed on your system:
- Git: For cloning the repository.
- CMake: The build system used by the project.
- ARM GCC Toolchain: The compiler for ARM Cortex-M microcontrollers.
- Pico SDK: The official SDK for the RP2040 microcontroller.
If you haven't set up a Pico development environment before, please follow the official Getting Started with Raspberry Pi Pico guide for your operating system.
1. Clone the Repository
First, clone the debugprobe repository and its submodules. The submodules include necessary dependencies like FreeRTOS and the CMSIS-DAP source.
git clone https://github.com/raspberrypi/debugprobe.git
cd debugprobe
git submodule update --init --recursive
2. Set Up the Build Directory
It's standard practice to create a separate build directory to keep the compiled files separate from the source code.
mkdir build
cd build
3. Configure the Build with CMake
Run cmake to configure the project. You must point cmake to the location of your Pico SDK installation by setting the PICO_SDK_PATH environment variable.
# Ensure PICO_SDK_PATH is set
export PICO_SDK_PATH=/path/to/pico-sdk
# Configure the build
cmake ..
You can also pass the path directly to the cmake command:
cmake -DPICO_SDK_PATH=/path/to/pico-sdk ..
Building for Different Hardware
The firmware can be compiled for different hardware targets by passing specific options to cmake.
For the Official Raspberry Pi Debug Probe (Default)
No special flags are needed. The default build targets the official Debug Probe hardware.
cmake ..
For a Raspberry Pi Pico
To build the version that runs on a standard Raspberry Pi Pico, use the DEBUG_ON_PICO=ON flag.
cmake -DDEBUG_ON_PICO=ON ..
This will create a firmware file named debugprobe_on_pico.uf2.
For a Raspberry Pi Pico 2
Building for the RP2350-based Pico 2 requires a few more flags. First, ensure your Pico SDK is version 2.0.0 or greater. Before running CMake, you may need to sync submodules:
# Run from the root of the debugprobe repository
git submodule sync
git submodule update --init --recursive
Then, configure the build with the appropriate flags. It's best to use a separate build directory.
# From the root of the debugprobe repository
mkdir build-pico2
cd build-pico2
cmake -DDEBUG_ON_PICO=1 -DPICO_BOARD=pico2 -DPICO_PLATFORM=rp2350 ..
This will create a firmware file named debugprobe_on_pico2.uf2.
4. Compile the Code
Once CMake has configured the project, run make to compile the firmware.
make
The build process may take a minute. When it's complete, you will find the .uf2 firmware file in the build directory.
- For the default Debug Probe build:
debugprobe.uf2 - For the Pico build:
debugprobe_on_pico.uf2 - For the Pico 2 build:
debugprobe_on_pico2.uf2
This .uf2 file is now ready to be flashed onto your hardware. See the Quick Start Guide for flashing instructions.