feat(idf_py): Allow tracing interactions during flashing with --trace

This commit is contained in:
Radim Karniš 2024-09-19 16:08:24 +02:00
parent 13d4235d73
commit 4a04a9e95c
2 changed files with 19 additions and 5 deletions

View File

@ -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})

View File

@ -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,