Fix to generate memory_usage key in report

pull/4887/head
Marcelo Salazar 2017-08-06 14:03:09 +01:00
parent 7053ef9412
commit 5469be4de0
2 changed files with 12 additions and 17 deletions

View File

@ -574,7 +574,7 @@ def build_project(src_paths, build_path, target, toolchain_name,
cur_result["elapsed_time"] = end - start cur_result["elapsed_time"] = end - start
cur_result["output"] = toolchain.get_output() + memap_table cur_result["output"] = toolchain.get_output() + memap_table
cur_result["result"] = "OK" cur_result["result"] = "OK"
cur_result["memory_usage"] = toolchain.map_outputs cur_result["memory_usage"] = memap_instance.mem_report
cur_result["bin"] = res cur_result["bin"] = res
cur_result["elf"] = splitext(res)[0] + ".elf" cur_result["elf"] = splitext(res)[0] + ".elf"
cur_result.update(toolchain.report) cur_result.update(toolchain.report)
@ -1324,7 +1324,7 @@ def print_build_memory_usage(report):
""" """
from prettytable import PrettyTable from prettytable import PrettyTable
columns_text = ['name', 'target', 'toolchain'] columns_text = ['name', 'target', 'toolchain']
columns_int = ['static_ram', 'stack', 'heap', 'total_ram', 'total_flash'] columns_int = ['static_ram', 'total_flash']
table = PrettyTable(columns_text + columns_int) table = PrettyTable(columns_text + columns_int)
for col in columns_text: for col in columns_text:
@ -1351,10 +1351,6 @@ def print_build_memory_usage(report):
record['toolchain_name'], record['toolchain_name'],
record['memory_usage'][-1]['summary'][ record['memory_usage'][-1]['summary'][
'static_ram'], 'static_ram'],
record['memory_usage'][-1]['summary']['stack'],
record['memory_usage'][-1]['summary']['heap'],
record['memory_usage'][-1]['summary'][
'total_ram'],
record['memory_usage'][-1]['summary'][ record['memory_usage'][-1]['summary'][
'total_flash'], 'total_flash'],
] ]

View File

@ -416,7 +416,6 @@ class mbedToolchain:
# Print output buffer # Print output buffer
self.output = str() self.output = str()
self.map_outputs = list() # Place to store memmap scan results in JSON like data structures
# uVisor spepcific rules # uVisor spepcific rules
if 'UVISOR' in self.target.features and 'UVISOR_SUPPORTED' in self.target.extra_labels: if 'UVISOR' in self.target.features and 'UVISOR_SUPPORTED' in self.target.extra_labels:
@ -1128,7 +1127,8 @@ class mbedToolchain:
self.progress("elf2bin", name) self.progress("elf2bin", name)
self.binary(r, elf, bin) self.binary(r, elf, bin)
self.map_outputs = self.mem_stats(map) # Initialize memap and process map file. This doesn't generate output.
self.mem_stats(map)
self.var("compile_succeded", True) self.var("compile_succeded", True)
self.var("binary", filename) self.var("binary", filename)
@ -1193,8 +1193,7 @@ class mbedToolchain:
def mem_stats(self, map): def mem_stats(self, map):
"""! Creates parser object """! Creates parser object
@param map Path to linker map file to parse and decode @param map Path to linker map file to parse and decode
@return Memory summary structure with memory usage statistics @return None
None if map file can't be opened and processed
""" """
toolchain = self.__class__.__name__ toolchain = self.__class__.__name__
@ -1209,10 +1208,10 @@ class mbedToolchain:
# Store the memap instance for later use # Store the memap instance for later use
self.memap_instance = memap self.memap_instance = memap
# Here we return memory statistics structure (constructed after # Note: memory statistics are not returned.
# call to generate_output) which contains raw data in bytes # Need call to generate_output later (depends on depth & output format)
# about sections + summary
return memap.mem_report return None
# Set the configuration data # Set the configuration data
def set_config_data(self, config_data): def set_config_data(self, config_data):