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

Commit

Permalink
Merge #378
Browse files Browse the repository at this point in the history
378: Update to `probe-rs v0.16` r=Urhengulas a=Urhengulas



Co-authored-by: Urhengulas <[email protected]>
  • Loading branch information
bors[bot] and Urhengulas authored Feb 7, 2023
2 parents 80ab018 + 1da5532 commit 19a5e5f
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 50 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ jobs:
- name: Install C libraries for tooling
run: sudo apt-get update && sudo apt-get install libudev-dev libusb-1.0-0-dev

- run: cargo fmt -- --check
- run: cargo clippy -- -D warnings
- run: cargo fmt --check
- run: cargo clippy --all-targets -- -D warnings

# Refs: https://github.com/rust-lang/crater/blob/9ab6f9697c901c4a44025cf0a39b73ad5b37d198/.github/workflows/bors.yml#L125-L149
# bors.tech integration
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

## [Unreleased]

- [#378] Update to `probe-rs v0.16`

[#378]: https://github.com/knurling-rs/probe-run/pull/378

## [v0.3.6] - 2023-01-23

- [#375] Release `probe-run v0.3.6`
- [#373] Update probe-rs to v0.14
- [#373] Update to `probe-rs v0.14`
- [#371] Add "missing drivers" to troubleshooting section
- [#366] Update CI

Expand Down
37 changes: 12 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ gimli = { version = "0.27", default-features = false }
git-version = "0.3"
log = "0.4"
object = { version = "0.30", default-features = false }
probe-rs = "0.14.1"
probe-rs-rtt = "0.14.1"
probe-rs = "0.16"
signal-hook = "0.3"

[dev-dependencies]
Expand Down
8 changes: 4 additions & 4 deletions src/backtrace/pp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn backtrace(frames: &[Frame], settings: &Settings) -> io::Result<()> {
.map(|location| location.path_is_relative)
.unwrap_or(false);

let mut line = format!("{:>4}:", frame_index);
let mut line = format!("{frame_index:>4}:");
if settings.include_addresses || subroutine.name.is_none() {
write!(line, " {:#010x} @", subroutine.pc).unwrap();
}
Expand All @@ -44,7 +44,7 @@ pub fn backtrace(frames: &[Frame], settings: &Settings) -> io::Result<()> {
} else {
line.normal()
};
writeln!(stderr, "{}", colorized_line)?;
writeln!(stderr, "{colorized_line}")?;

if let Some(location) = &subroutine.location {
let dep_path = dep::Path::from_std_path(&location.path);
Expand All @@ -58,10 +58,10 @@ pub fn backtrace(frames: &[Frame], settings: &Settings) -> io::Result<()> {
let line = location.line;
let column = location
.column
.map(|column| Cow::Owned(format!(":{}", column)))
.map(|column| Cow::Owned(format!(":{column}")))
.unwrap_or(Cow::Borrowed(""));

writeln!(stderr, " at {}:{}{}", path, line, column)?;
writeln!(stderr, " at {path}:{line}{column}")?;
}

frame_index += 1;
Expand Down
4 changes: 2 additions & 2 deletions src/backtrace/unwind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ use crate::{
};

fn missing_debug_info(pc: u32) -> String {
format!("debug information for address {:#x} is missing. Likely fixes:
format!("debug information for address {pc:#x} is missing. Likely fixes:
1. compile the Rust code with `debug = 1` or higher. This is configured in the `profile.{{release,bench}}` sections of Cargo.toml (`profile.{{dev,test}}` default to `debug = 2`)
2. use a recent version of the `cortex-m` crates (e.g. cortex-m 0.6.3 or newer). Check versions in Cargo.lock
3. if linking to C code, compile the C code with the `-g` flag", pc)
3. if linking to C code, compile the C code with the `-g` flag")
}

/// Virtually* unwinds the target's program
Expand Down
5 changes: 1 addition & 4 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,7 @@ fn print_version() {
// Extract the "abbreviated object name"
let hash = extract_git_hash(GIT_DESCRIBE);

println!(
"{} {}\nsupported defmt version: {}",
VERSION, hash, DEFMT_VERSION
);
println!("{VERSION} {hash}\nsupported defmt version: {DEFMT_VERSION}");
}

/// Extract git hash from a `git describe` statement
Expand Down
2 changes: 1 addition & 1 deletion src/dep/rust_std/toolchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl<'p> One52<'p> {
Channel::Beta => "beta".into(),
Channel::Nightly { date } => {
if let Some(date) = date {
format!("nightly-{}", date).into()
format!("nightly-{date}").into()
} else {
"nightly".into()
}
Expand Down
10 changes: 5 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ use defmt_decoder::{DecodeError, Frame, Locations, StreamDecoder};
use probe_rs::{
config::MemoryRegion,
flashing::{self, Format},
rtt::{Rtt, ScanRegion, UpChannel},
Core,
DebugProbeError::ProbeSpecific,
MemoryInterface as _, Permissions, Session,
};
use probe_rs_rtt::{Rtt, ScanRegion, UpChannel};
use signal_hook::consts::signal;

use crate::{backtrace::Outcome, canary::Canary, elf::Elf, target_info::TargetInfo};
Expand Down Expand Up @@ -125,7 +125,7 @@ fn run_target_program(elf_path: &Path, chip_name: &str, opts: &cli::Opts) -> any

let mut options = flashing::DownloadOptions::default();
options.dry_run = false;
options.progress = Some(&fp);
options.progress = Some(fp);
options.disable_double_buffering = opts.disable_double_buffering;
options.verify = opts.verify;

Expand Down Expand Up @@ -285,7 +285,7 @@ fn extract_and_print_logs(
let num_bytes_read = match logging_channel.read(core, &mut read_buf) {
Ok(n) => n,
Err(e) => {
eprintln!("RTT error: {}", e);
eprintln!("RTT error: {e}");
break;
}
};
Expand Down Expand Up @@ -417,7 +417,7 @@ fn setup_logging_channel(
return Ok(channel);
}

Err(probe_rs_rtt::Error::ControlBlockNotFound) => {
Err(probe_rs::rtt::Error::ControlBlockNotFound) => {
log::trace!("Could not attach because the target's RTT control block isn't initialized (yet). retrying");
}

Expand All @@ -428,7 +428,7 @@ fn setup_logging_channel(
}

log::error!("Max number of RTT attach retries exceeded.");
Err(anyhow!(probe_rs_rtt::Error::ControlBlockNotFound))
Err(anyhow!(probe_rs::rtt::Error::ControlBlockNotFound))
}

/// Print a line to separate different execution stages.
Expand Down
4 changes: 2 additions & 2 deletions src/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ pub fn print(probes: &[DebugProbeInfo]) {
probes
.iter()
.enumerate()
.for_each(|(num, link)| println!("[{}]: {:?}", num, link));
.for_each(|(num, link)| println!("[{num}]: {link:?}"));
} else {
println!("Error: {}", NO_PROBE_FOUND_ERR);
println!("Error: {NO_PROBE_FOUND_ERR}");
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ fn truncate_output(probe_run_output: String) -> String {
// https://github.com/knurling-rs/probe-run/issues/217 is resolved
&& !line.starts_with("└─ ")
})
.map(|line| format!("{}\n", line))
.map(|line| format!("{line}\n"))
.collect()
}

Expand Down Expand Up @@ -119,6 +119,6 @@ fn snapshot_test(#[case] args: &str, #[case] success: bool) {
#[cfg(target_family = "unix")]
fn ctrl_c_by_user_is_reported_as_such() {
let run_result = run_and_terminate("silent-loop-rzcobs", 5);
assert_eq!(false, run_result.exit_status.success());
assert!(!run_result.exit_status.success());
insta::assert_snapshot!(run_result.output);
}

0 comments on commit 19a5e5f

Please sign in to comment.