Rust challenge 53/100 - running rust on pi-pico
Table of content
What is this
The rules of the game are explained in my original.
53rd Challenge
Challenge
Run hello world on a pi pico using rust.
Solution
Start from a template
cargo generate \
--git https://github.com/rp-rs/rp2040-project-template \
--branch main \
--name pi-pico-helloworld
The template, looks like this, when running tree -L 3
.
├── CODE_OF_CONDUCT.md
├── Cargo.lock
├── Cargo.toml
├── Embed.toml
├── README.md
├── build.rs
├── debug_probes.md
├── memory.x
├── src
│ └── main.rs
└── target
├── CACHEDIR.TAG
├── release
│ ├── build
│ ├── deps
│ ├── examples
│ └── incremental
└── thumbv6m-none-eabi
├── CACHEDIR.TAG
└── release
There are a number of runners described in the example. Lets keep it simple and use UF2. We hold the reset button on the pico and plug it into the computer so it is in boot mode.
Then we change our .cargo/config
so the runner says runner = "elf2uf2-rs -d
. Its already in the file, just need to uncomment it. We will reduce the blinky example even more, to just “hello world”.
Thats it, with cargo run --release
the program is flashed :). See the repo on github