2020 r'^\s+(.+)\s+(zero|const|ro code|inited|uninit)\s'
2121 r'+0x(\w{8})\s+0x(\w+)\s+(.+)\s.+$' )
2222
23- RE_IS_TEST = re .compile (r'^(.+)\/.*TESTS\/.+\.map$' )
24-
2523RE_CMDLINE_FILE_IAR = re .compile (r'^#\s+(.+\.o)' )
2624RE_LIBRARY_IAR = re .compile (r'^(.+\.a)\:.+$' )
2725RE_OBJECT_LIBRARY_IAR = re .compile (r'^\s+(.+\.o)\s.*' )
@@ -131,7 +129,7 @@ def check_new_section_gcc(self, line):
131129 return False # everything else, means no change in section
132130
133131
134- def parse_object_name_gcc (self , line , prefixes ):
132+ def parse_object_name_gcc (self , line ):
135133 """ Parse a path to object file
136134
137135 Positional arguments:
@@ -148,11 +146,6 @@ def parse_object_name_gcc(self, line, prefixes):
148146 # corner case: certain objects are provided by the GCC toolchain
149147 if 'arm-none-eabi' in line :
150148 return '[lib]/misc/' + object_name
151-
152- for prefix in prefixes :
153- if object_name .startswith (prefix ):
154- return os .path .relpath (object_name , prefix )
155-
156149 return object_name
157150
158151 else :
@@ -169,7 +162,7 @@ def parse_object_name_gcc(self, line, prefixes):
169162 print "Unknown object name found in GCC map file: %s" % line
170163 return '[misc]'
171164
172- def parse_section_gcc (self , line , prefixes ):
165+ def parse_section_gcc (self , line ):
173166 """ Parse data from a section of gcc map file
174167
175168 examples:
@@ -190,7 +183,7 @@ def parse_section_gcc(self, line, prefixes):
190183 if is_section :
191184 o_size = int (is_section .group (2 ), 16 )
192185 if o_size :
193- o_name = self .parse_object_name_gcc (is_section .group (3 ), prefixes )
186+ o_name = self .parse_object_name_gcc (is_section .group (3 ))
194187 return [o_name , o_size ]
195188
196189 return ["" , 0 ]
@@ -204,11 +197,6 @@ def parse_map_file_gcc(self, file_desc):
204197
205198 current_section = 'unknown'
206199
207- prefixes = [os .path .abspath (os .path .dirname (file_desc .name ))]
208- is_test = re .match (RE_IS_TEST , file_desc .name )
209- if is_test :
210- prefixes .append (os .path .abspath (is_test .group (1 )))
211-
212200 with file_desc as infile :
213201 for line in infile :
214202 if line .startswith ('Linker script and memory map' ):
@@ -223,7 +211,7 @@ def parse_map_file_gcc(self, file_desc):
223211 elif next_section :
224212 current_section = next_section
225213
226- object_name , object_size = self .parse_section_gcc (line , prefixes )
214+ object_name , object_size = self .parse_section_gcc (line )
227215
228216 self .module_add (object_name , object_size , current_section )
229217
0 commit comments