← Back to list

Hello Rust’y Pico — Part 1: Setting Up Embedded Rust

Building your first Raspberry Pi Pico application with a Debug Probe

A. Bastião · 2026-07-10 22:25 · 2 claps · 3.3 min read
#rust #rust-programming-language #raspberry-pi #raspberry-pi-pico #embedded-systems
Open on Medium ↗
Wiki topics: 💻 · Programming 📟 · Gadgets & IoT

Hello Rust’y Pico — Part 1: Setting Up Embedded Rust

Artwork: Generated with ChatGPT (GPT-5.5 image generation) from a custom prompt and refined iteratively by the author to match the theme of the series.

Artwork: Generated with ChatGPT (GPT-5.5 image generation) from a custom prompt and refined iteratively by the author to match the theme of the series.

Building your first Raspberry Pi Pico application with a Debug Probe

Rust has become an increasingly popular language for systems programming, offering memory safety without a garbage collector and a modern developer experience. If you’re anything like me and enjoy building DIY electronics, robots, or embedded devices, the Raspberry Pi Pico is an excellent board to explore those ideas.

In this first article of the Hello Rust’y Pico series, we’ll build a simple Rust application for the Raspberry Pi Pico and, just as importantly, set up one of every developer’s favourite activities: debugging.

Instead of relying on an IDE extension we’ll build our development environment around standard Rust tools and the command line. This approach keeps the project editor-independent, making it easy to use Zed, VS Code, or any editor you prefer.

By the end of this article, you’ll have a working Rust development environment, a Raspberry Pi Pico running your first program, and a Debug Probe ready to help you understand what your code is doing instead of simply hoping it works.

Let’s get started.

Note: I’ll be using Zed together with the Starship prompt. They’re not required for this series, and they’ve become my preferred tools for Rust development thanks to their speed and simplicity.

Before writing our first line of embedded Rust code, we need to install the Rust toolchain.

If you already have Rust installed, you can skip this step. Otherwise, open a terminal and run:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Once the installation finishes, verify that everything is working correctly:

rustc --version
cargo --version

If both commands print a version number, you’re ready to move on to the next step.

Installing the ARM Toolchain

Since the Raspberry Pi Pico uses an Arm Cortex-M0+ microcontroller, we first need to install the Rust target that allows us to cross-compile our application.

rustup target add thumbv6m-none-eabi

Creating the Project

Rather than starting with an empty Cargo project, we’ll generate a project from the official template. It already contains the configuration needed for the Raspberry Pi Pico, allowing us to focus on learning Embedded Rust instead of project setup.

First, install cargo-generate:

cargo install cargo-generate

Then generate the project:

cargo generate \
  --git https://github.com/rp-rs/rp2040-project-template \
  --name hello_pico

During the interactive setup, select flashing method: probe-rs

Flashing method promt

Flashing method promt

Protecting Against Stack Overflows

Embedded systems don’t have the same memory protection as desktop operating systems. A stack overflow can silently corrupt memory and lead to very confusing bugs.

The flip-link tool rearranges the program's memory layout so that stack overflows are detected much earlier during development.

cargo install flip-link

What is a stack overflow?

Every function call uses a small amount of stack memory. If your program consumes more stack than is available, it starts overwriting other parts of memory. flip-link helps catch these bugs instead of letting them fail silently.

Installing the Flashing and Debugging Tools

We’ll use probe-rs to flash the firmware onto the Raspberry Pi Pico and communicate with the Debug Probe.

Install the tools with:

cargo install --locked probe-rs-tools

Building the Project

Move into the generated project and build it:

cd hello_pico
cargo build

The first build downloads and compiles all required dependencies, so it may take a few minutes.

If everything is configured correctly, Cargo should finish without any errors.

Connecting the Hardware

Connect the Raspberry Pi Pico to the Raspberry Pi Debug Probe and then connect the Debug Probe to your development machine.

Raspberry Pi Pico H connected to a Raspberry Pi Debug Probe

Raspberry Pi Pico H connected to a Raspberry Pi Debug Probe

Tip

If your Pico already contains another application, hold the BOOTSEL button while connecting the USB cable to enter USB bootloader mode. For normal Debug Probe flashing, this is usually not required, but it can help recover a board if something goes wrong.

Running The Application

Flash the firmware and immediately start it:

cargo run

If everything is working, you should see the onboard LED blinking while probe-rs displays the RTT log:

Congratulations! You have successfully built, flashed, and executed your first Embedded Rust application on the Raspberry Pi Pico.

Source Code

The source code for this project is available on GitHub:

[hello-pico]


메타데이터
post_id
37c67e3f49ff
slug
hello-rusty-pico-part-1-setting-up-embedded-rust-37c67e3f49ff
url
https://medium.com/@antonio.dias.bastiao/hello-rusty-pico-part-1-setting-up-embedded-rust-37c67e3f49ff
canonical_url
https://medium.com/@antonio.dias.bastiao/hello-rusty-pico-part-1-setting-up-embedded-rust-37c67e3f49ff
author_url
https://medium.com/@antonio.dias.bastiao
status
ok
fetched_at
2026-07-13 06:23:13