From 6532076ad6831e7ebe702e8848f661ec280cfe4d Mon Sep 17 00:00:00 2001 From: Aleksei Apaseev Date: Wed, 26 Jul 2023 10:52:20 +0800 Subject: [PATCH] coredump: added the chip_rev field into the coredump header --- tools/idf_py_actions/debug_ext.py | 47 +++++++++++++------------------ 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/tools/idf_py_actions/debug_ext.py b/tools/idf_py_actions/debug_ext.py index 70f966f4f2..59f26267f1 100644 --- a/tools/idf_py_actions/debug_ext.py +++ b/tools/idf_py_actions/debug_ext.py @@ -163,7 +163,6 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict: espcoredump_kwargs = dict() - espcoredump_kwargs['port'] = args.port espcoredump_kwargs['baud'] = args.baud espcoredump_kwargs['gdb_timeout_sec'] = gdb_timeout_sec espcoredump_kwargs['chip_rev'] = chip_rev_to_int(chip_rev) @@ -174,7 +173,6 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict: if extra_gdbinit_file: espcoredump_kwargs['extra_gdbinit_file'] = extra_gdbinit_file - espcoredump_kwargs: Dict[str, Any] = dict() core_format = None if core: @@ -191,16 +189,8 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict: sys.exit(1) espcoredump_kwargs['port'] = args.port - espcoredump_kwargs['baud'] = args.baud - espcoredump_kwargs['gdb_timeout_sec'] = gdb_timeout_sec - - # for reproducible builds - extra_gdbinit_file = project_desc.get('debug_prefix_map_gdbinit', None) - - if extra_gdbinit_file: - espcoredump_kwargs['extra_gdbinit_file'] = extra_gdbinit_file - - espcoredump_kwargs['parttable_off'] = get_sdkconfig_value(project_desc['config_file'], 'CONFIG_PARTITION_TABLE_OFFSET') + espcoredump_kwargs['parttable_off'] = get_sdkconfig_value(project_desc['config_file'], + 'CONFIG_PARTITION_TABLE_OFFSET') if core_format: espcoredump_kwargs['core_format'] = core_format @@ -272,7 +262,8 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict: base_ident = ' ' rom_elfs_dir = os.getenv('ESP_ROM_ELF_DIR') if not rom_elfs_dir: - raise FatalError('ESP_ROM_ELF_DIR environment variable is not defined. Please try to run IDF "install" and "export" scripts.') + raise FatalError( + 'ESP_ROM_ELF_DIR environment variable is not defined. Please try to run IDF "install" and "export" scripts.') with open(os.path.join(os.path.dirname(os.path.realpath(__file__)), ESP_ROM_INFO_FILE), 'r') as f: roms = json.load(f) if target not in roms: @@ -409,8 +400,9 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict: # use default value if commands not defined in the environment nor command line target = project_desc['target'] openocd_arguments = get_openocd_arguments(target) - print('Note: OpenOCD cfg not found (via env variable OPENOCD_COMMANDS nor as a --openocd-commands argument)\n' - 'OpenOCD arguments default to: "{}"'.format(openocd_arguments)) + print( + 'Note: OpenOCD cfg not found (via env variable OPENOCD_COMMANDS nor as a --openocd-commands argument)\n' + 'OpenOCD arguments default to: "{}"'.format(openocd_arguments)) # script directory is taken from the environment by OpenOCD, update only if command line arguments to override if openocd_scripts is not None: openocd_arguments += ' -s {}'.format(openocd_scripts) @@ -496,8 +488,8 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict: if debug_targets: # Register the meta cleanup callback -> called on FatalError ctx.meta['cleanup'] = debug_cleanup - move_to_front('gdbgui') # possibly 2nd - move_to_front('openocd') # always 1st + move_to_front('gdbgui') # possibly 2nd + move_to_front('openocd') # always 1st # followed by "monitor", "gdb" or "gdbtui" in any order post_action = ctx.invoke(ctx.command.get_command(ctx, 'post_debug')) @@ -505,7 +497,7 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict: post_action.action_args['block'] = 0 else: post_action.action_args['block'] = 1 - tasks.append(post_action) # always last + tasks.append(post_action) # always last if any([task.name == 'openocd' for task in tasks]): for task in tasks: if task.name in ('gdb', 'gdbgui', 'gdbtui'): @@ -517,11 +509,12 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict: """ gdb(action, ctx, args, False, 1, gdbinit, require_openocd) - def gdb(action: str, ctx: Context, args: PropertyDict, batch: bool, gdb_tui: Optional[int], gdbinit: Optional[str], require_openocd: bool) -> None: + def gdb(action: str, ctx: Context, args: PropertyDict, batch: bool, gdb_tui: Optional[int], gdbinit: Optional[str], + require_openocd: bool) -> None: """ Synchronous GDB target """ - watch_openocd = Thread(target=_check_openocd_errors, args=(fail_if_openocd_failed, action, ctx, )) + watch_openocd = Thread(target=_check_openocd_errors, args=(fail_if_openocd_failed, action, ctx,)) watch_openocd.start() processes['threads_to_join'].append(watch_openocd) project_desc = get_project_desc(args, ctx) @@ -615,14 +608,14 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict: { 'names': ['--openocd-scripts', '--openocd_scripts'], 'help': - ('Script directory for openocd cfg files.\n'), + ('Script directory for openocd cfg files.\n'), 'default': - None, + None, }, { 'names': ['--openocd-commands', '--openocd_commands'], 'help': - ('Command line arguments for openocd.\n'), + ('Command line arguments for openocd.\n'), 'default': None, } ], @@ -654,9 +647,9 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict: { 'names': ['--gdbgui-port', '--gdbgui_port'], 'help': - ('The port on which gdbgui will be hosted. Default: 5000\n'), + ('The port on which gdbgui will be hosted. Default: 5000\n'), 'default': - None, + None, }, gdbinit, fail_if_openocd_failed ], 'order_dependencies': ['all', 'flash'], @@ -687,7 +680,7 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict: { 'names': ['--block', '--block'], 'help': - ('Set to 1 for blocking the console on the outputs of async debug actions\n'), + ('Set to 1 for blocking the console on the outputs of async debug actions\n'), 'default': 0, }, ], @@ -707,7 +700,7 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict: { 'names': ['--block', '--block'], 'help': - ('Set to 1 for blocking the console on the outputs of async debug actions\n'), + ('Set to 1 for blocking the console on the outputs of async debug actions\n'), 'default': 0, }, ],