/pico_template

Small template project for the Pi Pico

Primary LanguageCMakeMIT LicenseMIT

Pico Template

Simple project for the Pi Pico to serve as template. The application is actually the blink project from pico-examples.

Initial config

Most of the steps are close to the official Getting Started guide. I did not used the pico_setup.sh because I didn't wanted to use VSCode.

For Windows, I used WSL with Debian (Ubuntu should also be fine) and can pretty much follow the official procedure for Linux.

I also decided to use Ninja instead of Make but there should be no differences.

sudo apt update
sudo apt install cmake gcc-arm-none-eabi libnewlib-arm-none-eabi build-essential ninja-build

Then go into this template folder and init all submodules

git submodule update --init --recursive

Generate and Build

Run cmake to generate build files

cmake -Bbuild -G "Ninja"

Go into build directory and build the project

cd build
ninja

The uf2 file will be located in build/src/PicoTemplate.uf2. Simply copy this file to the RPi folder after connecting a usb cable to the Pi Pico while holding the BOOTSEL button.

PicoProbe

Follow instructions to build openocd and install gdb(-multiarch). I can confirm that it works on WSL.

To pass the usb from Windows to linux, use usbipd.

Openocd

sudo src/openocd -f interface/cmsis-dap.cfg -c "adapter speed 5000" -f target/rp2040.cfg -s tcl

GDB

gdb-multiarch src/<application-name>.elf
target remote localhost:3333
load
monitor reset init
continue

Then use gdb commands