Skip to content

Commit 8935ff4

Browse files
committed
Merge branch 'feat/idf_py_flash_trace' into 'master'
feat(idf_py): Allow tracing interactions during flashing with --trace Closes IDF-9545 See merge request espressif/esp-idf!33656
2 parents 43b3730 + 4a04a9e commit 8935ff4

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

components/esptool_py/run_serial_tool.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ else()
4444
endif()
4545

4646
# SERIAL_TOOL_ARGS is defined during the first cmake run
47-
# SERIAL_TOOL_EXTRA_ARGS is used for additional arguments from the command line during run-time
47+
# EXTRA_ARGS and EXTRA_PRE_CMD_ARGS are used for additional arguments from the command line during run-time
48+
list(APPEND serial_tool_cmd $ENV{SERIAL_TOOL_EXTRA_PRE_CMD_ARGS})
4849
list(APPEND serial_tool_cmd ${SERIAL_TOOL_ARGS})
4950
list(APPEND serial_tool_cmd $ENV{SERIAL_TOOL_EXTRA_ARGS})
5051

tools/idf_py_actions/serial_ext.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ def flash(
213213
args: PropertyDict,
214214
force: bool,
215215
extra_args: str,
216+
trace: bool,
216217
) -> None:
217218
"""
218219
Run esptool to flash the entire project, from an argfile generated by the build system
@@ -224,15 +225,22 @@ def flash(
224225
return
225226

226227
args.port = args.port or get_default_serial_port()
227-
extra = list()
228+
229+
extra_pre = list()
230+
if trace:
231+
extra_pre.append('--trace')
232+
233+
extra_post = list()
228234
if force:
229-
extra.append('--force')
235+
extra_post.append('--force')
230236
if extra_args:
231-
extra += shlex.split(extra_args)
237+
extra_post += shlex.split(extra_args)
238+
232239
env = {
233240
'ESPBAUD': str(args.baud),
234241
'ESPPORT': args.port,
235-
'SERIAL_TOOL_EXTRA_ARGS': ';'.join(extra),
242+
'SERIAL_TOOL_EXTRA_PRE_CMD_ARGS': ';'.join(extra_pre),
243+
'SERIAL_TOOL_EXTRA_ARGS': ';'.join(extra_post),
236244
}
237245
run_target(action, args, env, force_progression=True)
238246

@@ -527,6 +535,11 @@ def efuse_write_protect(action: str, ctx: click.core.Context, args: PropertyDict
527535

528536
BAUD_AND_PORT = [BAUD_RATE, PORT]
529537
flash_options = BAUD_AND_PORT + [
538+
{
539+
'names': ['--trace'],
540+
'is_flag': True,
541+
'help': 'Enable trace-level output of flasher tool interactions. Useful when submitting bug reports.',
542+
},
530543
{
531544
'names': ['--force'],
532545
'is_flag': True,

0 commit comments

Comments
 (0)