This template is intended as a starting point for writing your own firmware based on the embassy libraries for the rp2040 w/ the CYW43 wireless module (rPi PicoW)
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-rs in SWD mode is configured as the default runner, so you can run your binary 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.
-
(by default) A
probe-rsinstallation -
A
probe-rscompatible probe
rustup target install thumbv6m-none-eabi
cargo install flip-link
# Installs the probe-rs tools, including probe-rs run, our recommended default runner
cargo install --locked probe-rs-tools
# If you want to use elf2uf2-rs instead, do...
cargo install --locked elf2uf2-rsIf you get the error binary `cargo-embed` already exists during installation of probe-rs, run cargo uninstall cargo-embed to uninstall your older version of cargo-embed before trying again.
For a debug build
cargo runFor a release build
cargo run --releaseIf 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 runIf you wish you use the on-board LED or the WiFi/BT module you will need to flash the module firmware.
NOTE: By default firmware is placed at the 1MiB mark in ROM
For WiFi + Bluetooth firmware
./flashwb.shFor a WiFi only install (update base addresses in main.rs)
./flashw.shThe Code in main.rs is expecting the firmware at these locations by default.
const WIFI_FIRMWARE_BASE: u32 = 0x1010_0000;
const BT_FIRMWARE_BASE: u32 = 0x1014_0000;
const CLM_FIRMWARE_BASE: u32 = 0x1014_4000;or
const WIFI_FIRMWARE_BASE: u32 = 0x1010_0000;
const CLM_FIRMWARE_BASE: u32 = 0x1014_0000;