Skip to main content

rp2040 Rust Template


The fastest way to write rust for the pi pico. I made this template to save time when creating embedded rust projects. It comes with everything needed to get started: The libraries, the cargo config and the build instructions. On top of that, the readme includes the commands you’ll need to run if you’ve never done embedded before.

To use the template, you just have to pass it to cargo generate:

cargo generate gl:slusheea/rp2040-template

cargo-generate will walk you through creating a project for your specific developent board and your preferred tools.

The current supported configurations are

  • RP Pico with USB flashing and rp_hal
  • RP Pico with probe flashing and rp_hal
  • RP Pico with probe flashing and embassy
  • XIAO RP2040 with USB flashing and rp2040_hal

Depending on what configuration you use, the commands you’ll need to run to build and flash your code are different. That’s why i would recommend using the included justfile. It includes build, flash, debug and clippy.

I created the rp2040-hal templates before the rp-rs team created an official one. But now that there’s an official one, I still use mine. The official one has support for many other rp2040 dev boards, so it needs some pre-configuring to make it work with the pi pico. So I’ve updated mine to use their template with some preconfigured options.

Check out the project on gitlab: