Skip to content

Commit

Permalink
[bloat report] Use a default set of sections if there is no config (#…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
kpschoedel authored Nov 8, 2023
1 parent 09dbc2f commit 1b5a58a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions scripts/tools/memory/gh_sizes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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(
Expand Down

0 comments on commit 1b5a58a

Please sign in to comment.