From 1b5a58ab7f59366fee25b26f45095610c401cbf5 Mon Sep 17 00:00:00 2001 From: Kevin Schoedel Date: Wed, 8 Nov 2023 17:48:05 -0500 Subject: [PATCH] [bloat report] Use a default set of sections if there is no config (#30248) Bloat report comments have become noisy because some platforms do not have a defined platform configuration file. This change defines a default list of section names that will be used if there is no platform configuration: .text, .rodata, .data, and .bss. If a platform without a configuration does not use these names, the bloat report will include only writable vs non-writable aggegrate results. --- scripts/tools/memory/gh_sizes.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/tools/memory/gh_sizes.py b/scripts/tools/memory/gh_sizes.py index 88c3291f99cb96..9decc178e15d45 100755 --- a/scripts/tools/memory/gh_sizes.py +++ b/scripts/tools/memory/gh_sizes.py @@ -154,13 +154,17 @@ def main(argv): else: output = pathlib.Path(binary).parent / output_base - config = Config().init({ + config_desc = { **memdf.util.config.CONFIG, **memdf.collect.CONFIG, **memdf.select.CONFIG, **memdf.report.OUTPUT_CONFIG, **CONFIG, - }) + } + # In case there is no platform configuration file, default to using a popular set of section names. + config_desc['section.select']['default'] = ['.text', '.rodata', '.data', '.bss'] + + config = Config().init(config_desc) config.put('output.file', output) config.put('output.format', 'json_records') if config_file.is_file(): @@ -181,7 +185,7 @@ def main(argv): collected: DFs = memdf.collect.collect_files(config, [binary]) - # Aggregate loaded segments, by writable (flash) or not (RAM). + # Aggregate loaded segments, by writable (RAM) or not (flash). segments = collected[SegmentDF.name] segments['segment'] = segments.index segments['wr'] = ((segments['flags'] & 2) != 0).convert_dtypes(