This template is intended as a starting point for developing rp-pico based application using the cortex-m-rtic crate. It is based on this rp2040 template and this rtic example.
It does the following:
- Blinks the rp-pico on-board led (GPIO 25) using a timer
- Processes a interrupt when GPIO 17 is pulled low (e.g with a push button)
It includes all of the knurling-rs
tooling as showcased in https://github.com/knurling-rs/app-template (defmt
, defmt-rtt
, panic-probe
, flip-link
) to make development as easy as possible.
probe-run
is configured as the default runner, so you can start the program with
cargo run --release
-
The standard Rust tooling (cargo, rustup) which you can install from https://rustup.rs/
-
Toolchain support for the cortex-m0+ processors in the rp2040 (thumbv6m-none-eabi)
-
flip-link - this allows you to detect stack-overflows on the first core, which is the only supported target for now.
-
probe-run. Upstream support for RP2040 was added with version 0.3.1.
-
A CMSIS-DAP probe. (J-Link and other probes will not work with probe-run)
You can use a second Pico as a CMSIS-DAP debug probe by installing either of the following firmware on it:
https://github.com/majbthrd/DapperMime/releases/download/20210225/raspberry_pi_pico-DapperMime.uf2
https://raw.githubusercontent.com/9names/binary-bits/main/rust-dap-pico-ramexec-setclock.uf2
More details on supported debug probes can be found in debug_probes.md
rustup target install thumbv6m-none-eabi
cargo install flip-link
# Suggested default 'runner'
cargo install probe-run
# If you want to use elf2uf2-rs instead of probe-run, instead do...
cargo install elf2uf2-rs --locked
For a debug build
cargo run
For a release build
cargo run --release
If you do not specify a DEFMT_LOG level, it will be set to debug
.
That means println!("")
, info!("")
and debug!("")
statements will be printed.
If you wish to override this, you can change it in .cargo/config.toml
[env]
DEFMT_LOG = "off"
You can also set this inline (on Linux/MacOS)
DEFMT_LOG=trace cargo run
or set the environment variable so that it applies to every cargo run
call that follows:
export DEFMT_LOG=trace
Setting the DEFMT_LOG level for the current session
for bash
export DEFMT_LOG=trace
Windows users can only override DEFMT_LOG through config.toml
or by setting the environment variable as a separate step before calling cargo run
- cmd
set DEFMT_LOG=trace
- powershell
$Env:DEFMT_LOG = trace
cargo run