Fixed bug on memap (non-default output path)

Removed code that checks if the path to the map file
matches with the selected toolchain.
pull/2612/head
Marcelo Salazar 2016-09-02 19:05:27 +03:00
parent cc3a3820db
commit 56604a04c8
1 changed files with 8 additions and 13 deletions

View File

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