- Rust🦀
- Embassy-Rust
- probe-rs → If you use Debug Probe
- elf2uf2
git clone
this repository with this command:git clone --recurse-submodules https://github.com/tutla53/rp2040.git
- If you didn't use a
--recursive
git clone, then you need to make sure thatembassy-rs
is fetched now. From the top level apply one of:git submodule update --init --recursive # First time git submodule update --recursive # Subsequent
Move to the Project Directory template
:
cd rp2040-rust/template/
Run this following command to add the build target:
rustup target add thumbv6m-none-eabi
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/probe-rs/probe-rs/releases/latest/download/probe-rs-tools-installer.sh | sh
Make sure that you didn’t accidentally run cargo add probe-rs (which adds it as a dependency) instead of correctly installing probe-rs |
sudo apt install -y pkg-config libusb-1.0-0-dev libftdi1-dev && sudo apt-get install libudev-dev
cargo install elf2uf2-rs
cargo build --release
Please select one of the runner on the .cargo/config.toml
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
runner = "probe-rs run --chip RP2040" # Directly Flash with Debug Probe
runner = "elf2uf2-rs -d" # Automatic deployment to a mounted Pico
runner = "elf2uf2-rs" # Only create uf2 file and can be flashed to pico by pressing the bootsel button
The run the following code:
cargo run --release
The compiled elf
and uf2
file will be in the target/thumbv6m-none-eabi/release/rp2040-template
You can run the example from the embassy-rs which located at src/bin
by using this following command:
cargo run --bin {project_name} --release
cargo run --bin blinky --release # Example to run blinky.rs
.
├── main.rs ├──
├── builder
│ ├── mod.rs
│ ├── servo_builder.rs
│ └── servo_pio_builder.rs
├── resources
│ ├── gpio_list.rs
│ └── mod.rs
└── tasks
├── fade.rs
├── mod.rs
├── servo_pio.rs
└── servo.rs