Skip to content

Allow target attribute overrides in app config and pick toolchain with default_toolchain #4387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions tools/build_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

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(build_profile, config, cur_tc)
add_regions_to_profile(profile, config, cur_tc)

# Toolchain instance
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
Expand Down
4 changes: 4 additions & 0 deletions tools/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,10 @@ def _process_config_and_overrides(self, data, params, unit_name, unit_kind):
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(
Expand Down
21 changes: 15 additions & 6 deletions tools/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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