mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
feat(idf_py): idf.py flash will reflash only changed data sectors by default
idf.py flash -a is introduced to trigger a flash of all data (not just changed sectors).
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2021-2026 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
import json
|
||||
import os
|
||||
@@ -207,13 +207,18 @@ def action_extensions(base_actions: dict, project_path: str) -> dict:
|
||||
action: str,
|
||||
ctx: click.core.Context,
|
||||
args: PropertyDict,
|
||||
flash_all: bool,
|
||||
trust_flash_content: bool,
|
||||
force: bool,
|
||||
extra_args: str,
|
||||
trace: bool,
|
||||
) -> None:
|
||||
"""
|
||||
Run esptool to flash the entire project, from an argfile generated by the build system
|
||||
Run esptool to flash the entire project, from an argfile generated by the build system.
|
||||
By default uses fast reflashing when *_flashed.bin files exist. Use -a/--all for full flash.
|
||||
"""
|
||||
if flash_all and trust_flash_content:
|
||||
raise FatalError('Error: --trust-flash-content cannot be used with -a/--all.')
|
||||
ensure_build_directory(args, ctx.info_name)
|
||||
project_desc = _get_project_desc(ctx, args)
|
||||
if project_desc['target'] == 'linux':
|
||||
@@ -222,13 +227,8 @@ def action_extensions(base_actions: dict, project_path: str) -> dict:
|
||||
|
||||
args.port = args.port or get_default_serial_port()
|
||||
|
||||
extra_pre = list()
|
||||
if trace:
|
||||
extra_pre.append('--trace')
|
||||
|
||||
extra_post = list()
|
||||
if force:
|
||||
extra_post.append('--force')
|
||||
extra_pre = ['--trace'] if trace else []
|
||||
extra_post = ['--force'] if force else []
|
||||
if extra_args:
|
||||
extra_post += shlex.split(extra_args)
|
||||
|
||||
@@ -238,6 +238,10 @@ def action_extensions(base_actions: dict, project_path: str) -> dict:
|
||||
'SERIAL_TOOL_EXTRA_PRE_CMD_ARGS': ';'.join(extra_pre),
|
||||
'SERIAL_TOOL_EXTRA_ARGS': ';'.join(extra_post),
|
||||
}
|
||||
if flash_all:
|
||||
env['IDF_FLASH_FULL'] = '1'
|
||||
if trust_flash_content:
|
||||
env['IDF_TRUST_FLASH_CONTENT'] = '1'
|
||||
run_target(action, args, env, force_progression=True, interactive=True)
|
||||
|
||||
def erase_flash(action: str, ctx: click.core.Context, args: PropertyDict) -> None:
|
||||
@@ -590,6 +594,21 @@ def action_extensions(base_actions: dict, project_path: str) -> dict:
|
||||
|
||||
BAUD_AND_PORT = [BAUD_RATE, PORT]
|
||||
flash_options = BAUD_AND_PORT + [
|
||||
{
|
||||
'names': ['-a', '--all', 'flash_all'],
|
||||
'is_flag': True,
|
||||
'help': 'Flash all data (disable fast reflashing of changed sectors only).',
|
||||
},
|
||||
{
|
||||
'names': ['-t', '--trust-flash-content'],
|
||||
'is_flag': True,
|
||||
'help': (
|
||||
'Skip MD5 verification of files which do not need reflashing '
|
||||
"(e.g., if any of the assets didn't change since the last flash) when fast reflashing "
|
||||
'to speed up the process. '
|
||||
'Use only if the device flash content has not changed since the last flash operation.'
|
||||
),
|
||||
},
|
||||
{
|
||||
'names': ['--trace'],
|
||||
'is_flag': True,
|
||||
|
||||
Reference in New Issue
Block a user