1
0
2025-03-24 19:29:54 +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
2022-12-10 15:35:39 +01:00
2022-12-10 15:35:39 +01:00
2025-03-24 19:29:54 +01:00
2023-01-05 18:24:11 +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 https://github.com/raspberrypi/pico-sdk.git
  2. Fetch dependancies modules git submodule init && git submodule update

2a. Build project using NMake toolchain

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

2b. Build project using GNU GCC toolchain

  1. Construct build directory
mkdir build
cd build
  1. Call CMake to generate MinGW project cmake -DPICO_SDK_PATH=<previous path> -G "MinGW 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: v1.4.0
  • CMake: 1.35.1
  • ARM GNU GCC: 11.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 95 MiB
2025-03-24 19:40:02 +01:00
Languages
CMake 97.5%
C 2.5%