Skip to content

Commit 5469be4

Browse files
Marcelo SalazarMarcelo Salazar
authored andcommitted
Fix to generate memory_usage key in report
1 parent 7053ef9 commit 5469be4

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

tools/build_api.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ def build_project(src_paths, build_path, target, toolchain_name,
574574
cur_result["elapsed_time"] = end - start
575575
cur_result["output"] = toolchain.get_output() + memap_table
576576
cur_result["result"] = "OK"
577-
cur_result["memory_usage"] = toolchain.map_outputs
577+
cur_result["memory_usage"] = memap_instance.mem_report
578578
cur_result["bin"] = res
579579
cur_result["elf"] = splitext(res)[0] + ".elf"
580580
cur_result.update(toolchain.report)
@@ -1324,7 +1324,7 @@ def print_build_memory_usage(report):
13241324
"""
13251325
from prettytable import PrettyTable
13261326
columns_text = ['name', 'target', 'toolchain']
1327-
columns_int = ['static_ram', 'stack', 'heap', 'total_ram', 'total_flash']
1327+
columns_int = ['static_ram', 'total_flash']
13281328
table = PrettyTable(columns_text + columns_int)
13291329

13301330
for col in columns_text:
@@ -1351,10 +1351,6 @@ def print_build_memory_usage(report):
13511351
record['toolchain_name'],
13521352
record['memory_usage'][-1]['summary'][
13531353
'static_ram'],
1354-
record['memory_usage'][-1]['summary']['stack'],
1355-
record['memory_usage'][-1]['summary']['heap'],
1356-
record['memory_usage'][-1]['summary'][
1357-
'total_ram'],
13581354
record['memory_usage'][-1]['summary'][
13591355
'total_flash'],
13601356
]

tools/toolchains/__init__.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,6 @@ def __init__(self, target, notify=None, macros=None, silent=False,
416416

417417
# Print output buffer
418418
self.output = str()
419-
self.map_outputs = list() # Place to store memmap scan results in JSON like data structures
420419

421420
# uVisor spepcific rules
422421
if 'UVISOR' in self.target.features and 'UVISOR_SUPPORTED' in self.target.extra_labels:
@@ -585,13 +584,13 @@ def need_update(self, target, dependencies):
585584
# information about the library paths. Safe option: assume an update
586585
if not d or not exists(d):
587586
return True
588-
587+
589588
if not self.stat_cache.has_key(d):
590589
self.stat_cache[d] = stat(d).st_mtime
591590

592591
if self.stat_cache[d] >= target_mod_time:
593592
return True
594-
593+
595594
return False
596595

597596
def is_ignored(self, file_path):
@@ -852,7 +851,7 @@ def get_link_file(self, cmd):
852851
string = " ".join(cmd_list)
853852
f.write(string)
854853
return link_file
855-
854+
856855
# Generate response file for all objects when archiving.
857856
# ARM, GCC, IAR cross compatible
858857
def get_arch_file(self, objects):
@@ -1128,7 +1127,8 @@ def link_program(self, r, tmp_path, name):
11281127
self.progress("elf2bin", name)
11291128
self.binary(r, elf, bin)
11301129

1131-
self.map_outputs = self.mem_stats(map)
1130+
# Initialize memap and process map file. This doesn't generate output.
1131+
self.mem_stats(map)
11321132

11331133
self.var("compile_succeded", True)
11341134
self.var("binary", filename)
@@ -1193,8 +1193,7 @@ def var(self, key, value):
11931193
def mem_stats(self, map):
11941194
"""! Creates parser object
11951195
@param map Path to linker map file to parse and decode
1196-
@return Memory summary structure with memory usage statistics
1197-
None if map file can't be opened and processed
1196+
@return None
11981197
"""
11991198
toolchain = self.__class__.__name__
12001199

@@ -1209,10 +1208,10 @@ def mem_stats(self, map):
12091208
# Store the memap instance for later use
12101209
self.memap_instance = memap
12111210

1212-
# Here we return memory statistics structure (constructed after
1213-
# call to generate_output) which contains raw data in bytes
1214-
# about sections + summary
1215-
return memap.mem_report
1211+
# Note: memory statistics are not returned.
1212+
# Need call to generate_output later (depends on depth & output format)
1213+
1214+
return None
12161215

12171216
# Set the configuration data
12181217
def set_config_data(self, config_data):

0 commit comments

Comments
 (0)