Skip to content

Commit 4e7d34b

Browse files
committed
Review fixes for uvision exporter,build_api and arm.py
1 parent 22da2be commit 4e7d34b

File tree

3 files changed

+36
-12
lines changed

3 files changed

+36
-12
lines changed

tools/build_api.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ def get_toolchain_name(target, toolchain_name):
135135
if ("ARMC5" in target.supported_toolchains):
136136
return "uARM" #use ARM_MICRO to use AC5+microlib
137137
else:
138-
target.default_toolchain = "uARM"
139138
return "ARMC6" #use AC6+microlib
140139
else:
141140
if toolchain_name == "ARM":
@@ -310,7 +309,8 @@ def target_supports_toolchain(target, toolchain_name):
310309
return any(tc in target.supported_toolchains for tc in ("ARMC5","ARMC6","uARM"))
311310
if(toolchain_name == "ARMC6"):
312311
#we did not find ARMC6, but check for ARM is listed
313-
return any(tc in target.supported_toolchains for tc in ("ARM",))
312+
return "ARM" in target.supported_toolchains
313+
#return False in other cases
314314
return False
315315
else:
316316
ARM_COMPILERS = ("ARM", "ARMC6", "uARM")
@@ -354,7 +354,13 @@ def prepare_toolchain(src_paths, build_dir, target, toolchain_name,
354354
"Target {} is not supported by toolchain {}".format(
355355
target.name, toolchain_name))
356356

357-
toolchain_name = get_toolchain_name(target, toolchain_name)
357+
selected_toolchain_name = get_toolchain_name(target, toolchain_name)
358+
359+
#If a target supports ARMC6 and we want to build UARM with it,
360+
#then set the default_toolchain to uARM to link AC6 microlib.
361+
if(selected_toolchain_name == "ARMC6" and toolchain_name == "uARM"):
362+
target.default_toolchain = "uARM"
363+
toolchain_name = selected_toolchain_name
358364

359365
try:
360366
cur_tc = TOOLCHAIN_CLASSES[toolchain_name]
@@ -993,7 +999,13 @@ def build_mbed_libs(target, toolchain_name, clean=False, macros=None,
993999
Return - True if target + toolchain built correctly, False if not supported
9941000
"""
9951001

996-
toolchain_name = get_toolchain_name(target, toolchain_name)
1002+
selected_toolchain_name = get_toolchain_name(target, toolchain_name)
1003+
1004+
#If a target supports ARMC6 and we want to build UARM with it,
1005+
#then set the default_toolchain to uARM to link AC6 microlib.
1006+
if(selected_toolchain_name == "ARMC6" and toolchain_name == "uARM"):
1007+
target.default_toolchain = "uARM"
1008+
toolchain_name = selected_toolchain_name
9971009

9981010
if report is not None:
9991011
start = time()

tools/export/uvision/__init__.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,15 @@ class UvisionArmc5(Uvision):
315315
@classmethod
316316
def is_target_supported(cls, target_name):
317317
target = TARGET_MAP[target_name]
318-
if not (set(target.supported_toolchains).intersection(
319-
set(["ARMC5", "uARM"]))):
320-
return False
318+
if int(target.build_tools_metadata["version"]) > 0:
319+
if not (set(target.supported_toolchains).intersection(
320+
set(["ARMC5", "uARM"]))):
321+
return False
322+
else:
323+
if not (set(target.supported_toolchains).intersection(
324+
set(["ARM", "uARM"]))):
325+
return False
326+
321327
if not DeviceCMSIS.check_supported(target_name):
322328
return False
323329
if "Cortex-A" in target.core:
@@ -338,9 +344,15 @@ class UvisionArmc6(Uvision):
338344
@classmethod
339345
def is_target_supported(cls, target_name):
340346
target = TARGET_MAP[target_name]
341-
if not (set(target.supported_toolchains).intersection(
342-
set(["ARM", "ARMC6", "uARM"]))):
343-
return False
347+
if int(target.build_tools_metadata["version"]) > 0:
348+
if not (set(target.supported_toolchains).intersection(
349+
set(["ARM", "ARMC6", "uARM"]))):
350+
return False
351+
else:
352+
if not (set(target.supported_toolchains).intersection(
353+
set(["ARMC6"]))):
354+
return False
355+
344356
if not DeviceCMSIS.check_supported(target_name):
345357
return False
346358
if "Cortex-A" in target.core:

tools/toolchains/arm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ def __init__(self, target, notify=None, macros=None,
343343
ARM.__init__(self, target, notify, macros, build_dir=build_dir,
344344
build_profile=build_profile)
345345
#check only for ARMC5 because ARM_STD means using ARMC5, and thus supported_toolchains must include ARMC5
346-
if not set(("ARMC5",)).intersection(set(target.supported_toolchains)):
346+
if "ARMC5" not in target.supported_toolchains:
347347
raise NotSupportedException("ARM compiler 5 support is required for ARM build")
348348

349349
class ARM_MICRO(ARM):
@@ -356,7 +356,7 @@ def __init__(self, target, notify=None, macros=None,
356356

357357
#At this point we already know that we want to use ARMC5+Microlib, so check for if they are supported
358358
#For, AC6+Microlib we still use ARMC6 class
359-
if not set(("uARM","ARMC5")).intersection(set(target.supported_toolchains)) == set(("uARM","ARMC5")):
359+
if not set(("uARM","ARMC5")).issubset(set(target.supported_toolchains)):
360360
raise NotSupportedException("ARM/uARM compiler support is required for ARM build")
361361
ARM.__init__(self, target, notify, macros, build_dir=build_dir,
362362
build_profile=build_profile)

0 commit comments

Comments
 (0)