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

Commit

Permalink
Merge #301
Browse files Browse the repository at this point in the history
301: Add way to pass chip description file r=Urhengulas a=KOBA789

Fixes: #291

I need the way to pass my own chip description file to probe-run because my target chip is a original soft processor core implemented on a FPGA.

There are other ideas on #291 but I wrote the simplest implementation for now.

Co-authored-by: Hidekazu Kobayashi <[email protected]>
  • Loading branch information
bors[bot] and KOBA789 authored Feb 22, 2022
2 parents 1772aa5 + c55b39e commit 7f7883d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ pub(crate) struct Opts {
#[structopt(long, required_unless_one(&["list-chips", "list-probes", "version"]), env = "PROBE_RUN_CHIP")]
chip: Option<String>,

/// Path to chip description file, in YAML format.
#[structopt(long)]
pub(crate) chip_description_path: Option<PathBuf>,

/// 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(cdp) = &opts.chip_description_path {
probe_rs::config::add_target_from_yaml(Path::new(cdp))?;
}
let target_info = TargetInfo::new(chip_name, elf)?;

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

0 comments on commit 7f7883d

Please sign in to comment.