Skip to content

Commit

Permalink
feat(write_flash): Remove the superfluous --verify option
Browse files Browse the repository at this point in the history
BREAKING CHANGE
  • Loading branch information
radimkarnis committed Jan 29, 2025
1 parent 1ce02db commit dbf3d1c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
2 changes: 2 additions & 0 deletions docs/en/esptool/basic-commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Basic Commands
==============

.. _write-flash:

Write Binary Data to Flash: write_flash
----------------------------------------

Expand Down
16 changes: 16 additions & 0 deletions docs/en/migration-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,19 @@ The esptool ``v5`` release introduces a centralized logging mechanism to improve
3. Update GUIs or tools to leverage the progress tracking API for better user feedback during lengthy operations.

See the :ref:`logging <logging>` section for more details on available logger methods and custom logger implementation.

``write_flash`` ``--verify`` Argument
*************************************

The ``--verify`` option for the :ref:`write_flash <write-flash>` command has been **deprecated in v5**. Flash verification is performed automatically after every successful write operation when technically feasible.

**Behavior:**

- Verification occurs by default after flashing completes.
- No action is needed to enable verification - it is mandatory when possible.
- Verification is **skipped** if Secure Download Mode (SDM) is active or during encrypted writes (using ``--encrypt``).

**Migration Steps:**

1. Remove all ``--verify`` arguments from existing ``write_flash`` commands.
2. Update scripts/CI pipelines to remove ``--verify`` flags.
6 changes: 0 additions & 6 deletions esptool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,6 @@ def add_spi_flash_subparsers(
parser_write_flash.add_argument(
"--no-progress", "-p", help="Suppress progress output", action="store_true"
)
parser_write_flash.add_argument(
"--verify",
help="Verify just-written data on flash "
"(mostly superfluous, data is read back during flashing)",
action="store_true",
)
parser_write_flash.add_argument(
"--encrypt",
help="Apply flash encryption when writing data "
Expand Down
19 changes: 4 additions & 15 deletions esptool/cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,10 @@ def write_flash(esp, args):
log.print("Hash of data verified.")
except NotImplementedInROMError:
pass
else:
log.print(
"Cannot verify written data if encrypted or in secure download mode."
)

if esp.IS_STUB:
# skip sending flash_finish to ROM loader here,
Expand All @@ -758,21 +762,6 @@ def write_flash(esp, args):
else:
esp.flash_finish(False)

if args.verify:
log.print("Verifying just-written flash...")
log.print(
"(This option is deprecated, "
"flash contents are now always read back after flashing.)"
)
# If some encrypted files have been flashed,
# print a warning saying that we won't check them
if args.encrypt or args.encrypt_files is not None:
log.warning("Cannot verify encrypted files, they will be ignored.")
# Call verify_flash function only if there is at least
# one non-encrypted file flashed
if not args.encrypt:
verify_flash(esp, args)


def image_info(args):
log.print(f"File size: {get_file_size(args.filename)} (bytes)")
Expand Down

0 comments on commit dbf3d1c

Please sign in to comment.