# 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 ``` 2. Call CMake to generate NMake project `cmake -DPICO_SDK_PATH= -G "NMake Makefiles" ..` 3. Run build with `nmake` ## 2b. Build project using GNU GCC toolchain 1. Construct build directory ``` mkdir build cd build ``` 2. Call CMake to generate MinGW project `cmake -DPICO_SDK_PATH= -G "MinGW Makefiles" ..` 3. Run build with `make` or `cmake -build .` # Debugging VSCode launch configuration are currently setup to support this debug probe: ## Debug using SEGGER j-link 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)