Skip to content

Commit 1b5a58a

Browse files
authored
[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.
1 parent 09dbc2f commit 1b5a58a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

scripts/tools/memory/gh_sizes.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,17 @@ def main(argv):
154154
else:
155155
output = pathlib.Path(binary).parent / output_base
156156

157-
config = Config().init({
157+
config_desc = {
158158
**memdf.util.config.CONFIG,
159159
**memdf.collect.CONFIG,
160160
**memdf.select.CONFIG,
161161
**memdf.report.OUTPUT_CONFIG,
162162
**CONFIG,
163-
})
163+
}
164+
# In case there is no platform configuration file, default to using a popular set of section names.
165+
config_desc['section.select']['default'] = ['.text', '.rodata', '.data', '.bss']
166+
167+
config = Config().init(config_desc)
164168
config.put('output.file', output)
165169
config.put('output.format', 'json_records')
166170
if config_file.is_file():
@@ -181,7 +185,7 @@ def main(argv):
181185

182186
collected: DFs = memdf.collect.collect_files(config, [binary])
183187

184-
# Aggregate loaded segments, by writable (flash) or not (RAM).
188+
# Aggregate loaded segments, by writable (RAM) or not (flash).
185189
segments = collected[SegmentDF.name]
186190
segments['segment'] = segments.index
187191
segments['wr'] = ((segments['flags'] & 2) != 0).convert_dtypes(

0 commit comments

Comments
 (0)