Skip to content

Commit

Permalink
Disable watchdog timer before build.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnross committed Mar 6, 2023
1 parent ac927f6 commit a10fdd1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions cargo-espflash/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ fn flash(args: FlashArgs, config: &Config) -> Result<()> {
let chip = flasher.chip();
let target = chip.into_target();
let target_xtal_freq = target.crystal_freq(flasher.connection())?;
flasher.disable_watchdog()?;

let build_ctx =
build(&args.build_args, &cargo_config, chip).wrap_err("Failed to build project")?;
Expand Down
7 changes: 7 additions & 0 deletions espflash/src/flasher/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,13 @@ impl Flasher {
Ok(flasher)
}


pub fn disable_watchdog(&mut self) -> Result<(), Error> {
let mut target = self.chip.flash_target(self.spi_params, self.use_stub);
target.begin(&mut self.connection).flashing()?;
Ok(())
}

/// Load flash stub
fn load_stub(&mut self) -> Result<(), Error> {
debug!("Loading flash stub for chip: {:?}", self.chip);
Expand Down

0 comments on commit a10fdd1

Please sign in to comment.