mirror of https://github.com/ARMmbed/mbed-os.git
Build metadata check added
parent
7490b1c87f
commit
8624fdf0a7
|
@ -8250,7 +8250,7 @@
|
||||||
"detect_code": ["1703"],
|
"detect_code": ["1703"],
|
||||||
"macros_add": ["GD32E10X"],
|
"macros_add": ["GD32E10X"],
|
||||||
"release_versions": ["5"]
|
"release_versions": ["5"]
|
||||||
},
|
},
|
||||||
"TT_M4G9": {
|
"TT_M4G9": {
|
||||||
"inherits": ["Target"],
|
"inherits": ["Target"],
|
||||||
"core": "Cortex-M4",
|
"core": "Cortex-M4",
|
||||||
|
@ -8280,5 +8280,9 @@
|
||||||
"detect_code": ["8013"],
|
"detect_code": ["8013"],
|
||||||
"release_versions": ["5"],
|
"release_versions": ["5"],
|
||||||
"bootloader_supported": true
|
"bootloader_supported": true
|
||||||
|
},
|
||||||
|
"__build_tools_metadata__": {
|
||||||
|
"version": "1",
|
||||||
|
"public": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,21 +122,27 @@ def add_result_to_report(report, result):
|
||||||
report[target][toolchain][id_name].append(result_wrap)
|
report[target][toolchain][id_name].append(result_wrap)
|
||||||
|
|
||||||
def get_toolchain_name(target, toolchain_name):
|
def get_toolchain_name(target, toolchain_name):
|
||||||
|
if int(target.build_tools_metadata["version"]) > 0:
|
||||||
if toolchain_name == "ARM" or toolchain_name == "ARMC6" :
|
if toolchain_name == "ARM" or toolchain_name == "ARMC6" :
|
||||||
if("ARM" in target.supported_toolchains or "ARMC6" in target.supported_toolchains):
|
if("ARM" in target.supported_toolchains or "ARMC6" in target.supported_toolchains):
|
||||||
return "ARMC6"
|
return "ARMC6"
|
||||||
elif ("ARMC5" in target.supported_toolchains):
|
elif ("ARMC5" in target.supported_toolchains):
|
||||||
if toolchain_name == "ARM":
|
if toolchain_name == "ARM":
|
||||||
return "ARM" #note that returning ARM here means, use ARMC5 toolchain
|
return "ARM" #note that returning ARM here means, use ARMC5 toolchain
|
||||||
|
else:
|
||||||
|
return "ARMC6" #ARMC6 explicitly specified by user, try ARMC6 anyway although the target doesnt explicitly specify ARMC6, as ARMC6 is our default ARM toolchain
|
||||||
|
elif toolchain_name == "uARM":
|
||||||
|
if ("ARMC5" in target.supported_toolchains):
|
||||||
|
return "uARM" #use ARM_MICRO to use AC5+microlib
|
||||||
else:
|
else:
|
||||||
return "ARMC6" #ARMC6 explicitly specified by user, try ARMC6 anyway although the target doesnt explicitly specify ARMC6, as ARMC6 is our default ARM toolchain
|
target.default_toolchain = "uARM"
|
||||||
elif toolchain_name == "uARM":
|
return "ARMC6" #use AC6+microlib
|
||||||
if ("ARMC5" in target.supported_toolchains):
|
else:
|
||||||
return "uARM" #use ARM_MICRO to use AC5+microlib
|
if toolchain_name == "ARM":
|
||||||
else:
|
if CORE_ARCH[target.core] == 8:
|
||||||
target.default_toolchain = "uARM"
|
return "ARMC6"
|
||||||
return "ARMC6" #use AC6+microlib
|
elif getattr(target, "default_toolchain", None) == "uARM":
|
||||||
|
return "uARM"
|
||||||
|
|
||||||
return toolchain_name
|
return toolchain_name
|
||||||
|
|
||||||
|
@ -295,17 +301,23 @@ def get_mbed_official_release(version):
|
||||||
return mbed_official_release
|
return mbed_official_release
|
||||||
|
|
||||||
def target_supports_toolchain(target, toolchain_name):
|
def target_supports_toolchain(target, toolchain_name):
|
||||||
if toolchain_name in target.supported_toolchains:
|
if int(target.build_tools_metadata["version"]) > 0:
|
||||||
return True
|
if toolchain_name in target.supported_toolchains:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
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
|
||||||
else:
|
else:
|
||||||
if(toolchain_name == "ARM"):
|
ARM_COMPILERS = ("ARM", "ARMC6", "uARM")
|
||||||
#we cant find ARM, see if one ARMC5, ARMC6 or uARM listed
|
if toolchain_name in ARM_COMPILERS:
|
||||||
return any(tc in target.supported_toolchains for tc in ("ARMC5","ARMC6","uARM"))
|
return any(tc in target.supported_toolchains for tc in ARM_COMPILERS)
|
||||||
if(toolchain_name == "ARMC6"):
|
else:
|
||||||
#we did not find ARMC6, but check for ARM is listed
|
return toolchain_name in target.supported_toolchains
|
||||||
return any(tc in target.supported_toolchains for tc in ("ARM",))
|
|
||||||
|
|
||||||
return False
|
|
||||||
|
|
||||||
def prepare_toolchain(src_paths, build_dir, target, toolchain_name,
|
def prepare_toolchain(src_paths, build_dir, target, toolchain_name,
|
||||||
macros=None, clean=False, jobs=1,
|
macros=None, clean=False, jobs=1,
|
||||||
|
@ -336,7 +348,7 @@ def prepare_toolchain(src_paths, build_dir, target, toolchain_name,
|
||||||
# If the configuration object was not yet created, create it now
|
# If the configuration object was not yet created, create it now
|
||||||
config = config or Config(target, src_paths, app_config=app_config)
|
config = config or Config(target, src_paths, app_config=app_config)
|
||||||
target = config.target
|
target = config.target
|
||||||
|
|
||||||
if not target_supports_toolchain(target, toolchain_name):
|
if not target_supports_toolchain(target, toolchain_name):
|
||||||
raise NotSupportedException(
|
raise NotSupportedException(
|
||||||
"Target {} is not supported by toolchain {}".format(
|
"Target {} is not supported by toolchain {}".format(
|
||||||
|
@ -536,13 +548,13 @@ def build_project(src_paths, build_path, target, toolchain_name,
|
||||||
if clean and exists(build_path):
|
if clean and exists(build_path):
|
||||||
rmtree(build_path)
|
rmtree(build_path)
|
||||||
mkdir(build_path)
|
mkdir(build_path)
|
||||||
|
|
||||||
toolchain = prepare_toolchain(
|
toolchain = prepare_toolchain(
|
||||||
src_paths, build_path, target, toolchain_name, macros=macros,
|
src_paths, build_path, target, toolchain_name, macros=macros,
|
||||||
clean=clean, jobs=jobs, notify=notify, config=config,
|
clean=clean, jobs=jobs, notify=notify, config=config,
|
||||||
app_config=app_config, build_profile=build_profile, ignore=ignore)
|
app_config=app_config, build_profile=build_profile, ignore=ignore)
|
||||||
toolchain.version_check()
|
toolchain.version_check()
|
||||||
|
|
||||||
# The first path will give the name to the library
|
# The first path will give the name to the library
|
||||||
name = (name or toolchain.config.name or
|
name = (name or toolchain.config.name or
|
||||||
basename(normpath(abspath(src_paths[0]))))
|
basename(normpath(abspath(src_paths[0]))))
|
||||||
|
|
|
@ -103,6 +103,7 @@ def cached(func):
|
||||||
# need to be computed differently than regular attributes
|
# need to be computed differently than regular attributes
|
||||||
CUMULATIVE_ATTRIBUTES = ['extra_labels', 'macros', 'device_has', 'features', 'components']
|
CUMULATIVE_ATTRIBUTES = ['extra_labels', 'macros', 'device_has', 'features', 'components']
|
||||||
|
|
||||||
|
default_build_tools_metadata = {u'version':0, u'public':False}
|
||||||
|
|
||||||
def get_resolution_order(json_data, target_name, order, level=0):
|
def get_resolution_order(json_data, target_name, order, level=0):
|
||||||
""" Return the order in which target descriptions are searched for
|
""" Return the order in which target descriptions are searched for
|
||||||
|
@ -125,6 +126,9 @@ def get_resolution_order(json_data, target_name, order, level=0):
|
||||||
|
|
||||||
def target(name, json_data):
|
def target(name, json_data):
|
||||||
"""Construct a target object"""
|
"""Construct a target object"""
|
||||||
|
if name.startswith("_"):
|
||||||
|
raise Exception("Invalid target name '%s' specified, target name should not start with '_'" % name)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
resolution_order = get_resolution_order(json_data, name, [])
|
resolution_order = get_resolution_order(json_data, name, [])
|
||||||
except KeyError as exc:
|
except KeyError as exc:
|
||||||
|
@ -132,11 +136,13 @@ def target(name, json_data):
|
||||||
"target {} has an incomplete target definition".format(name)
|
"target {} has an incomplete target definition".format(name)
|
||||||
), exc)
|
), exc)
|
||||||
resolution_order_names = [tgt for tgt, _ in resolution_order]
|
resolution_order_names = [tgt for tgt, _ in resolution_order]
|
||||||
|
|
||||||
return Target(name=name,
|
return Target(name=name,
|
||||||
json_data={key: value for key, value in json_data.items()
|
json_data={key: value for key, value in json_data.items()
|
||||||
if key in resolution_order_names},
|
if key in resolution_order_names},
|
||||||
resolution_order=resolution_order,
|
resolution_order=resolution_order,
|
||||||
resolution_order_names=resolution_order_names)
|
resolution_order_names=resolution_order_names,
|
||||||
|
build_tools_metadata=json_data.get("__build_tools_metadata__", default_build_tools_metadata))
|
||||||
|
|
||||||
def generate_py_target(new_targets, name):
|
def generate_py_target(new_targets, name):
|
||||||
"""Add one or more new target(s) represented as a Python dictionary
|
"""Add one or more new target(s) represented as a Python dictionary
|
||||||
|
@ -151,11 +157,12 @@ def generate_py_target(new_targets, name):
|
||||||
total_data = {}
|
total_data = {}
|
||||||
total_data.update(new_targets)
|
total_data.update(new_targets)
|
||||||
total_data.update(base_targets)
|
total_data.update(base_targets)
|
||||||
|
|
||||||
return target(name, total_data)
|
return target(name, total_data)
|
||||||
|
|
||||||
class Target(namedtuple("Target", "name json_data resolution_order resolution_order_names")):
|
class Target(namedtuple("Target", "name json_data resolution_order resolution_order_names build_tools_metadata")):
|
||||||
"""An object to represent a Target (MCU/Board)"""
|
"""An object to represent a Target (MCU/Board)"""
|
||||||
|
|
||||||
# Default location of the 'targets.json' file
|
# Default location of the 'targets.json' file
|
||||||
__targets_json_location_default = os.path.join(
|
__targets_json_location_default = os.path.join(
|
||||||
os.path.dirname(os.path.abspath(__file__)), '..', '..', 'targets', 'targets.json')
|
os.path.dirname(os.path.abspath(__file__)), '..', '..', 'targets', 'targets.json')
|
||||||
|
|
Loading…
Reference in New Issue