Skip to content

Commit 38a6d81

Browse files
committed
Add --connect-under-reset
1 parent 94676b1 commit 38a6d81

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "grapple-bundle"
3-
version = "0.1.7"
3+
version = "0.1.8"
44
edition = "2021"
55
description = "Grapple's Embedded Firmware and Bootloader Bundler and Flasher utility"
66
documentation = "https://docs.rs/grapple-bundle"

src/flash.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ pub struct FlashConfig {
199199

200200

201201

202-
pub fn flash_bundle(bundle: &Path, chip: &str, jtag: bool) -> anyhow::Result<()> {
202+
pub fn flash_bundle(bundle: &Path, chip: &str, jtag: bool, connect_under_reset: bool) -> anyhow::Result<()> {
203203
// Step 1 - open bundle, read index, read config
204204
let file = File::open(bundle)?;
205205
let mut archive = zip::ZipArchive::new(file)?;
@@ -225,7 +225,10 @@ pub fn flash_bundle(bundle: &Path, chip: &str, jtag: bool) -> anyhow::Result<()>
225225
probe.select_protocol(probe_rs::probe::WireProtocol::Swd)?;
226226
}
227227

228-
let mut session = probe.attach(chip, Permissions::default())?;
228+
let mut session = match connect_under_reset {
229+
true => probe.attach_under_reset(chip, Permissions::default())?,
230+
false => probe.attach(chip, Permissions::default())?,
231+
};
229232

230233
// Step 3 - run routine
231234
for action in config.procedure.iter() {

src/main.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ enum Commands {
3737
#[arg(short, long)]
3838
chip: String,
3939
#[arg(short, long)]
40-
jtag: bool
40+
jtag: bool,
41+
#[arg(long)]
42+
connect_under_reset: bool
4143
}
4244
}
4345

@@ -48,8 +50,8 @@ fn main() {
4850
Commands::Build { output, firmware, bootloader, config, lasercan_rev1_bootloader_check } => {
4951
build_bundle(output, firmware, bootloader, config, *lasercan_rev1_bootloader_check).unwrap();
5052
},
51-
Commands::Flash { bundle, chip, jtag } => {
52-
flash_bundle(bundle, chip, *jtag).unwrap();
53+
Commands::Flash { bundle, chip, jtag, connect_under_reset } => {
54+
flash_bundle(bundle, chip, *jtag, *connect_under_reset).unwrap();
5355
},
5456
}
5557
}

0 commit comments

Comments
 (0)