Review fixes for uvision exporter,build_api and arm.py

pull/9888/head
Senthil Ramakrishnan 2019-02-25 12:47:04 -06:00
parent 22da2be37f
commit 4e7d34bbb6
3 changed files with 36 additions and 12 deletions

View File

@ -135,7 +135,6 @@ def get_toolchain_name(target, toolchain_name):
if ("ARMC5" in target.supported_toolchains):
return "uARM" #use ARM_MICRO to use AC5+microlib
else:
target.default_toolchain = "uARM"
return "ARMC6" #use AC6+microlib
else:
if toolchain_name == "ARM":
@ -310,7 +309,8 @@ def target_supports_toolchain(target, toolchain_name):
return any(tc in target.supported_toolchains for tc in ("ARMC5","ARMC6","uARM"))
if(toolchain_name == "ARMC6"):
#we did not find ARMC6, but check for ARM is listed
return any(tc in target.supported_toolchains for tc in ("ARM",))
return "ARM" in target.supported_toolchains
#return False in other cases
return False
else:
ARM_COMPILERS = ("ARM", "ARMC6", "uARM")
@ -354,7 +354,13 @@ def prepare_toolchain(src_paths, build_dir, target, toolchain_name,
"Target {} is not supported by toolchain {}".format(
target.name, toolchain_name))
toolchain_name = get_toolchain_name(target, toolchain_name)
selected_toolchain_name = get_toolchain_name(target, toolchain_name)
#If a target supports ARMC6 and we want to build UARM with it,
#then set the default_toolchain to uARM to link AC6 microlib.
if(selected_toolchain_name == "ARMC6" and toolchain_name == "uARM"):
target.default_toolchain = "uARM"
toolchain_name = selected_toolchain_name
try:
cur_tc = TOOLCHAIN_CLASSES[toolchain_name]
@ -993,7 +999,13 @@ def build_mbed_libs(target, toolchain_name, clean=False, macros=None,
Return - True if target + toolchain built correctly, False if not supported
"""
toolchain_name = get_toolchain_name(target, toolchain_name)
selected_toolchain_name = get_toolchain_name(target, toolchain_name)
#If a target supports ARMC6 and we want to build UARM with it,
#then set the default_toolchain to uARM to link AC6 microlib.
if(selected_toolchain_name == "ARMC6" and toolchain_name == "uARM"):
target.default_toolchain = "uARM"
toolchain_name = selected_toolchain_name
if report is not None:
start = time()

View File

@ -315,9 +315,15 @@ class UvisionArmc5(Uvision):
@classmethod
def is_target_supported(cls, target_name):
target = TARGET_MAP[target_name]
if not (set(target.supported_toolchains).intersection(
set(["ARMC5", "uARM"]))):
return False
if int(target.build_tools_metadata["version"]) > 0:
if not (set(target.supported_toolchains).intersection(
set(["ARMC5", "uARM"]))):
return False
else:
if not (set(target.supported_toolchains).intersection(
set(["ARM", "uARM"]))):
return False
if not DeviceCMSIS.check_supported(target_name):
return False
if "Cortex-A" in target.core:
@ -338,9 +344,15 @@ class UvisionArmc6(Uvision):
@classmethod
def is_target_supported(cls, target_name):
target = TARGET_MAP[target_name]
if not (set(target.supported_toolchains).intersection(
set(["ARM", "ARMC6", "uARM"]))):
return False
if int(target.build_tools_metadata["version"]) > 0:
if not (set(target.supported_toolchains).intersection(
set(["ARM", "ARMC6", "uARM"]))):
return False
else:
if not (set(target.supported_toolchains).intersection(
set(["ARMC6"]))):
return False
if not DeviceCMSIS.check_supported(target_name):
return False
if "Cortex-A" in target.core:

View File

@ -343,7 +343,7 @@ class ARM_STD(ARM):
ARM.__init__(self, target, notify, macros, build_dir=build_dir,
build_profile=build_profile)
#check only for ARMC5 because ARM_STD means using ARMC5, and thus supported_toolchains must include ARMC5
if not set(("ARMC5",)).intersection(set(target.supported_toolchains)):
if "ARMC5" not in target.supported_toolchains:
raise NotSupportedException("ARM compiler 5 support is required for ARM build")
class ARM_MICRO(ARM):
@ -356,7 +356,7 @@ class ARM_MICRO(ARM):
#At this point we already know that we want to use ARMC5+Microlib, so check for if they are supported
#For, AC6+Microlib we still use ARMC6 class
if not set(("uARM","ARMC5")).intersection(set(target.supported_toolchains)) == set(("uARM","ARMC5")):
if not set(("uARM","ARMC5")).issubset(set(target.supported_toolchains)):
raise NotSupportedException("ARM/uARM compiler support is required for ARM build")
ARM.__init__(self, target, notify, macros, build_dir=build_dir,
build_profile=build_profile)