mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #4387 from theotherjimmy/override-target-attrs
Allow target attribute overrides in app config and pick toolchain with default_toolchainpull/4255/merge
commit
2886f0b407
|
@ -331,7 +331,7 @@ def prepare_toolchain(src_paths, build_dir, target, toolchain_name,
|
|||
extra_verbose - even more output!
|
||||
config - a Config object to use instead of creating one
|
||||
app_config - location of a chosen mbed_app.json file
|
||||
build_profile - a dict of flags that will be passed to the compiler
|
||||
build_profile - a list of mergeable build profiles
|
||||
"""
|
||||
|
||||
# We need to remove all paths which are repeated to avoid
|
||||
|
@ -345,12 +345,17 @@ def prepare_toolchain(src_paths, build_dir, target, toolchain_name,
|
|||
cur_tc = TOOLCHAIN_CLASSES[toolchain_name]
|
||||
except KeyError:
|
||||
raise KeyError("Toolchain %s not supported" % toolchain_name)
|
||||
if config.has_regions:
|
||||
add_regions_to_profile(build_profile, config, cur_tc)
|
||||
|
||||
# Toolchain instance
|
||||
profile = {'c': [], 'cxx': [], 'common': [], 'asm': [], 'ld': []}
|
||||
for contents in build_profile or []:
|
||||
for key in profile:
|
||||
profile[key].extend(contents[toolchain_name][key])
|
||||
|
||||
if config.has_regions:
|
||||
add_regions_to_profile(profile, config, cur_tc)
|
||||
|
||||
toolchain = cur_tc(target, notify, macros, silent, build_dir=build_dir,
|
||||
extra_verbose=extra_verbose, build_profile=build_profile)
|
||||
extra_verbose=extra_verbose, build_profile=profile)
|
||||
|
||||
toolchain.config = config
|
||||
toolchain.jobs = jobs
|
||||
|
|
|
@ -644,6 +644,10 @@ class Config(object):
|
|||
label)
|
||||
elif name in self.__unused_overrides:
|
||||
pass
|
||||
elif (name.startswith("target.") and
|
||||
unit_kind is "application"):
|
||||
_, attribute = name.split(".")
|
||||
setattr(self.target, attribute, val)
|
||||
else:
|
||||
self.config_errors.append(
|
||||
ConfigException(
|
||||
|
|
|
@ -108,16 +108,25 @@ def extract_profile(parser, options, toolchain, fallback="develop"):
|
|||
options - The parsed command line arguments
|
||||
toolchain - the toolchain that the profile should be extracted for
|
||||
"""
|
||||
profile = {'c': [], 'cxx': [], 'ld': [], 'common': [], 'asm': []}
|
||||
profiles = []
|
||||
filenames = options.profile or [join(dirname(__file__), "profiles",
|
||||
fallback + ".json")]
|
||||
for filename in filenames:
|
||||
contents = load(open(filename))
|
||||
try:
|
||||
for key in profile.iterkeys():
|
||||
profile[key] += contents[toolchain][key]
|
||||
except KeyError:
|
||||
if toolchain not in contents:
|
||||
args_error(parser, ("argument --profile: toolchain {} is not"
|
||||
" supported by profile {}").format(toolchain,
|
||||
filename))
|
||||
return profile
|
||||
profiles.append(contents)
|
||||
|
||||
return profiles
|
||||
|
||||
def mcu_is_enabled(parser, mcu):
|
||||
if "Cortex-A" in TARGET_MAP[mcu].core:
|
||||
args_error(
|
||||
parser,
|
||||
("%s Will be supported in mbed OS 5.6. "
|
||||
"To use the %s, please checkout the mbed OS 5.4 release branch. "
|
||||
"See https://developer.mbed.org/platforms/Renesas-GR-PEACH/#important-notice "
|
||||
"for more information") % (mcu, mcu))
|
||||
return True
|
||||
|
|
Loading…
Reference in New Issue