diff --git a/tools/memap.py b/tools/memap.py index f70e18ddde7..669fc41a8bd 100644 --- a/tools/memap.py +++ b/tools/memap.py @@ -342,28 +342,23 @@ def parse_map_file_iar(self, file_desc): else: self.module_add(name, size, section) - def search_objects(self, path, toolchain): - """ Check whether the specified map file matches with the toolchain. - Searches for object files and creates mapping: object --> module + def search_objects(self, path): + """ Searches for object files and creates mapping: object --> module Positional arguments: path - the path to an object file - toolchain - the toolchain used to build the object file """ path = path.replace('\\', '/') # check location of map file - rex = r'^(.+\/)' + re.escape(toolchain) + r'\/(.+\.map)$' + rex = r'^(.+)' + r'\/(.+\.map)$' test_rex = re.match(rex, path) if test_rex: - search_path = test_rex.group(1) + toolchain + '/mbed-os/' + search_path = test_rex.group(1) + '/mbed-os/' else: - # It looks this is not an mbed project - # object-to-module mapping cannot be generated - print "Warning: specified toolchain doesn't match with"\ - " path to the memory map file." + print "Warning: this doesn't look like an mbed project" return for root, _, obj_files in os.walk(search_path): @@ -580,12 +575,12 @@ def parse(self, mapfile, toolchain): with open(mapfile, 'r') as file_input: if toolchain == "ARM" or toolchain == "ARM_STD" or\ toolchain == "ARM_MICRO": - self.search_objects(os.path.abspath(mapfile), "ARM") + self.search_objects(os.path.abspath(mapfile)) self.parse_map_file_armcc(file_input) elif toolchain == "GCC_ARM": self.parse_map_file_gcc(file_input) elif toolchain == "IAR": - self.search_objects(os.path.abspath(mapfile), toolchain) + self.search_objects(os.path.abspath(mapfile)) self.parse_map_file_iar(file_input) else: result = False @@ -597,7 +592,7 @@ def parse(self, mapfile, toolchain): def main(): """Entry Point""" - version = '0.3.11' + version = '0.3.12' # Parser handling parser = argparse.ArgumentParser(