@@ -122,21 +122,27 @@ def add_result_to_report(report, result):
122
122
report [target ][toolchain ][id_name ].append (result_wrap )
123
123
124
124
def get_toolchain_name (target , toolchain_name ):
125
-
126
- if toolchain_name == "ARM" or toolchain_name == "ARMC6" :
127
- if ("ARM" in target .supported_toolchains or "ARMC6" in target .supported_toolchains ):
128
- return "ARMC6"
129
- elif ("ARMC5" in target .supported_toolchains ):
130
- if toolchain_name == "ARM" :
131
- return "ARM" #note that returning ARM here means, use ARMC5 toolchain
125
+ if int (target .build_tools_metadata ["version" ]) > 0 :
126
+ if toolchain_name == "ARM" or toolchain_name == "ARMC6" :
127
+ if ("ARM" in target .supported_toolchains or "ARMC6" in target .supported_toolchains ):
128
+ return "ARMC6"
129
+ elif ("ARMC5" in target .supported_toolchains ):
130
+ if toolchain_name == "ARM" :
131
+ return "ARM" #note that returning ARM here means, use ARMC5 toolchain
132
+ else :
133
+ return "ARMC6" #ARMC6 explicitly specified by user, try ARMC6 anyway although the target doesnt explicitly specify ARMC6, as ARMC6 is our default ARM toolchain
134
+ elif toolchain_name == "uARM" :
135
+ if ("ARMC5" in target .supported_toolchains ):
136
+ return "uARM" #use ARM_MICRO to use AC5+microlib
132
137
else :
133
- return "ARMC6" #ARMC6 explicitly specified by user, try ARMC6 anyway although the target doesnt explicitly specify ARMC6, as ARMC6 is our default ARM toolchain
134
- elif toolchain_name == "uARM" :
135
- if ("ARMC5" in target .supported_toolchains ):
136
- return "uARM" #use ARM_MICRO to use AC5+microlib
137
- else :
138
- target .default_toolchain = "uARM"
139
- return "ARMC6" #use AC6+microlib
138
+ target .default_toolchain = "uARM"
139
+ return "ARMC6" #use AC6+microlib
140
+ else :
141
+ if toolchain_name == "ARM" :
142
+ if CORE_ARCH [target .core ] == 8 :
143
+ return "ARMC6"
144
+ elif getattr (target , "default_toolchain" , None ) == "uARM" :
145
+ return "uARM"
140
146
141
147
return toolchain_name
142
148
@@ -295,17 +301,23 @@ def get_mbed_official_release(version):
295
301
return mbed_official_release
296
302
297
303
def target_supports_toolchain (target , toolchain_name ):
298
- if toolchain_name in target .supported_toolchains :
299
- return True
304
+ if int (target .build_tools_metadata ["version" ]) > 0 :
305
+ if toolchain_name in target .supported_toolchains :
306
+ return True
307
+ else :
308
+ if (toolchain_name == "ARM" ):
309
+ #we cant find ARM, see if one ARMC5, ARMC6 or uARM listed
310
+ return any (tc in target .supported_toolchains for tc in ("ARMC5" ,"ARMC6" ,"uARM" ))
311
+ if (toolchain_name == "ARMC6" ):
312
+ #we did not find ARMC6, but check for ARM is listed
313
+ return any (tc in target .supported_toolchains for tc in ("ARM" ,))
314
+ return False
300
315
else :
301
- if (toolchain_name == "ARM" ):
302
- #we cant find ARM, see if one ARMC5, ARMC6 or uARM listed
303
- return any (tc in target .supported_toolchains for tc in ("ARMC5" ,"ARMC6" ,"uARM" ))
304
- if (toolchain_name == "ARMC6" ):
305
- #we did not find ARMC6, but check for ARM is listed
306
- return any (tc in target .supported_toolchains for tc in ("ARM" ,))
307
-
308
- return False
316
+ ARM_COMPILERS = ("ARM" , "ARMC6" , "uARM" )
317
+ if toolchain_name in ARM_COMPILERS :
318
+ return any (tc in target .supported_toolchains for tc in ARM_COMPILERS )
319
+ else :
320
+ return toolchain_name in target .supported_toolchains
309
321
310
322
def prepare_toolchain (src_paths , build_dir , target , toolchain_name ,
311
323
macros = None , clean = False , jobs = 1 ,
@@ -336,7 +348,7 @@ def prepare_toolchain(src_paths, build_dir, target, toolchain_name,
336
348
# If the configuration object was not yet created, create it now
337
349
config = config or Config (target , src_paths , app_config = app_config )
338
350
target = config .target
339
-
351
+
340
352
if not target_supports_toolchain (target , toolchain_name ):
341
353
raise NotSupportedException (
342
354
"Target {} is not supported by toolchain {}" .format (
@@ -536,13 +548,13 @@ def build_project(src_paths, build_path, target, toolchain_name,
536
548
if clean and exists (build_path ):
537
549
rmtree (build_path )
538
550
mkdir (build_path )
539
-
551
+
540
552
toolchain = prepare_toolchain (
541
553
src_paths , build_path , target , toolchain_name , macros = macros ,
542
554
clean = clean , jobs = jobs , notify = notify , config = config ,
543
555
app_config = app_config , build_profile = build_profile , ignore = ignore )
544
556
toolchain .version_check ()
545
-
557
+
546
558
# The first path will give the name to the library
547
559
name = (name or toolchain .config .name or
548
560
basename (normpath (abspath (src_paths [0 ]))))
0 commit comments