@@ -210,7 +210,6 @@ def __str__(self):
210
210
211
211
class mbedToolchain :
212
212
VERBOSE = True
213
- ignore_ptrs = []
214
213
215
214
CORTEX_SYMBOLS = {
216
215
"Cortex-M0" : ["__CORTEX_M0" , "ARM_MATH_CM0" , "__CMSIS_RTOS" , "__MBED_CMSIS_RTOS_CM" ],
@@ -230,48 +229,70 @@ class mbedToolchain:
230
229
def __init__ (self , target , options = None , notify = None , macros = None , silent = False , extra_verbose = False ):
231
230
self .target = target
232
231
self .name = self .__class__ .__name__
232
+
233
+ # compile/assemble/link/binary hooks
233
234
self .hook = hooks .Hook (target , self )
234
- self .silent = silent
235
- self .output = ""
236
-
237
- self .legacy_ignore_dirs = LEGACY_IGNORE_DIRS - set ([target .name , LEGACY_TOOLCHAIN_NAMES [self .name ]])
238
-
239
- if notify :
240
- self .notify_fun = notify
241
- elif extra_verbose :
242
- self .notify_fun = self .print_notify_verbose
243
- else :
244
- self .notify_fun = self .print_notify
245
235
236
+ # Build options passed by -o flag
246
237
self .options = options if options is not None else []
247
-
248
- self .macros = macros or []
249
238
self .options .extend (BUILD_OPTIONS )
250
239
if self .options :
251
240
self .info ("Build Options: %s" % (', ' .join (self .options )))
252
241
253
- self .obj_path = join ("TARGET_" + target .name , "TOOLCHAIN_" + self .name )
254
-
242
+ # Toolchain flags
243
+ self .flags = deepcopy (self .DEFAULT_FLAGS )
244
+
245
+ # User-defined macros
246
+ self .macros = macros or []
247
+
248
+ # Macros generated from toolchain and target rules/features
255
249
self .symbols = None
250
+
251
+ # Labels generated from toolchain and target rules/features (used for selective build)
256
252
self .labels = None
253
+
257
254
self .has_config = False
255
+ # config_header_content will hold the content of the config header (if used)
256
+ self .config_header_content = None
258
257
258
+ # Non-incremental compile
259
259
self .build_all = False
260
+
261
+ # Build output dir
260
262
self .build_dir = None
261
263
self .timestamp = time ()
262
- self .jobs = 1
263
264
264
- self .CHROOT = None
265
+ # Output build naming based on target+toolchain combo (mbed 2.0 builds)
266
+ self .obj_path = join ("TARGET_" + target .name , "TOOLCHAIN_" + self .name )
267
+
268
+ # Number of concurrent build jobs. 0 means auto (based on host system cores)
269
+ self .jobs = 0
265
270
266
- self .mp_pool = None
271
+ self .CHROOT = None
272
+
273
+ # Ignore patterns from .mbedignore files
274
+ self .ignore_patterns = []
275
+
276
+ # Pre-mbed 2.0 ignore dirs
277
+ self .legacy_ignore_dirs = LEGACY_IGNORE_DIRS - set ([target .name , LEGACY_TOOLCHAIN_NAMES [self .name ]])
267
278
279
+ # Output notify function
280
+ if notify :
281
+ self .notify_fun = notify
282
+ elif extra_verbose :
283
+ self .notify_fun = self .print_notify_verbose
284
+ else :
285
+ self .notify_fun = self .print_notify
286
+
287
+ # Silent builds (no output)
288
+ self .silent = silent
289
+
290
+ # Print output buffer
291
+ self .output = ""
292
+
293
+ # uVisor spepcific rules
268
294
if 'UVISOR' in self .target .features and 'UVISOR_SUPPORTED' in self .target .extra_labels :
269
295
self .target .core = re .sub (r"F$" , '' , self .target .core )
270
-
271
- self .flags = deepcopy (self .DEFAULT_FLAGS )
272
-
273
- # config_header_content will hold the content of the config header (if used)
274
- self .config_header_content = None
275
296
276
297
def get_output (self ):
277
298
return self .output
@@ -325,10 +346,6 @@ def notify(self, event):
325
346
"""
326
347
return self .notify_fun (event , self .silent )
327
348
328
- def __exit__ (self ):
329
- if self .mp_pool is not None :
330
- self .mp_pool .terminate ()
331
-
332
349
def goanna_parse_line (self , line ):
333
350
if "analyze" in self .options :
334
351
return self .GOANNA_DIAGNOSTIC_PATTERN .match (line )
@@ -407,7 +424,7 @@ def need_update(self, target, dependencies):
407
424
return False
408
425
409
426
def is_ignored (self , file_path ):
410
- for pattern in self .ignore_ptrs :
427
+ for pattern in self .ignore_patterns :
411
428
if fnmatch .fnmatch (file_path , pattern ):
412
429
return True
413
430
return False
@@ -441,8 +458,8 @@ def scan_resources(self, path, exclude_paths=None, base_path=None):
441
458
lines = [l .strip () for l in lines ] # Strip whitespaces
442
459
lines = [l for l in lines if l != "" ] # Strip empty lines
443
460
lines = [l for l in lines if not re .match ("^#" ,l )] # Strip comment lines
444
- # Append root path to glob patterns and append patterns to ignore_ptrs
445
- self .ignore_ptrs .extend ([join (root ,line .strip ()) for line in lines ])
461
+ # Append root path to glob patterns and append patterns to ignore_patterns
462
+ self .ignore_patterns .extend ([join (root ,line .strip ()) for line in lines ])
446
463
447
464
for d in copy (dirs ):
448
465
dir_path = join (root , d )
0 commit comments