Skip to content

Commit

Permalink
Merge pull request #698 from jannic/probe-rs-migration
Browse files Browse the repository at this point in the history
Replace probe-run by probe-rs
  • Loading branch information
jannic authored Oct 19, 2023
2 parents 9bde6b5 + 6de15d5 commit c4fbc4b
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ runner = "elf2uf2-rs -d"

# This runner will find a supported SWD debug probe and flash your RP2040 over
# SWD:
# runner = "probe-run --chip RP2040"
# runner = "probe-rs run --chip RP2040"
2 changes: 2 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ jobs:
with:
crate: cargo-hack
version: "=0.5.28"
- name: Use older version of regex
run: cargo update -p regex --precise 1.9.3
- name: Verifiy MSRV
run: cargo hack build --examples --optional-deps --each-feature
on-target-build:
Expand Down
25 changes: 11 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ You may also want to install these helpful tools:
# Useful to creating UF2 images for the RP2040 USB Bootloader
cargo install elf2uf2-rs --locked
# Useful for flashing over the SWD pins using a supported JTAG probe
cargo install probe-run
cargo install probe-rs --features cli --locked
```

## Packages
Expand Down Expand Up @@ -171,26 +171,23 @@ file and copy it to your RP2040.
$ cargo run --release --example pwm_blink
```

### Loading with probe-run

The Knurling project has a tool called
[probe-run](https://github.com/knurling-rs/probe-run). This is a command-line
tool which can flash a wide variety of microcontrollers using a wide variety of
debug/JTAG probes. It is based on a library called
[probe-rs](https://github.com/probe-rs/probe-rs). Unlike using, say, OpenOCD,
### Loading with probe-rs
[probe-rs](https://github.com/probe-rs/probe-rs) is a library and a
command-line tool which can flash a wide variety of microcontrollers
using a wide variety of debug/JTAG probes. Unlike using, say, OpenOCD,
probe-rs can autodetect your debug probe, which can make it easier to use.

*Step 1* - Install `probe-run`:
*Step 1* - Install `probe-rs`:

```console
$ cargo install probe-run
$ cargo install probe-rs --features cli --locked
```

*Step 2* - Make sure your .cargo/config contains the following:

```toml
[target.thumbv6m-none-eabi]
runner = "probe-run --chip RP2040"
runner = "probe-rs run --chip RP2040"
```

*Step 3* - Connect your USB JTAG/debug probe (such as a Raspberry Pi Pico
Expand All @@ -199,16 +196,16 @@ programming pins on your RP2040 board. Check the probe has been found by
running:

```console
$ probe-run --list-probes
The following devices were found:
$ probe-rs list
The following debug probes were found:
[0]: J-Link (J-Link) (VID: 1366, PID: 0101, Serial: 000099999999, JLink)
```

There is a SEGGER J-Link connected in the example above - the message you see
will reflect the probe you have connected.

*Step 4* - Use `cargo run`, which will compile the code and start the specified
'runner'. As the 'runner' is the `probe-run` tool, it will connect to the
'runner'. As the 'runner' is the `probe-rs` tool, it will connect to the
RP2040 via the first probe it finds, and install your firmware into the Flash
connected to the RP2040.

Expand Down
2 changes: 1 addition & 1 deletion on-target-tests/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
# we need probe-run to run target tests
# note: this will be overridden by the top-level config.toml
runner = "probe-run --chip RP2040"
runner = "probe-rs run --chip RP2040"

rustflags = [
"-C", "link-arg=-Tdefmt.x",
Expand Down
2 changes: 1 addition & 1 deletion on-target-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ embedded-hal = { version = "0.2.5", features = ["unproven"] }

defmt = "0.3"
defmt-rtt = "0.4"
defmt-test = "0.3"
defmt-test = "0.3.1"
panic-probe = { version = "0.3", features = ["print-defmt"] }

rp2040-hal = { path = "../rp2040-hal", features = [
Expand Down
4 changes: 2 additions & 2 deletions on-target-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Adding a test:
- Add a new [[test]] to the Cargo.toml

Running all tests:
Linux (and any other Unix-likes where probe-run are supported):
Linux (and any other Unix-likes where probe-rs are supported):
```system
./run_tests.sh
```
Expand All @@ -19,7 +19,7 @@ run_tests.bat
To run a specific test (to make developing tests faster)

```system
CARGO_TARGET_THUMBV6M_NONE_EABI_RUNNER=probe-run cargo test --test my_new_test -- --chip rp2040
CARGO_TARGET_THUMBV6M_NONE_EABI_RUNNER="probe-rs run" cargo test --test my_new_test -- --chip rp2040
```

## Prerequisites
Expand Down
2 changes: 1 addition & 1 deletion on-target-tests/run_tests.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@rem Keep running tests even if one of them fails
@rem We need to specify environment variables here to control build since we aren't able to override them in Cargo.toml

@SET CARGO_TARGET_THUMBV6M_NONE_EABI_RUNNER=probe-run
@SET "CARGO_TARGET_THUMBV6M_NONE_EABI_RUNNER=probe-rs run"

cargo test --no-fail-fast -- --chip rp2040
4 changes: 2 additions & 2 deletions on-target-tests/run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

# Keep running tests even if one of them fails
# We need to specify probe-run as our runner via environment variables here
# We need to specify probe-rs as our runner via environment variables here
# to control build since we aren't able to override them in config.toml
CARGO_TARGET_THUMBV6M_NONE_EABI_RUNNER=probe-run cargo test --no-fail-fast -- --chip rp2040
CARGO_TARGET_THUMBV6M_NONE_EABI_RUNNER="probe-rs run" cargo test --no-fail-fast -- --chip rp2040

0 comments on commit c4fbc4b

Please sign in to comment.