Simplify uf2 flashing

This commit is contained in:
Hmvp 2021-07-31 00:20:32 +02:00 committed by 9names
parent 2d1086915c
commit 9d539b0e7d
2 changed files with 11 additions and 10 deletions

View file

@ -9,3 +9,4 @@ rustflags = [
"-C", "inline-threshold=5", "-C", "inline-threshold=5",
"-C", "no-vectorize-loops", "-C", "no-vectorize-loops",
] ]
runner = "elf2uf2-rs -d"

View file

@ -75,22 +75,22 @@ For more examples, please refer to the [Documentation](https://github.com/rp-rs/
### Run examples ### Run examples
Install [`uf2conv`](https://github.com/sajattack/uf2conv-rs) and [`cargo-binutils`](https://github.com/rust-embedded/cargo-binutils) as well as the `llvm-tools-preview` component: #### UF2
For boards with uf2 flashloaders like the raspberry pi pico. Install [`elf2uf2-rs`](https://github.com/JoNil/elf2uf2-rs):
```sh ```sh
cargo install uf2conv cargo-binutils cargo install elf2uf2-rs
rustup component add llvm-tools-preview
``` ```
For boards with uf2 flashloaders you can use the following lines to run the examples: Make sure .cargo/config contains the following (it should by default):
```toml
runner = "elf2uf2-rs -d"
```
```sh ```sh
export RPI_MOUNT_FOLDER=/media/RPI-RP2/ cargo run --example pico_pwm_blink # Run `cargo run --example` for more examples
export EXAMPLE=pico_blinky; # See `cargo check --example` for valid values
cargo check --example $EXAMPLE && \
cargo objcopy --release --example $EXAMPLE -- -O binary target/$EXAMPLE.bin && \
uf2conv target/$EXAMPLE.bin --base 0x10000000 --family 0xe48bff56 --output target/$EXAMPLE.uf2 && \
cp target/$EXAMPLE.uf2 $RPI_MOUNT_FOLDER
``` ```
<!-- ROADMAP --> <!-- ROADMAP -->