|
58 | 58 | {"section": ".data", "size": 1648},
|
59 | 59 | {"section": ".text", "size": 740236}
|
60 | 60 | ],
|
61 |
| - "wr": [ |
62 |
| - {"wr": 0, "size": 262144}, |
63 |
| - {"wr": 1, "size": 74023} |
| 61 | + "region": [ |
| 62 | + {"region": "FLASH", "size": 262144}, |
| 63 | + {"region": "RAM", "size": 74023} |
64 | 64 | ]
|
65 | 65 | }
|
66 | 66 | }
|
|
77 | 77 | import memdf.report
|
78 | 78 | import memdf.select
|
79 | 79 | import memdf.util
|
80 |
| -import numpy as np # type: ignore |
81 |
| -from memdf import Config, ConfigDescription, DFs, SectionDF, SegmentDF |
| 80 | +from memdf import Config, ConfigDescription, DFs, SectionDF |
82 | 81 |
|
83 | 82 | PLATFORM_CONFIG_DIR = pathlib.Path('scripts/tools/memory/platform')
|
84 | 83 |
|
@@ -162,7 +161,8 @@ def main(argv):
|
162 | 161 | **CONFIG,
|
163 | 162 | }
|
164 | 163 | # 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'] |
| 164 | + config_desc['section.select']['default'] = [ |
| 165 | + '.text', '.rodata', '.data', '.bss'] |
166 | 166 |
|
167 | 167 | config = Config().init(config_desc)
|
168 | 168 | config.put('output.file', output)
|
@@ -197,32 +197,17 @@ def main(argv):
|
197 | 197 |
|
198 | 198 | collected: DFs = memdf.collect.collect_files(config, [binary])
|
199 | 199 |
|
200 |
| - # Aggregate loaded segments, by writable (RAM) or not (flash). |
201 |
| - segments = collected[SegmentDF.name] |
202 |
| - segments['segment'] = segments.index |
203 |
| - segments['wr'] = ((segments['flags'] & 2) != 0).convert_dtypes( |
204 |
| - convert_boolean=False, convert_integer=True) |
205 |
| - segment_summary = segments[segments['type'] == 'PT_LOAD'][[ |
206 |
| - 'wr', 'size' |
207 |
| - ]].groupby('wr').aggregate(np.sum).reset_index().astype( |
208 |
| - {'size': np.int64}) |
209 |
| - segment_summary.attrs['name'] = "wr" |
210 |
| - |
211 | 200 | sections = collected[SectionDF.name]
|
212 |
| - sections = sections.join(on='segment', |
213 |
| - how='left', |
214 |
| - other=segments, |
215 |
| - rsuffix='-segment') |
216 |
| - section_summary = sections[['section', 'size', |
217 |
| - 'wr']].sort_values(by='section') |
| 201 | + section_summary = sections[['section', |
| 202 | + 'size']].sort_values(by='section') |
218 | 203 | section_summary.attrs['name'] = "section"
|
219 | 204 |
|
220 |
| - region_summary = memdf.select.groupby(config, collected['section'], 'region') |
| 205 | + region_summary = memdf.select.groupby( |
| 206 | + config, collected['section'], 'region') |
221 | 207 | region_summary.attrs['name'] = "region"
|
222 | 208 |
|
223 | 209 | summaries = {
|
224 | 210 | 'section': section_summary,
|
225 |
| - 'memory': segment_summary, |
226 | 211 | 'region': region_summary,
|
227 | 212 | }
|
228 | 213 |
|
|
0 commit comments