20
20
r'^\s+(.+)\s+(zero|const|ro code|inited|uninit)\s'
21
21
r'+0x(\w{8})\s+0x(\w+)\s+(.+)\s.+$' )
22
22
23
- RE_IS_TEST = re .compile (r'^(.+)\/.*TESTS\/.+\.map$' )
24
-
25
23
RE_CMDLINE_FILE_IAR = re .compile (r'^#\s+(.+\.o)' )
26
24
RE_LIBRARY_IAR = re .compile (r'^(.+\.a)\:.+$' )
27
25
RE_OBJECT_LIBRARY_IAR = re .compile (r'^\s+(.+\.o)\s.*' )
@@ -131,7 +129,7 @@ def check_new_section_gcc(self, line):
131
129
return False # everything else, means no change in section
132
130
133
131
134
- def parse_object_name_gcc (self , line , prefixes ):
132
+ def parse_object_name_gcc (self , line ):
135
133
""" Parse a path to object file
136
134
137
135
Positional arguments:
@@ -148,11 +146,6 @@ def parse_object_name_gcc(self, line, prefixes):
148
146
# corner case: certain objects are provided by the GCC toolchain
149
147
if 'arm-none-eabi' in line :
150
148
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
-
156
149
return object_name
157
150
158
151
else :
@@ -169,7 +162,7 @@ def parse_object_name_gcc(self, line, prefixes):
169
162
print "Unknown object name found in GCC map file: %s" % line
170
163
return '[misc]'
171
164
172
- def parse_section_gcc (self , line , prefixes ):
165
+ def parse_section_gcc (self , line ):
173
166
""" Parse data from a section of gcc map file
174
167
175
168
examples:
@@ -190,7 +183,7 @@ def parse_section_gcc(self, line, prefixes):
190
183
if is_section :
191
184
o_size = int (is_section .group (2 ), 16 )
192
185
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 ))
194
187
return [o_name , o_size ]
195
188
196
189
return ["" , 0 ]
@@ -204,11 +197,6 @@ def parse_map_file_gcc(self, file_desc):
204
197
205
198
current_section = 'unknown'
206
199
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
-
212
200
with file_desc as infile :
213
201
for line in infile :
214
202
if line .startswith ('Linker script and memory map' ):
@@ -223,7 +211,7 @@ def parse_map_file_gcc(self, file_desc):
223
211
elif next_section :
224
212
current_section = next_section
225
213
226
- object_name , object_size = self .parse_section_gcc (line , prefixes )
214
+ object_name , object_size = self .parse_section_gcc (line )
227
215
228
216
self .module_add (object_name , object_size , current_section )
229
217
0 commit comments