Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

add flag / env-var to select the probe by serial number #14

Closed
japaric opened this issue Aug 18, 2020 · 2 comments · Fixed by #49
Closed

add flag / env-var to select the probe by serial number #14

japaric opened this issue Aug 18, 2020 · 2 comments · Fixed by #49
Labels
type: enhancement Enhancement or feature request

Comments

@japaric
Copy link
Member

japaric commented Aug 18, 2020

This is helpful when you want to cargo-run firmware on two or more different devices in parallel.

$ # terminal 1
$ cd path/to/firmware
$ PROBE_RUN_SN=abcdef012345 cargo run --bin radio-tx

$ # terminal 2
$ cd path/to/firmware
$ PROBE_RUN_SN=012345abcdef cargo run --bin radio-rx

In the above case the firmware can live in the same Cargo project.

When the firmware lives in different Cargo projects you can use the flag version.

$ # terminal 1
$ cd path/to/firmware-a
$ head .cargo/config
[target.thumbv7em-none-eabihf]
runner = "probe-run --serial-number abcdef012345 --chip nrf52"

$ cargo run --bin radio-tx

$ # terminal 2
$ cd path/to/firmware-b
$ head .cargo/config
[target.thumbv7em-none-eabihf]
runner = "probe-run --serial-number 012345abcdef --chip nrf52"

$ cargo run --bin radio-rx
@japaric japaric added the type: enhancement Enhancement or feature request label Aug 18, 2020
@japaric
Copy link
Member Author

japaric commented Aug 21, 2020

also while implementing this, make probe-run fail if it finds 2 or more probes and it becomes ambiguous which one to use (no --serial-number flag was passed). (Right now probe-run picks the "first" probe).

@Lotterleben
Copy link

note from @jonas-schievink
Before attaching to a chip, the probe needs to be opened. probe-rs gives us a way to query all connected probes (Probe::list_all), and we currently pick the first one. This is what needs to be changed.

aurelj pushed a commit to aurelj/probe-run that referenced this issue Sep 1, 2020
This provides options similar to cargo-flash to list all connected probes
and to specify which one to use:
  probe-run --list-probes
  probe-run --probe '1366:0101' --chip nrf52 bin
  probe-run --probe '1366:0101:123456' --chip nrf52 bin

This also alows specifying the probe as en env-var:
  PROBE_RUN_PROBE='1366:0101:123456' cargo run

It fixes knurling-rs#14.
aurelj pushed a commit to aurelj/probe-run that referenced this issue Sep 1, 2020
This provides options similar to cargo-flash to list all connected probes
and to specify which one to use:
  probe-run --list-probes
  probe-run --probe '1366:0101' --chip nrf52 bin
  probe-run --probe '1366:0101:123456' --chip nrf52 bin

This also alows specifying the probe as en env-var:
  PROBE_RUN_PROBE='1366:0101:123456' cargo run

It fixes knurling-rs#14.
aurelj pushed a commit to aurelj/probe-run that referenced this issue Sep 2, 2020
This provides options similar to cargo-flash to list all connected probes
and to specify which one to use:
  probe-run --list-probes
  probe-run --probe '1366:0101' --chip nrf52 bin
  probe-run --probe '1366:0101:123456' --chip nrf52 bin

This also alows specifying the probe as en env-var:
  PROBE_RUN_PROBE='1366:0101:123456' cargo run

It fixes knurling-rs#14.
aurelj pushed a commit to aurelj/probe-run that referenced this issue Sep 3, 2020
This provides options similar to cargo-flash to list all connected probes
and to specify which one to use:
  probe-run --list-probes
  probe-run --probe '1366:0101' --chip nrf52 bin
  probe-run --probe '1366:0101:123456' --chip nrf52 bin

This also alows specifying the probe as en env-var:
  PROBE_RUN_PROBE='1366:0101:123456' cargo run

It fixes knurling-rs#14.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: enhancement Enhancement or feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants