Skip to content

Commit

Permalink
For stability reasons, try connecting to bootloader and flash first.
Browse files Browse the repository at this point in the history
If the device is stuck in bootloader this will recover it.
If its not it will continue to warm flash.
And if the retries flag is on it will recover by safelink if both fail
  • Loading branch information
ToveRumar committed Aug 16, 2024
1 parent 7c70728 commit 8724a8a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,14 @@ def flash(self, path: str, progress_cb: Optional[Callable[[str, int], NoReturn]]
targets = [Target('cf2', 'stm32', 'fw', [], [])]
else:
targets = []

self.bl.flash_full(cf=self.cf, filename=path, progress_cb=progress_cb, targets=targets,
enable_console_log=True)
try:
print('Trying cold flash')
self.bl.flash_full(cf=self.cf, filename=path, progress_cb=progress_cb, targets=targets,
enable_console_log=True, warm=False)
except Exception as e:
print('Failed cold flash (as expected), trying warm flash')
self.bl.flash_full(cf=self.cf, filename=path, progress_cb=progress_cb, targets=targets,
enable_console_log=True, warm=True)
finally:
self.bl.close()

Expand Down

0 comments on commit 8724a8a

Please sign in to comment.