15
15
limitations under the License.
16
16
"""
17
17
18
- import copy
19
-
20
- from os import walk , sep
21
- from os .path import splitext , basename , join , dirname , relpath
22
- from random import randint
18
+ from os .path import splitext , basename , join
23
19
from tools .utils import mkdir
24
20
from tools .export .gnuarmeclipse import GNUARMEclipse
25
21
from tools .export .gnuarmeclipse import UID
@@ -264,44 +260,6 @@ def __gen_dir(self, dir_name):
264
260
settings = join (self .export_dir , dir_name )
265
261
mkdir (settings )
266
262
267
- def build_excludelist (self ):
268
- """
269
- This method creates list for excluded directories.
270
- """
271
- self .source_folders = [self .filter_dot (s )
272
- for s in set (dirname (src ) for src in
273
- self .resources .c_sources +
274
- self .resources .cpp_sources +
275
- self .resources .s_sources )]
276
- if '.' in self .source_folders :
277
- self .source_folders .remove ('.' )
278
-
279
- top_folders = [f for f in set (s .split ('/' )[0 ]
280
- for s in self .source_folders )]
281
-
282
- for top_folder in top_folders :
283
- for root , dirs , files in walk (top_folder , topdown = True ):
284
- # Paths returned by os.walk() must be split with os.dep
285
- # to accomodate Windows weirdness.
286
- parts = root .split (sep )
287
- self .remove_unused ('/' .join (parts ))
288
-
289
- def remove_unused (self , path ):
290
- """
291
- Method for checking if path is needed.
292
- Method adds path to excluded list if not needed
293
- and is not subdirectory of already excluded directory
294
- """
295
- found = path in self .include_path
296
- needtoadd = True
297
- if not found :
298
- for directory in self .exclude_dirs :
299
- # Do not exclude subfolders from excluded folder
300
- if directory + '/' in path :
301
- needtoadd = False
302
- if needtoadd :
303
- self .exclude_dirs .append (path )
304
-
305
263
def get_fpu_hardware (self , fpu_unit ):
306
264
"""
307
265
Convert fpu unit name into hardware name.
@@ -394,21 +352,15 @@ def generate(self):
394
352
for s in self .resources .inc_dirs ]
395
353
print ('Include folders: {0}' .format (len (self .include_path )))
396
354
397
- self .exclude_dirs = []
398
- self .build_excludelist ()
355
+ self .compute_exclusions ()
399
356
400
- print ('Exclude folders: {0}' .format (len (self .exclude_dirs )))
401
-
402
- self .exclude_dirs = '|' .join (self .exclude_dirs )
357
+ print ('Exclude folders: {0}' .format (len (self .excluded_folders )))
403
358
404
359
ld_script = self .filter_dot (self .resources .linker_script )
405
360
print ('Linker script: {0}' .format (ld_script ))
406
361
407
362
lib_dirs = [self .filter_dot (s ) for s in self .resources .lib_dirs ]
408
363
409
- symbols = [s .replace ('"' , '"' )
410
- for s in self .toolchain .get_symbols ()]
411
-
412
364
for id in ['debug' , 'release' ]:
413
365
opts = {}
414
366
opts ['common' ] = {}
@@ -454,7 +406,13 @@ def generate(self):
454
406
455
407
self .process_sw_options (opts , flags )
456
408
457
- opts ['as' ]['defines' ] = self .as_defines
409
+ if opts ['as' ]['usepreprocessor' ]:
410
+ opts ['as' ]['other' ] += ' -x assembler-with-cpp'
411
+ for as_def in self .as_defines :
412
+ if '=' in as_def :
413
+ opts ['as' ]['other' ] += ' -Wa,--defsym ' + as_def
414
+ else :
415
+ opts ['as' ]['other' ] += ' -Wa,--defsym ' + as_def + '=1'
458
416
opts ['c' ]['defines' ] = self .c_defines
459
417
opts ['cpp' ]['defines' ] = self .cpp_defines
460
418
@@ -481,12 +439,11 @@ def generate(self):
481
439
'name' : self .project_name ,
482
440
'include_paths' : self .include_path ,
483
441
'config_header' : config_header ,
484
- 'exclude_paths' : self .exclude_dirs ,
442
+ 'exclude_paths' : '|' . join ( self .excluded_folders ) ,
485
443
'ld_script' : ld_script ,
486
444
'library_paths' : lib_dirs ,
487
445
'object_files' : self .resources .objects ,
488
446
'libraries' : libraries ,
489
- 'symbols' : symbols ,
490
447
'board_name' : self .BOARDS [self .target .upper ()]['name' ],
491
448
'mcu_name' : self .BOARDS [self .target .upper ()]['mcuId' ],
492
449
'cpp_cmd' : " " .join (self .toolchain .preproc ),
0 commit comments