1
0
2026-01-15 19:12:38 +01:00
2025-03-24 19:29:54 +01:00
2022-12-10 15:35:39 +01:00
2022-12-10 15:35:39 +01:00
2026-01-15 11:47:15 +01:00
2022-12-10 15:35:39 +01:00
2022-12-10 15:35:39 +01:00
2025-03-24 19:29:54 +01:00
2026-01-15 19:12:38 +01:00

RP2040 - CMake project template

A simple template for RP2040/Pico project using CMake and VSCode IDE. Contains updated docs in PDF format.

Setup

1. Fetch SDK and dependancies from GitHub

  1. Clone SDK from github git clone -b rp2040 https://github.com/raspberrypi/pico-sdk.git
  2. Fetch dependancies modules git submodule init && git submodule update

2a. Build project using NMake toolchain (Windows)

  1. Construct build directory
mkdir build
cd build
  1. Call CMake to generate NMake project cmake.exe -DPICO_SDK_PATH=<previous path> -G "NMake Makefiles" ..
  2. Run build with nmake.exe or cmake.exe -build .

2b. Build project using GNU GCC toolchain (linux-like system)

  1. Construct build directory
mkdir build
cd build
  1. Call CMake to generate project cmake -DPICO_SDK_PATH=<previous path> -G "Unix Makefiles" ..
  2. Run build with make or cmake -build .

Debugging

VSCode launch configuration are currently setup to support this debug probe:

J-link tools need to be installed on the computer and accessible in PATH in order to work. If needed, you can adapt the line "serverpath": "C:/Program Files/SEGGER/JLink_V782d/JLinkGDBServerCL.exe" in accordance with your system configuration.

Debug using RPi-Pico with Picoprobe firmware

OpenOCD should be installed or compiled on your system in order to work. One pico probe should be equipped with Picoprobe firmware (https://github.com/raspberrypi/picoprobe) and connected to the target RP2040 as the following diagram:

No more configuration is needed.

Debug using Black Magic Probe

No more tool is needed. You can configure the GDB server port through "BMPGDBSerialPort": "\\\\.\\COM20". Be aware of the Windows specific syntax of COM port, 1 to 9 is simply COM1-9, but from COM10 you need to preceed it with \\.\COMx.

Tools version

  • Pico SDK: v2.2.0
  • CMake: 3.28.3
  • ARM GNU GCC: 14.2
  • MSVC: v143
  • VSCode: 1.74+ with Cortex-Debug (marus25.cortex-debug), PIO ASM (chris-hock.pioasm) and CMake-Tools (ms-vscode.cmake-tools)
Description
RPi Pico (RP2040/2350) VSCode/CMake template project
Readme 102 MiB
2026-01-15 19:15:58 +01:00
Languages
CMake 97.5%
C 2.5%