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

Update Embed.toml flashing options #2419

Merged
merged 2 commits into from
May 3, 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/added-embed-config-opts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added `verify` and `disable_double_buffering` options to Embed.toml
1 change: 1 addition & 0 deletions changelog/removed-halt_afterwards.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Removed `halt_afterwards` from Embed.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ protocol = "Swd"
[default.flashing]
# Whether or not the target should be flashed.
enabled = true
# Whether or not the target should be halted after reset.
# DEPRECATED, moved to reset section
halt_afterwards = false
# Whether or not bytes erased but not rewritten with data from the ELF
# should be restored with their contents before erasing.
restore_unwritten_bytes = false
# The path where an SVG of the assembled flash layout should be written to.
# flash_layout_output_path = "out.svg"
# Triggers a full chip erase instead of a page by page erase.
do_chip_erase = false
# Whether to disable double buffering
disable_double_buffering = false
# Whether to verify flash contents after downloading
verify = false

[default.reset]
# Whether or not the target should be reset.
Expand Down
7 changes: 2 additions & 5 deletions probe-rs-tools/src/bin/probe-rs/cmd/cargo_embed/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,11 @@ pub struct Probe {
#[serde(deny_unknown_fields)]
pub struct Flashing {
pub enabled: bool,
#[deprecated(
since = "0.9.0",
note = "The 'halt_afterwards' key has moved to the 'reset' section"
)]
pub halt_afterwards: bool,
pub restore_unwritten_bytes: bool,
pub flash_layout_output_path: Option<String>,
pub do_chip_erase: bool,
pub disable_double_buffering: bool,
pub verify: bool,
}

/// The reset config struct holding all the possible reset options.
Expand Down
13 changes: 3 additions & 10 deletions probe-rs-tools/src/bin/probe-rs/cmd/cargo_embed/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,10 @@ fn main_try(mut args: Vec<OsString>, offset: UtcOffset) -> Result<()> {

let download_options = BinaryDownloadOptions {
disable_progressbars: opt.disable_progressbars,
disable_double_buffering: false,
disable_double_buffering: config.flashing.disable_double_buffering,
restore_unwritten: config.flashing.restore_unwritten_bytes,
flash_layout_output_path: None,
verify: false,
verify: config.flashing.verify,
};
let format_options = FormatOptions::default();
let loader = build_loader(&mut session, path, format_options, image_instr_set)?;
Expand All @@ -263,14 +263,7 @@ fn main_try(mut args: Vec<OsString>, offset: UtcOffset) -> Result<()> {
if config.reset.enabled {
let mut core = session.core(core_id)?;
let halt_timeout = Duration::from_millis(500);
#[allow(deprecated)] // Remove in 0.10
if config.flashing.halt_afterwards {
logging::eprintln(format!(
" {} The 'flashing.halt_afterwards' option in the config has moved to the 'reset' section",
"Warning".yellow().bold()
));
core.reset_and_halt(halt_timeout)?;
} else if config.reset.halt_afterwards {
if config.reset.halt_afterwards {
core.reset_and_halt(halt_timeout)?;
} else {
core.reset()?;
Expand Down