mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00: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:
@@ -197,6 +197,8 @@ function(esptool_py_flash_target target_name main_args sub_args)
|
||||
-D "IDF_PATH=${idf_path}"
|
||||
-D "SERIAL_TOOL=${esptool_py_cmd}"
|
||||
-D "SERIAL_TOOL_ARGS=${main_args};write-flash;@${filename_prefix}_args"
|
||||
-D "SERIAL_TOOL_IS_WRITE_FLASH=1"
|
||||
-D "SERIAL_TOOL_FLASH_ARGS_FILE=${filename_prefix}_args"
|
||||
-D "WORKING_DIRECTORY=${build_dir}"
|
||||
-P ${esptool_py_dir}/run_serial_tool.cmake
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
|
||||
@@ -243,6 +245,8 @@ $<JOIN:$<TARGET_PROPERTY:${target_name},IMAGES>,\n>")
|
||||
-D "IDF_PATH=${idf_path}"
|
||||
-D "SERIAL_TOOL=${esptool_py_cmd}"
|
||||
-D "SERIAL_TOOL_ARGS=${main_args};write-flash;@encrypted_${filename_prefix}_args"
|
||||
-D "SERIAL_TOOL_IS_WRITE_FLASH=1"
|
||||
-D "SERIAL_TOOL_FLASH_ARGS_FILE=encrypted_${filename_prefix}_args"
|
||||
-D "WORKING_DIRECTORY=${build_dir}"
|
||||
-P ${esptool_py_dir}/run_serial_tool.cmake
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
|
||||
|
||||
@@ -22,11 +22,60 @@ if(DEFINED ENV{IDF_ENV_FPGA})
|
||||
message("Note: IDF_ENV_FPGA is set, propagating to esptool with ESPTOOL_ENV_FPGA = 1")
|
||||
endif()
|
||||
|
||||
set(serial_tool_cmd ${SERIAL_TOOL})
|
||||
# Extract binary file paths from esptool argfile content.
|
||||
# The argfile contains "0xOFFSET file" pairs; this returns just the file paths.
|
||||
function(_esptoolpy_extract_flash_files args_content out_var)
|
||||
string(REPLACE "\r\n" "\n" args_content "${args_content}")
|
||||
separate_arguments(_tokens NATIVE_COMMAND "${args_content}")
|
||||
set(_result "")
|
||||
set(_expect_file FALSE)
|
||||
foreach(_tok IN LISTS _tokens)
|
||||
if(_expect_file)
|
||||
if(NOT _tok MATCHES "^-")
|
||||
list(APPEND _result "${_tok}")
|
||||
endif()
|
||||
set(_expect_file FALSE)
|
||||
elseif(_tok MATCHES "^0x[0-9a-fA-F]+$")
|
||||
set(_expect_file TRUE)
|
||||
endif()
|
||||
endforeach()
|
||||
set(${out_var} "${_result}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Fast-reflashing support (esptool --diff-with and --skip-flashed).
|
||||
#
|
||||
# Build-time inputs (passed as -D flags from project_include.cmake):
|
||||
# SERIAL_TOOL_IS_WRITE_FLASH — set to 1 for write-flash targets
|
||||
# SERIAL_TOOL_FLASH_ARGS_FILE — argfile name relative to WORKING_DIRECTORY
|
||||
#
|
||||
# Runtime inputs (environment variables, can change without reconfiguring CMake):
|
||||
# IDF_FLASH_FULL=1 — disable fast reflash (idf.py flash -a/--all)
|
||||
# IDF_TRUST_FLASH_CONTENT=1 — skip MD5 verification of unchanged files (idf.py flash -t)
|
||||
|
||||
set(_flash_full FALSE)
|
||||
if(DEFINED ENV{IDF_FLASH_FULL} AND "$ENV{IDF_FLASH_FULL}" STREQUAL "1")
|
||||
set(_flash_full TRUE)
|
||||
endif()
|
||||
|
||||
set(_trust_flash_content FALSE)
|
||||
if(DEFINED ENV{IDF_TRUST_FLASH_CONTENT} AND "$ENV{IDF_TRUST_FLASH_CONTENT}" STREQUAL "1")
|
||||
set(_trust_flash_content TRUE)
|
||||
endif()
|
||||
|
||||
# Read the flash files list once (used for both pre-flash --diff-with and post-flash saving).
|
||||
set(_flash_files "")
|
||||
if(SERIAL_TOOL_IS_WRITE_FLASH AND SERIAL_TOOL_FLASH_ARGS_FILE
|
||||
AND DEFINED WORKING_DIRECTORY AND WORKING_DIRECTORY
|
||||
AND EXISTS "${WORKING_DIRECTORY}/${SERIAL_TOOL_FLASH_ARGS_FILE}")
|
||||
file(READ "${WORKING_DIRECTORY}/${SERIAL_TOOL_FLASH_ARGS_FILE}" _args_content)
|
||||
_esptoolpy_extract_flash_files("${_args_content}" _flash_files)
|
||||
endif()
|
||||
|
||||
# Main purpose of this script: we can't expand these environment variables in the main IDF CMake build,
|
||||
# because we want to expand them at flashing time not at CMake runtime (so they can change
|
||||
# without needing a CMake re-run)
|
||||
set(serial_tool_cmd ${SERIAL_TOOL})
|
||||
|
||||
set(ESPPORT $ENV{ESPPORT})
|
||||
if(NOT ESPPORT)
|
||||
message("Note: ${SERIAL_TOOL} will search for a serial port. "
|
||||
@@ -43,26 +92,69 @@ else()
|
||||
list(APPEND serial_tool_cmd -b ${ESPBAUD})
|
||||
endif()
|
||||
|
||||
# SERIAL_TOOL_ARGS is defined during the first cmake run
|
||||
# EXTRA_ARGS and EXTRA_PRE_CMD_ARGS are used for additional arguments from the command line during run-time
|
||||
list(APPEND serial_tool_cmd $ENV{SERIAL_TOOL_EXTRA_PRE_CMD_ARGS})
|
||||
list(APPEND serial_tool_cmd ${SERIAL_TOOL_ARGS})
|
||||
|
||||
# Append fast-reflashing arguments when flash files are available.
|
||||
if(_flash_files AND NOT _flash_full)
|
||||
# Build --diff-with list: use *_flashed.bin if present, otherwise "skip".
|
||||
set(_diff_with_files "")
|
||||
set(_have_any FALSE)
|
||||
foreach(_file IN LISTS _flash_files)
|
||||
string(REGEX REPLACE "\\.bin$" "_flashed.bin" _ref "${_file}")
|
||||
if(EXISTS "${WORKING_DIRECTORY}/${_ref}")
|
||||
list(APPEND _diff_with_files "${_ref}")
|
||||
set(_have_any TRUE)
|
||||
else()
|
||||
list(APPEND _diff_with_files "skip")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(_have_any)
|
||||
list(APPEND serial_tool_cmd "--diff-with" ${_diff_with_files})
|
||||
if(_trust_flash_content)
|
||||
list(APPEND serial_tool_cmd "--trust-flash-content")
|
||||
endif()
|
||||
else()
|
||||
if(_trust_flash_content)
|
||||
message(WARNING "No previously flashed binaries found in build directory, "
|
||||
"--trust-flash-content will be ignored.")
|
||||
endif()
|
||||
list(APPEND serial_tool_cmd "--skip-flashed")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND serial_tool_cmd $ENV{SERIAL_TOOL_EXTRA_ARGS})
|
||||
|
||||
# Run the serial tool.
|
||||
set(_execute_extra_args "")
|
||||
if(${SERIAL_TOOL_SILENT})
|
||||
execute_process(COMMAND ${serial_tool_cmd}
|
||||
WORKING_DIRECTORY "${WORKING_DIRECTORY}"
|
||||
RESULT_VARIABLE result
|
||||
OUTPUT_VARIABLE SERIAL_TOOL_OUTPUT_LOG
|
||||
)
|
||||
else()
|
||||
execute_process(COMMAND ${serial_tool_cmd}
|
||||
WORKING_DIRECTORY "${WORKING_DIRECTORY}"
|
||||
RESULT_VARIABLE result
|
||||
)
|
||||
list(APPEND _execute_extra_args OUTPUT_VARIABLE SERIAL_TOOL_OUTPUT_LOG)
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${serial_tool_cmd}
|
||||
WORKING_DIRECTORY "${WORKING_DIRECTORY}"
|
||||
RESULT_VARIABLE result
|
||||
${_execute_extra_args}
|
||||
)
|
||||
|
||||
if(${result})
|
||||
# No way to have CMake silently fail, unfortunately
|
||||
message(FATAL_ERROR "${SERIAL_TOOL} failed. \n${SERIAL_TOOL_OUTPUT_LOG}")
|
||||
endif()
|
||||
|
||||
# After successful flash, save copies of all flashed files as *_flashed.bin
|
||||
# for use with --diff-with on the next reflash.
|
||||
foreach(_file IN LISTS _flash_files)
|
||||
if(EXISTS "${WORKING_DIRECTORY}/${_file}")
|
||||
string(REGEX REPLACE "\\.bin$" "_flashed.bin" _dst "${_file}")
|
||||
file(COPY_FILE
|
||||
"${WORKING_DIRECTORY}/${_file}"
|
||||
"${WORKING_DIRECTORY}/${_dst}"
|
||||
ONLY_IF_DIFFERENT
|
||||
RESULT _copy_result)
|
||||
if(NOT _copy_result EQUAL "0")
|
||||
message(WARNING "Could not save ${_dst}: ${_copy_result}, "
|
||||
"next flash will run without comparison data.")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
@@ -109,6 +109,8 @@ Delete the Entire Build Contents: ``fullclean``
|
||||
|
||||
This command deletes the entire build directory contents, which includes all CMake configuration output. The next time the project is built, CMake will configure it from scratch. Note that this option recursively deletes **all** files in the build directory, so use with care. Project configuration is not deleted.
|
||||
|
||||
.. _flash-with-idf-py:
|
||||
|
||||
Flash the Project: ``flash``
|
||||
----------------------------
|
||||
|
||||
@@ -118,12 +120,44 @@ Flash the Project: ``flash``
|
||||
|
||||
This command automatically builds the project if necessary, and then flash it to the target. You can use ``-p`` and ``-b`` options to set serial port name and flasher baud rate, respectively.
|
||||
|
||||
.. note:: The environment variables ``ESPPORT`` and ``ESPBAUD`` can be used to set default values for the ``-p`` and ``-b`` options, respectively. Providing these options on the command line overrides the default.
|
||||
.. note::
|
||||
|
||||
The environment variables ``ESPPORT`` and ``ESPBAUD`` can be used to set default values for the ``-p`` and ``-b`` options, respectively. Providing these options on the command line overrides the default.
|
||||
|
||||
``idf.py`` uses the ``write-flash`` command of ``esptool`` under the hood to flash the target. You can pass additional arguments to configure the flash writing process using the ``--extra-args`` option. For example, to `write to an external SPI flash chip <https://docs.espressif.com/projects/esptool/en/latest/esptool/advanced-options.html#custom-spi-pin-configuration>`_, use the following command: ``idf.py flash --extra-args="--spi-connection <CLK>,<Q>,<D>,<HD>,<CS>"``. To see the full list of available arguments, run ``esptool write-flash --help`` or see the `esptool documentation <https://docs.espressif.com/projects/esptool/en/latest/esptool/index.html>`_.
|
||||
|
||||
Similarly to the ``build`` command, the command can be run with ``app``, ``bootloader`` and ``partition-table`` arguments to flash only the app, bootloader or partition table as applicable.
|
||||
|
||||
By default, ``idf.py flash`` attempts fast reflashing (reflashing the changed data sectors only, not the whole binary) when previously flashed binaries are present: if ``*_flashed.bin`` files exist in the build directory, the build system configures ``esptool`` to write only changed flash regions. This speeds up repeated flashing during development. All the flashed files in flash are then verified to ensure they match the expected content. If any of the files in flash do not match the expected content, a full flash will be performed instead.
|
||||
|
||||
When no ``*_flashed.bin`` files are present, ``idf.py flash`` configures esptool to check the device flash content first and skip flashing any files that are already present in flash (this does not apply when using ``idf.py flash -a`` or ``--all``).
|
||||
|
||||
After each successful flash, the build system saves copies of all flashed files (bootloader, partition table, app, and any other assets) with an ``_flashed`` suffix in the build directory (e.g., ``bootloader_flashed.bin``, ``partition-table_flashed.bin``). These are used automatically on the next ``idf.py flash`` for fast reflashing.
|
||||
|
||||
Fast reflashing works with or without the :ref:`CONFIG_APP_BUILD_MINIMIZE_BINARY_CHANGES` option. Enabling that option can further improve reflash effectiveness by laying out the application binary so that changes are localized. This results in less flash sectors needing to be rewritten. This option may increase the size of the application binary and is not recommended for production builds.
|
||||
|
||||
Full Flash
|
||||
^^^^^^^^^^
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
idf.py flash -a
|
||||
|
||||
idf.py flash --all
|
||||
|
||||
The ``-a`` or ``--all`` option always performs a full flash (does not reflash the changed sectors only, but the whole binary). Use it after erasing flash, when flashing to a new device with empty flash, or when you do not want to rely on previous binaries.
|
||||
|
||||
Trust Flash Content Mode
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
idf.py flash -t
|
||||
|
||||
idf.py flash --trust-flash-content
|
||||
|
||||
When using fast reflash, ``-t`` or ``--trust-flash-content`` skips MD5 verification of files which do not need reflashing (e.g., if ``bootloader.bin`` didn't change since the last flash) to speed up the flashing process. Only use this when you are sure the device flash content has not been modified since the last ``idf.py flash`` operation.
|
||||
|
||||
.. _merging-binaries:
|
||||
|
||||
Merge binaries: ``merge-bin``
|
||||
|
||||
@@ -7,3 +7,4 @@ Migration from 6.0 to 6.1
|
||||
:maxdepth: 1
|
||||
|
||||
peripherals
|
||||
tools
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
Tools
|
||||
=====
|
||||
|
||||
:link_to_translation:`zh_CN:[中文]`
|
||||
|
||||
``idf.py flash`` default behavior (fast reflash)
|
||||
------------------------------------------------
|
||||
|
||||
The default behavior of ``idf.py flash`` has changed. When ``*_flashed.bin`` files exist in the build directory (e.g. from a previous successful flash), ``idf.py flash`` now performs **fast reflashing**: it only writes the flash regions that changed, which speeds up repeated flashing during development. After flashing, it verifies that the device flash content matches the expected binaries; if verification fails, a full flash is performed.
|
||||
|
||||
If you prefer the previous behavior where all binaries are always written in full (regardless of existing ``*_flashed.bin`` files), you can force a complete flash by using the full flash mode: run ``idf.py flash -a`` or ``idf.py flash --all``. This ensures that every binary is re-written to the device, which is recommended when working with brand-new, empty, or erased chips, or whenever you want to disable fast reflash and incremental flashing.
|
||||
|
||||
For more details, see :ref:`flash-with-idf-py` in the *IDF Python Tools* guide.
|
||||
@@ -109,6 +109,8 @@ ESP-IDF 支持多个目标芯片,运行 ``idf.py --list-targets`` 查看当前
|
||||
|
||||
此命令将删除所有 build 目录下的内容,包括 CMake 配置输出。下次构建时,CMake 将重新配置其输出。注意,此命令将递归删除 build 目录下的 *所有* 文件(工程配置将保留),请谨慎使用。
|
||||
|
||||
.. _flash-with-idf-py:
|
||||
|
||||
烧录工程:``flash``
|
||||
------------------------
|
||||
|
||||
@@ -118,11 +120,43 @@ ESP-IDF 支持多个目标芯片,运行 ``idf.py --list-targets`` 查看当前
|
||||
|
||||
此命令将在需要时自动构建工程,随后将其烧录到目标芯片。使用 ``-p`` 和 ``-b`` 选项可分别设置串口名称和烧录程序的波特率。
|
||||
|
||||
.. note:: 环境变量 ``ESPPORT`` 和 ``ESPBAUD`` 可分别设置 ``-p`` 和 ``-b`` 选项的默认值,在命令行上设置这些选项的参数可覆盖默认值。
|
||||
.. note::
|
||||
|
||||
``idf.py`` 在内部使用 ``esptool`` 的 ``write-flash`` 命令来烧录目标设备。通过 ``--extra-args`` 选项传递额外的参数,并配置烧录过程。例如,要 `写入到外部 SPI flash 芯片 <https://docs.espressif.com/projects/esptool/en/latest/esptool/advanced-options.html#custom-spi-pin-configuration>`_,请使用以下命令: ``idf.py flash --extra-args="--spi-connection <CLK>,<Q>,<D>,<HD>,<CS>"``。要查看所有可用参数,请运行 ``esptool write-flash --help`` 或查看 `esptool 文档 <https://docs.espressif.com/projects/esptool/en/latest/esptool/index.html>`_。
|
||||
环境变量 ``ESPPORT`` 和 ``ESPBAUD`` 可分别用于设置 ``-p`` 和 ``-b`` 选项的默认值。若在命令行中显式提供这些选项,则将覆盖默认值。
|
||||
|
||||
与 ``build`` 命令类似,使用 ``app``、``bootloader`` 或 ``partition-table`` 参数运行此命令,可选择仅烧录应用程序、引导加载程序或分区表。
|
||||
``idf.py`` 在内部使用 ``esptool`` 的 ``write-flash`` 命令来烧录目标设备。可以通过 ``--extra-args`` 选项传递额外的参数,并配置烧录过程。例如,要 `写入到外部 SPI flash 芯片 <https://docs.espressif.com/projects/esptool/en/latest/esptool/advanced-options.html#custom-spi-pin-configuration>`_,请使用以下命令:``idf.py flash --extra-args="--spi-connection <CLK>,<Q>,<D>,<HD>,<CS>"``。要查看所有可用参数,请运行 ``esptool write-flash --help`` 或查看 `esptool 文档 <https://docs.espressif.com/projects/esptool/en/latest/esptool/index.html>`_。
|
||||
|
||||
与 ``build`` 命令类似,运行 ``flash`` 命令时还可以添加 ``app``、``bootloader`` 或 ``partition-table`` 参数,选择仅烧录应用程序、引导加载程序或分区表。
|
||||
|
||||
默认情况下,若存在已烧录的二进制文件,则 ``idf.py flash`` 命令会尝试进行快速重新烧录(只重新烧录已更改的数据扇区,而非整个二进制文件):如果构建目录中存在 ``*_flashed.bin`` 文件,构建系统会配置 ``esptool`` 仅写入已更改的 flash 区域,加快开发过程中的重复烧录速度。随后会对 flash 中所有已烧录的文件进行校验,确保其内容符合预期。若 flash 中的任何文件与预期内容不一致,则会改为执行全量烧录。
|
||||
|
||||
若不存在 ``*_flashed.bin`` 文件,则 ``idf.py flash`` 会配置 esptool 先检查设备的 flash 内容,并跳过已存在于 flash 中的文件(使用 ``idf.py flash -a`` 或 ``--all`` 参数时不适用此行为)。
|
||||
|
||||
每次成功烧录后,构建系统会在构建目录中保存所有已烧录文件(引导加载程序、分区表、应用程序以及其他任何资源)的副本,文件名带有 ``_flashed`` 后缀(例如,``bootloader_flashed.bin``、``partition-table_flashed.bin``)。下次执行 ``idf.py flash`` 命令时会自动使用这些文件,以便快速重新烧录。
|
||||
|
||||
无论是否启用 :ref:`CONFIG_APP_BUILD_MINIMIZE_BINARY_CHANGES` 选项,快速重新烧录都可正常工作。启用该选项可调整应用程序二进制文件的布局,使修改集中在局部区域,从而进一步提升重新烧录的效率,需要重写的 flash 扇区会减少。但该选项可能会增加应用程序二进制文件的大小,不建议用于生产构建。
|
||||
|
||||
全量烧录
|
||||
^^^^^^^^
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
idf.py flash -a
|
||||
|
||||
idf.py flash --all
|
||||
|
||||
``-a`` 或 ``--all`` 选项始终执行全量烧录(并非仅重新烧录已更改的扇区,而是烧录整个二进制文件)。在擦除 flash 之后、在烧录 flash 为空的新设备时,或在不想依赖先前的二进制文件时可以使用该参数。
|
||||
|
||||
信任 flash 内容模式
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
idf.py flash -t
|
||||
|
||||
idf.py flash --trust-flash-content
|
||||
|
||||
使用快速重新烧录时,使用 ``-t`` 或 ``--trust-flash-content`` 参数可以跳过对不需要重新烧录的文件(例如,如果 ``bootloader.bin`` 自上次烧录以来没有变化)的 MD5 校验,以加快烧录过程。仅在确定设备 flash 内容自上次执行 ``idf.py flash`` 以来未被修改的情况下使用此选项。
|
||||
|
||||
.. _merging-binaries:
|
||||
|
||||
|
||||
@@ -7,3 +7,4 @@
|
||||
:maxdepth: 1
|
||||
|
||||
peripherals
|
||||
tools
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
工具
|
||||
====
|
||||
|
||||
:link_to_translation:`en:[English]`
|
||||
|
||||
``idf.py flash`` 的默认行为(快速重新烧录)
|
||||
-------------------------------------------
|
||||
|
||||
``idf.py flash`` 的默认行为已发生变化。若构建目录中包含 ``*_flashed.bin`` 文件(例如来自上一次成功的烧录),则 ``idf.py flash`` 会执行 **快速重烧写**:仅写入已发生变化的 flash 区域,从而加快开发过程中的重复烧录速度。烧录完成后,会校验设备的 flash 内容是否符合预期;若校验失败,则执行完整烧录。
|
||||
|
||||
如果你更倾向于无论是否存在 ``*_flashed.bin`` 文件,始终完整写入所有二进制文件(之前的默认行为),则可运行 ``idf.py flash -a`` 或 ``idf.py flash --all`` 命令,强制执行完整烧录。该命令可确保每个二进制文件都会被重新写入设备,建议在处理全新、空白或已擦除的芯片时使用,也可以在希望禁用快速重新烧录和增量烧录时使用。
|
||||
|
||||
详情请参阅 IDF Python 工具指南中的 :ref:`flash-with-idf-py`。
|
||||
@@ -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