Skip to content

Commit

Permalink
Duplicate probe-rs to explain debug probes
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Feb 13, 2025
1 parent 09dcf96 commit f0cbde4
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 14 deletions.
33 changes: 23 additions & 10 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,20 +435,24 @@ fn process_options(template: &Template, args: &Args) {
let mut success = true;
for option in &args.option {
// Find the matching option in OPTIONS
if let Some(option_item) = template.options.iter().find(|item| item.name() == *option) {
// Check if the chip is supported. If the chip list is empty,
// all chips are supported:
let mut option_found = false;
let mut option_found_for_chip = false;
for option_item in template
.options
.iter()
.filter(|item| item.name() == *option)
{
option_found = true;
// Check if the chip is supported. If the chip list is empty, all chips are supported.
// We don't immediately fail in case the option is present for the chip, but as a
// separate entry (e.g. with different properties).
if !option_item.chips().iter().any(|chip| chip == &args.chip)
&& !option_item.chips().is_empty()
{
log::error!(
"Option '{}' is not supported for chip {}",
option,
args.chip
);
success = false;
continue;
}

option_found_for_chip = true;
if !option_item
.requires()
.iter()
Expand All @@ -461,9 +465,18 @@ fn process_options(template: &Template, args: &Args) {
);
success = false;
}
} else {
}

if !option_found {
log::error!("Unknown option '{}'", option);
success = false;
} else if !option_found_for_chip {
log::error!(
"Option '{}' is not supported for chip {}",
option,
args.chip
);
success = false;
}
}

Expand Down
26 changes: 22 additions & 4 deletions template/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,28 @@ options:
- !Option
name: probe-rs
display_name: Use probe-rs to flash and monitor instead of espflash.
help: "espflash uses a serial connection (UART) for programming and logging.\nprobe-rs is a
debugger that connects to the chips over JTAG. It can be used to flash and monitor, and
it can also be used to interactively debug an application, or run tests on the hardware.
Semihosting or RTT-based technologies like defmt-rtt require probe-rs."
help: probe-rs is a debugger that connects to the chips over JTAG. It can be used to flash and
monitor, and it can also be used to interactively debug an application, or run tests on the
hardware. Semihosting or RTT-based technologies like defmt-rtt require probe-rs.
chips:
- esp32c6
- esp32h2
- esp32s3

- !Option
name: probe-rs
display_name: Use probe-rs to flash and monitor instead of espflash.
help: probe-rs is a debugger that connects to the chips over JTAG. It can be used to flash and
monitor, and it can also be used to interactively debug an application, or run tests on the
hardware. Semihosting or RTT-based technologies like defmt-rtt require probe-rs.

probe-rs requires a debug probe like esp-prog, and will not work with USB-UART adapters that
often come on development boards.
chips:
- esp32
- esp32s2
- esp32c2
- esp32c3

- !Category
name: flashing-probe-rs
Expand Down

0 comments on commit f0cbde4

Please sign in to comment.