Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run Command refactoring #2295

Merged
merged 6 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions changelog/changed-run-cmd-structure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The `Run` cmd has been refactored to allow multiple different run modes in the future.
24 changes: 16 additions & 8 deletions probe-rs/src/bin/probe-rs/cmd/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,29 @@ impl core::fmt::Display for ProfileMethod {

impl ProfileCmd {
pub fn run(self, lister: &Lister) -> anyhow::Result<()> {
let (mut session, probe_options) = self.run.probe_options.simple_attach(lister)?;

let loader = build_loader(&mut session, &self.run.path, self.run.format_options)?;

let bytes = std::fs::read(&self.run.path)?;
let (mut session, probe_options) = self
.run
.shared_options
.probe_options
.simple_attach(lister)?;

let loader = build_loader(
&mut session,
&self.run.shared_options.path,
self.run.shared_options.format_options,
)?;

let bytes = std::fs::read(&self.run.shared_options.path)?;
let symbols = Symbols::try_from(&bytes)?;

if self.flash {
run_flash_download(
&mut session,
Path::new(&self.run.path),
&self.run.download_options,
Path::new(&self.run.shared_options.path),
&self.run.shared_options.download_options,
&probe_options,
loader,
self.run.chip_erase,
self.run.shared_options.chip_erase,
)?;
}

Expand Down
Loading