Skip to content

Commit c0f53cc

Browse files
Marcelo SalazarMarcelo Salazar
authored andcommitted
[memap] Removing stack/heap and minor improvements
- Removing stack & heap (dynamic) RAM information This information was misleading and shouldn't be shown in memap. E.g. each task may have its own stack region configured at run time. - Adding 'bytes' unit in the total memory info - Right aligment of numbers, so it is easier to compare numbers
1 parent 703aee4 commit c0f53cc

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

tools/memap.py

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,9 @@ def generate_output(self, export_format, file_output=None):
369369
table = PrettyTable(columns)
370370
table.align["Module"] = "l"
371371

372+
for i in list(self.print_sections):
373+
table.align[i] = 'r'
374+
372375
subtotal = dict()
373376
for k in self.sections:
374377
subtotal[k] = 0
@@ -399,10 +402,7 @@ def generate_output(self, export_format, file_output=None):
399402
if export_format == 'json':
400403
json_obj.append({\
401404
'summary':{\
402-
'static_ram':(subtotal['.data']+subtotal['.bss']),\
403-
'heap':(subtotal['.heap']),\
404-
'stack':(subtotal['.stack']),\
405-
'total_ram':(subtotal['.data']+subtotal['.bss']+subtotal['.heap']+subtotal['.stack']),\
405+
'total_static_ram':(subtotal['.data']+subtotal['.bss']),\
406406
'total_flash':(subtotal['.text']+subtotal['.data']+misc_flash_mem),}})
407407

408408
file_desc.write(json.dumps(json_obj, indent=4))
@@ -419,18 +419,9 @@ def generate_output(self, export_format, file_output=None):
419419
csv_module_section += [i+k]
420420
csv_sizes += [self.modules[i][k]]
421421

422-
csv_module_section += ['static_ram']
422+
csv_module_section += ['total_static_ram']
423423
csv_sizes += [subtotal['.data']+subtotal['.bss']]
424424

425-
csv_module_section += ['heap']
426-
csv_sizes += [subtotal['.heap']]
427-
428-
csv_module_section += ['stack']
429-
csv_sizes += [subtotal['.stack']]
430-
431-
csv_module_section += ['total_ram']
432-
csv_sizes += [subtotal['.data']+subtotal['.bss']+subtotal['.heap']+subtotal['.stack']]
433-
434425
csv_module_section += ['total_flash']
435426
csv_sizes += [subtotal['.text']+subtotal['.data']+misc_flash_mem]
436427

@@ -440,11 +431,8 @@ def generate_output(self, export_format, file_output=None):
440431
else: # default format is 'table'
441432
file_desc.write(table.get_string())
442433
file_desc.write('\n')
443-
file_desc.write("Static RAM memory (data + bss): %s\n" % (str(subtotal['.data']+subtotal['.bss'])))
444-
file_desc.write("Heap: %s\n" % str(subtotal['.heap']))
445-
file_desc.write("Stack: %s\n" % str(subtotal['.stack']))
446-
file_desc.write("Total RAM memory (data + bss + heap + stack): %s\n" % (str(subtotal['.data']+subtotal['.bss']+subtotal['.heap']+subtotal['.stack'])))
447-
file_desc.write("Total Flash memory (text + data + misc): %s\n" % (str(subtotal['.text']+subtotal['.data']+misc_flash_mem)))
434+
file_desc.write("Total Static RAM memory (data + bss): %s bytes\n" % (str(subtotal['.data']+subtotal['.bss'])))
435+
file_desc.write("Total Flash memory (text + data + misc): %s bytes\n" % (str(subtotal['.text']+subtotal['.data']+misc_flash_mem)))
448436

449437
if file_desc is not sys.stdout:
450438
file_desc.close()
@@ -479,7 +467,7 @@ def parse(self, mapfile, toolchain):
479467

480468
def main():
481469

482-
version = '0.3.10'
470+
version = '0.3.11'
483471

484472
# Parser handling
485473
parser = argparse.ArgumentParser(description="Memory Map File Analyser for ARM mbed OS\nversion %s" % version)

0 commit comments

Comments
 (0)