Skip to content

Commit

Permalink
Merge branch 'coredump-info-offset_v5.1' into 'release/v5.1'
Browse files Browse the repository at this point in the history
Tools: coredump-info - fix non-default partition table offset issues (v5.1)

See merge request espressif/esp-idf!26802
  • Loading branch information
dobairoland committed Nov 16, 2023
2 parents 36cb0b2 + 5fe418e commit 6edb998
Showing 1 changed file with 26 additions and 15 deletions.
41 changes: 26 additions & 15 deletions tools/idf_py_actions/debug_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,20 +146,8 @@ def _get_espcoredump_instance(ctx: Context,
coredump_to_flash = coredump_to_flash_config.rstrip().endswith('y') if coredump_to_flash_config else False

prog = os.path.join(project_desc['build_dir'], project_desc['app_elf'])
args.port = args.port or get_default_serial_port()

espcoredump_kwargs = dict()

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: Dict[str, Any] = dict()
core_format = None

if core:
Expand All @@ -169,12 +157,24 @@ def _get_espcoredump_instance(ctx: Context,
elif coredump_to_flash:
# If the core dump is read from flash, we don't need to specify the --core-format argument at all.
# The format will be determined automatically
pass
args.port = args.port or get_default_serial_port()
else:
print('Path to core dump file is not provided. '
"Core dump can't be read from flash since this option is not enabled in menuconfig")
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')

if core_format:
espcoredump_kwargs['core_format'] = core_format

Expand All @@ -183,7 +183,18 @@ def _get_espcoredump_instance(ctx: Context,

espcoredump_kwargs['prog'] = prog

return CoreDump(**espcoredump_kwargs)
# compatibility check for esp-coredump < 1.5.2
try:
coredump = CoreDump(**espcoredump_kwargs)
except TypeError as e:
# 'parttable_off' was added in esp-coredump 1.5.2
# remove argument and retry without it
if 'parttable_off' in str(e):
espcoredump_kwargs.pop('parttable_off')
coredump = CoreDump(**espcoredump_kwargs)
else:
raise
return coredump

def get_core_file_format(core_file: str) -> str:
bin_v1 = 1
Expand Down

0 comments on commit 6edb998

Please sign in to comment.