diff --git a/tools/build_api.py b/tools/build_api.py index 84a143484d..f8385f95c4 100644 --- a/tools/build_api.py +++ b/tools/build_api.py @@ -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 diff --git a/tools/config/__init__.py b/tools/config/__init__.py index 3f265f05af..37a02f66fb 100644 --- a/tools/config/__init__.py +++ b/tools/config/__init__.py @@ -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( diff --git a/tools/options.py b/tools/options.py index adcbe5fb9a..b4f7c2d258 100644 --- a/tools/options.py +++ b/tools/options.py @@ -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