diff --git a/components/esptool_py/run_serial_tool.cmake b/components/esptool_py/run_serial_tool.cmake index 7bd1453721..e55eeee8a6 100644 --- a/components/esptool_py/run_serial_tool.cmake +++ b/components/esptool_py/run_serial_tool.cmake @@ -44,7 +44,8 @@ else() endif() # SERIAL_TOOL_ARGS is defined during the first cmake run -# SERIAL_TOOL_EXTRA_ARGS is used for additional arguments from the command line during run-time +# 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}) list(APPEND serial_tool_cmd $ENV{SERIAL_TOOL_EXTRA_ARGS}) diff --git a/tools/idf_py_actions/serial_ext.py b/tools/idf_py_actions/serial_ext.py index 37d2d304d8..9d8c1b3a3a 100644 --- a/tools/idf_py_actions/serial_ext.py +++ b/tools/idf_py_actions/serial_ext.py @@ -213,6 +213,7 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict: args: PropertyDict, force: bool, extra_args: str, + trace: bool, ) -> None: """ Run esptool to flash the entire project, from an argfile generated by the build system @@ -224,15 +225,22 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict: return args.port = args.port or get_default_serial_port() - extra = list() + + extra_pre = list() + if trace: + extra_pre.append('--trace') + + extra_post = list() if force: - extra.append('--force') + extra_post.append('--force') if extra_args: - extra += shlex.split(extra_args) + extra_post += shlex.split(extra_args) + env = { 'ESPBAUD': str(args.baud), 'ESPPORT': args.port, - 'SERIAL_TOOL_EXTRA_ARGS': ';'.join(extra), + 'SERIAL_TOOL_EXTRA_PRE_CMD_ARGS': ';'.join(extra_pre), + 'SERIAL_TOOL_EXTRA_ARGS': ';'.join(extra_post), } run_target(action, args, env, force_progression=True) @@ -527,6 +535,11 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict: BAUD_AND_PORT = [BAUD_RATE, PORT] flash_options = BAUD_AND_PORT + [ + { + 'names': ['--trace'], + 'is_flag': True, + 'help': 'Enable trace-level output of flasher tool interactions. Useful when submitting bug reports.', + }, { 'names': ['--force'], 'is_flag': True,