🛠 Pico SDK 2.x sur une carte RP2350 générique : CMake, board header et PICO_BOARD

RP2350 (generic / RP2350-based boards) · intermediaire · Schéma : IMG-rp2350-generic-intermediaire-2-rp2350-sdk2-board-header.svg — éditeur de code avec CMakeLists.txt et un fichier d'en-tête board custom (maquette de brochage), ligne de commande cmake -DPICO_BOARD=..., carte RP2350 générique connectée en USB avec outil picotool

Objectives

The Pico C/C++ SDK (branch 2.x) is the official tool for leveraging the RP2350 in C: GPIO, PIO, HSTX, dual architecture. A known pitfall with generic boards: the master SDK provides pico2/pico2_w headers but no "generic RP2350" header — either your board is supported by a third-party repository that provides its header, or you write your own (pico-sdk README). This tutorial: setting up a clean CMake project, targeting PICO_BOARD=pico2 for a Pico-2 compatible board, and creating a minimal board header for an exotic module.

Hardware

Full commands

# 1) Toolchain + SDK (Linux ; sous Windows : WSL ou l'installateur officiel)
git clone https://github.com/raspberrypi/pico-sdk.git --branch master
export PICO_SDK_PATH=$PWD/pico-sdk

# 2) Projet minimal
mkdir clignot && cd clignot
cat > CMakeLists.txt <<'EOF'
cmake_minimum_required(VERSION 3.13)
include($ENV{PICO_SDK_PATH}/pico_sdk_init.cmake)
project(clignot C CXX ASM)
pico_sdk_init
add_executable(clignot main.c)
target_link_libraries(clignot pico_stdlib)
pico_add_extra_executables(clignot)   # génère .uf2
EOF

cat > main.c <<'EOF'
#include "pico/stdlib.h"
#define LED 25
int main(void) {
    stdio_init_all;
    gpio_init(LED); gpio_set_dir(LED, GPIO_OUT);
    for (;;) { gpio_put(LED, !gpio_get(LED)); sleep_ms(250); }
}
EOF

# 3) Configurer pour une carte compatible Pico 2, puis compiler
mkdir build && cd build
cmake -DPICO_BOARD=pico2 ..
make -j
picotool info clignot.uf2      # affiche le nom de board embarqué

Custom board header (generic module)

Copy pico-sdk/src/boards/include/boards/pico2.h to mes_boards/generic_rp2350.h, then adjust it to YOUR board's pinout: #define NUM_BANK0_GPIOS 30 (RP2350A) or 48 (RP2350B), the LED pin, the 12 MHz oscillator, and pass the header directory to CMake with -DPICO_BOARD=generic_rp2350 and the board header search variable.

Expected verification

make produces clignot.uf2; picotool info displays "Program information" with the board pico2. Drop the UF2 in BOOTSEL mode: the LED blinks. The same binary works on any board with a Pico-2 pinout (PicoPlus2, Tiny2350, etc.) since compatibility is at the board/SDK level, not silicon — the RP2350's QFN-60/80 package is not even pin-compatible with the RP2040's QFN-56.

Common errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials