mirror of https://github.com/ARMmbed/mbed-os.git
Build tools changes to support AC6 and AC5
parent
76f90c2544
commit
50eb4f9da8
|
@ -122,11 +122,21 @@ def add_result_to_report(report, result):
|
|||
report[target][toolchain][id_name].append(result_wrap)
|
||||
|
||||
def get_toolchain_name(target, toolchain_name):
|
||||
if toolchain_name == "ARM":
|
||||
if CORE_ARCH[target.core] == 8:
|
||||
|
||||
if toolchain_name == "ARM" or toolchain_name == "ARMC6" :
|
||||
if("ARM" in target.supported_toolchains or "ARMC6" in target.supported_toolchains):
|
||||
return "ARMC6"
|
||||
elif getattr(target, "default_toolchain", None) == "uARM":
|
||||
return "uARM"
|
||||
elif ("ARMC5" in target.supported_toolchains):
|
||||
if toolchain_name == "ARM":
|
||||
return "ARM" #note that returning ARM here means, use ARMC5 toolchain
|
||||
else:
|
||||
return None #ARMC6 explicitly specified by user, but target doesnt seem to support ARMC6, so return error.
|
||||
elif toolchain_name == "uARM":
|
||||
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
|
||||
|
||||
return toolchain_name
|
||||
|
||||
|
@ -284,13 +294,18 @@ def get_mbed_official_release(version):
|
|||
|
||||
return mbed_official_release
|
||||
|
||||
ARM_COMPILERS = ("ARM", "ARMC6", "uARM")
|
||||
def target_supports_toolchain(target, toolchain_name):
|
||||
if toolchain_name in ARM_COMPILERS:
|
||||
return any(tc in target.supported_toolchains for tc in ARM_COMPILERS)
|
||||
if toolchain_name in target.supported_toolchains:
|
||||
return True
|
||||
else:
|
||||
return toolchain_name in target.supported_toolchains
|
||||
if(toolchain_name == "ARM"):
|
||||
#we cant find ARM, see if one ARMC5, ARMC6 or uARM listed
|
||||
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 False
|
||||
|
||||
def prepare_toolchain(src_paths, build_dir, target, toolchain_name,
|
||||
macros=None, clean=False, jobs=1,
|
||||
|
@ -321,12 +336,14 @@ def prepare_toolchain(src_paths, build_dir, target, toolchain_name,
|
|||
# If the configuration object was not yet created, create it now
|
||||
config = config or Config(target, src_paths, app_config=app_config)
|
||||
target = config.target
|
||||
|
||||
if not target_supports_toolchain(target, toolchain_name):
|
||||
raise NotSupportedException(
|
||||
"Target {} is not supported by toolchain {}".format(
|
||||
target.name, toolchain_name))
|
||||
|
||||
toolchain_name = get_toolchain_name(target, toolchain_name)
|
||||
notify.debug("Selected toolchain: %s" % (toolchain_name))
|
||||
|
||||
try:
|
||||
cur_tc = TOOLCHAIN_CLASSES[toolchain_name]
|
||||
|
|
|
@ -342,9 +342,9 @@ class ARM_STD(ARM):
|
|||
build_profile=None, build_dir=None):
|
||||
ARM.__init__(self, target, notify, macros, build_dir=build_dir,
|
||||
build_profile=build_profile)
|
||||
if not set(("ARM", "uARM")).intersection(set(target.supported_toolchains)):
|
||||
raise NotSupportedException("ARM/uARM compiler support is required for ARM build")
|
||||
|
||||
#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)):
|
||||
raise NotSupportedException("ARM compiler 5 support is required for ARM build")
|
||||
|
||||
class ARM_MICRO(ARM):
|
||||
PATCHED_LIBRARY = False
|
||||
|
@ -353,13 +353,17 @@ class ARM_MICRO(ARM):
|
|||
silent=False, extra_verbose=False, build_profile=None,
|
||||
build_dir=None):
|
||||
target.default_toolchain = "uARM"
|
||||
|
||||
#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")):
|
||||
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)
|
||||
if not set(("ARM", "uARM")).intersection(set(target.supported_toolchains)):
|
||||
raise NotSupportedException("ARM/uARM compiler support is required for ARM build")
|
||||
|
||||
|
||||
class ARMC6(ARM_STD):
|
||||
OFFICIALLY_SUPPORTED = False
|
||||
OFFICIALLY_SUPPORTED = True
|
||||
SHEBANG = "#! armclang -E --target=arm-arm-none-eabi -x c"
|
||||
SUPPORTED_CORES = ["Cortex-M0", "Cortex-M0+", "Cortex-M3", "Cortex-M4",
|
||||
"Cortex-M4F", "Cortex-M7", "Cortex-M7F", "Cortex-M7FD",
|
||||
|
@ -378,9 +382,19 @@ class ARMC6(ARM_STD):
|
|||
raise NotSupportedException(
|
||||
"this compiler does not support the core %s" % target.core)
|
||||
|
||||
if not set(("ARM", "ARMC6")).intersection(set(target.supported_toolchains)):
|
||||
if not set(("ARM", "ARMC6", "uARM")).intersection(set(target.supported_toolchains)):
|
||||
raise NotSupportedException("ARM/ARMC6 compiler support is required for ARMC6 build")
|
||||
|
||||
if getattr(target, "default_toolchain", "ARMC6") == "uARM":
|
||||
if "-DMBED_RTOS_SINGLE_THREAD" not in self.flags['common']:
|
||||
self.flags['common'].append("-DMBED_RTOS_SINGLE_THREAD")
|
||||
if "-D__MICROLIB" not in self.flags['common']:
|
||||
self.flags['common'].append("-D__MICROLIB")
|
||||
if "-Wl,--library_type=microlib" not in self.flags['ld']:
|
||||
self.flags['ld'].append("-Wl,--library_type=microlib")
|
||||
if "-Wl,--library_type=microlib" not in self.flags['common']:
|
||||
self.flags['common'].append("-Wl,--library_type=microlib")
|
||||
|
||||
core = target.core
|
||||
if CORE_ARCH[target.core] == 8:
|
||||
if (not target.core.endswith("-NS")) and kwargs.get('build_dir', False):
|
||||
|
|
Loading…
Reference in New Issue