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

Add way to pass chip description file #301

Merged
merged 3 commits into from
Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ pub(crate) struct Opts {
#[structopt(long, required_unless_one(&["list-chips", "list-probes", "version"]), env = "PROBE_RUN_CHIP")]
chip: Option<String>,

#[structopt(name = "chip description file path", long = "chip-description-path")]
pub(crate) chip_description_path: Option<PathBuf>,
KOBA789 marked this conversation as resolved.
Show resolved Hide resolved

/// The probe to use (eg. `VID:PID`, `VID:PID:Serial`, or just `Serial`).
#[structopt(long, env = "PROBE_RUN_PROBE")]
pub(crate) probe: Option<String>,
Expand Down
3 changes: 3 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ fn run_target_program(elf_path: &Path, chip_name: &str, opts: &cli::Opts) -> any
let elf_bytes = fs::read(elf_path)?;
let elf = &Elf::parse(&elf_bytes)?;

if let Some(ref cdp) = opts.chip_description_path {
probe_rs::config::add_target_from_yaml(Path::new(cdp))?;
}
KOBA789 marked this conversation as resolved.
Show resolved Hide resolved
let target_info = TargetInfo::new(chip_name, elf)?;

let probe = probe::open(opts)?;
Expand Down