Skip to content
/ PicoTemplate Public template

Template to allow for easier creation of Raspberry Pi Pico C++ projects

License

Notifications You must be signed in to change notification settings

NevynUK/PicoTemplate

Repository files navigation

PicoTemplate

Main Branch

This repository contains a template Raspberry Pi Pico project along with some shell scripts to build the project. The default applications (both Pico and Pico W) perform the same actions:

  • Configure standard output to be sent over USB
  • Blink the on board LED

Prerequisites

It is assumed that the Pico SDK is installed along with OpenOCD for the Raspberry Pi Pico. The SDK and OpenOCD should be installed at the same level in order for the flash scripts to be used unmodified. So the directory structure should look something link:

| Pi-Pico
+--- Pico-SDK
+--- OpenOCD

where PICO_SDK_PATH has been set to Pi-Pico/Pico-SDK

Instructions for the installation of the Pico SDK and OpenOCD can be found in the Getting started with Raspberry Pi Pico.

Configuring the Project

By default, the system is configured with a simple GPIO example and will generate an application called projectname. The first step is to configure the system and select a name for your project using the configure.sh script. Execute the following command changing MyProject to the name of your application using the repository default board type (Pico):

./configure.sh --name=MyProject

It is possible to change the board type using the -b or --board option:

./configure.sh --name=MyProject --board=picow

Two board types are supported:

  • pico
  • picow

Building the Application

The application can be built by executing the command ./build.sh. At the end of the process you will find that the build directory contains the ELF and UF2 files for your application.

You can also force the system to be fully rebuilt by executing the command ./build.sh --rebuild.

Docker

The system also supports building the system using a Docker container. Two scripts are provided to support this:

  • docker-build.sh
  • docker-run.sh

docker-build.sh

This file contains the command to build the docker container called pico-build. This contains all of the assets needed to build a Pico project including the Pico SDK.

docker-run.sh

This file starts the docker container in interactive mode, from there the system can be configured and built using the configure.sh and build.sh scripts.

Flash the Board

The application binary can be written to the board using the flash.sh script. This will use the openocd application to write the compiled code to the Pico using a Pico set up as a debug probe.

Debugging

Debugging support is available through VS Code. The build script can build a debug version of the code using the command build.sh --debug. This configuration can be used when using VS Code as a debug environment. For more information on the background see:

Acknowledgements

This repository has been inspired by several others on github:

Raspberry Pi Pico Examples Raspberry Pi Pico Template

About

Template to allow for easier creation of Raspberry Pi Pico C++ projects

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published