Skip to content

Commit 56604a0

Browse files
author
Marcelo Salazar
committed
Fixed bug on memap (non-default output path)
Removed code that checks if the path to the map file matches with the selected toolchain.
1 parent cc3a382 commit 56604a0

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

tools/memap.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -342,28 +342,23 @@ def parse_map_file_iar(self, file_desc):
342342
else:
343343
self.module_add(name, size, section)
344344

345-
def search_objects(self, path, toolchain):
346-
""" Check whether the specified map file matches with the toolchain.
347-
Searches for object files and creates mapping: object --> module
345+
def search_objects(self, path):
346+
""" Searches for object files and creates mapping: object --> module
348347
349348
Positional arguments:
350349
path - the path to an object file
351-
toolchain - the toolchain used to build the object file
352350
"""
353351

354352
path = path.replace('\\', '/')
355353

356354
# check location of map file
357-
rex = r'^(.+\/)' + re.escape(toolchain) + r'\/(.+\.map)$'
355+
rex = r'^(.+)' + r'\/(.+\.map)$'
358356
test_rex = re.match(rex, path)
359357

360358
if test_rex:
361-
search_path = test_rex.group(1) + toolchain + '/mbed-os/'
359+
search_path = test_rex.group(1) + '/mbed-os/'
362360
else:
363-
# It looks this is not an mbed project
364-
# object-to-module mapping cannot be generated
365-
print "Warning: specified toolchain doesn't match with"\
366-
" path to the memory map file."
361+
print "Warning: this doesn't look like an mbed project"
367362
return
368363

369364
for root, _, obj_files in os.walk(search_path):
@@ -580,12 +575,12 @@ def parse(self, mapfile, toolchain):
580575
with open(mapfile, 'r') as file_input:
581576
if toolchain == "ARM" or toolchain == "ARM_STD" or\
582577
toolchain == "ARM_MICRO":
583-
self.search_objects(os.path.abspath(mapfile), "ARM")
578+
self.search_objects(os.path.abspath(mapfile))
584579
self.parse_map_file_armcc(file_input)
585580
elif toolchain == "GCC_ARM":
586581
self.parse_map_file_gcc(file_input)
587582
elif toolchain == "IAR":
588-
self.search_objects(os.path.abspath(mapfile), toolchain)
583+
self.search_objects(os.path.abspath(mapfile))
589584
self.parse_map_file_iar(file_input)
590585
else:
591586
result = False
@@ -597,7 +592,7 @@ def parse(self, mapfile, toolchain):
597592
def main():
598593
"""Entry Point"""
599594

600-
version = '0.3.11'
595+
version = '0.3.12'
601596

602597
# Parser handling
603598
parser = argparse.ArgumentParser(

0 commit comments

Comments
 (0)