This template is intended as a starting point for developing firmware based on the rp2040-hal.
-
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.
-
A
probe-rs
compatible probe
You can use a second Pico as a CMSIS-DAP debug probe. Details on other supported debug probes can be found in debug_probes.md
rustup target install thumbv6m-none-eabi
cargo install flip-link
# Installs the probe-rs tools
cargo install probe-rs --features=cli --locked
For a debug build
cargo build
For a release build
cargo build --release
To compile debug build and flash you can run
cargo flash
For a release build
cargo flash --release
See the cargo-flash
tool docs page for more information.
To compile, flash device and start configuration specified in Embed.toml run
cargo embed
By default it runs with RTT logging and debugging session after flashing, so you can attach with gdb
on port 1337. Logging level is debug
by default, but you can override this with DEFMT_LOG
environment variable or specify it right in .cargo/config.toml
[env]
DEFMT_LOG = "off"
You can find all the settings for Embed.toml and their meanings in the probe-rs repo
See the cargo-embed
tool docs page for more information.
The second-stage boot loader must be written to the .boot2 section. That is usually handled by the board support package (e.g.rp-pico
). If you don't use one, you should initialize the boot loader manually. This can be done by adding the following to the beginning of main.rs:
use rp2040_boot2;
#[link_section = ".boot2"]
#[used]
pub static BOOT_LOADER: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
Highly inspired by https://github.com/rp-rs/rp2040-project-template