diff --git a/tools/build_release.py b/tools/build_release.py index ec46e32293e..cdcfd4906bc 100644 --- a/tools/build_release.py +++ b/tools/build_release.py @@ -29,6 +29,7 @@ from tools.build_api import build_mbed_libs from tools.build_api import write_build_report from tools.build_api import get_mbed_official_release +from tools.options import extract_profile from tools.targets import TARGET_MAP, TARGET_NAMES from tools.test_exporters import ReportExporter, ResultExporterType from tools.test_api import SingleTestRunner @@ -48,6 +49,8 @@ default=False, help="Verbose diagnostic output") parser.add_option("-t", "--toolchains", dest="toolchains", help="Use toolchains names separated by comma") + parser.add_option("--profile", dest="profile", action="append", default=[]) + parser.add_option("-p", "--platforms", dest="platforms", default="", help="Build only for the platform namesseparated by comma") parser.add_option("-L", "--list-config", action="store_true", dest="list_config", @@ -127,6 +130,8 @@ test_spec["targets"][target_name] = toolchains single_test = SingleTestRunner(_muts=mut, + _parser=parser, + _opts=options, _opts_report_build_file_name=options.report_build_file_name, _test_spec=test_spec, _opts_test_by_names=",".join(test_names), @@ -162,8 +167,16 @@ for toolchain in toolchains: id = "%s::%s" % (target_name, toolchain) + profile = extract_profile(parser, options, toolchain) + try: - built_mbed_lib = build_mbed_libs(TARGET_MAP[target_name], toolchain, verbose=options.verbose, jobs=options.jobs, report=build_report, properties=build_properties) + built_mbed_lib = build_mbed_libs(TARGET_MAP[target_name], + toolchain, + verbose=options.verbose, + jobs=options.jobs, + report=build_report, + properties=build_properties, + build_profile=profile) except Exception, e: print str(e) diff --git a/tools/profiles/debug.json b/tools/profiles/debug.json index 5aced11431a..b463f0ab7c4 100644 --- a/tools/profiles/debug.json +++ b/tools/profiles/debug.json @@ -22,6 +22,16 @@ "cxx": ["--cpp", "--no_rtti", "--no_vla"], "ld": [] }, + "uARM": { + "common": ["-c", "--gnu", "-Otime", "--split_sections", + "--apcs=interwork", "--brief_diagnostics", "--restrict", + "--multibyte_chars", "-O0", "-D__MICROLIB", "-g" + "--library_type=microlib", "-DMBED_RTOS_SINGLE_THREAD"], + "asm": [], + "c": ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"], + "cxx": ["--cpp", "--no_rtti", "--no_vla"], + "ld": ["--library_type=microlib"] + }, "IAR": { "common": [ "--no_wrap_diagnostics", "non-native end of line sequence", "-e", diff --git a/tools/profiles/default.json b/tools/profiles/default.json index 49c7c95286b..d4755e9b81c 100644 --- a/tools/profiles/default.json +++ b/tools/profiles/default.json @@ -22,6 +22,16 @@ "cxx": ["--cpp", "--no_rtti", "--no_vla"], "ld": [] }, + "uARM": { + "common": ["-c", "--gnu", "-Otime", "--split_sections", + "--apcs=interwork", "--brief_diagnostics", "--restrict", + "--multibyte_chars", "-O3", "-D__MICROLIB", + "--library_type=microlib", "-DMBED_RTOS_SINGLE_THREAD"], + "asm": [], + "c": ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"], + "cxx": ["--cpp", "--no_rtti", "--no_vla"], + "ld": ["--library_type=microlib"] + }, "IAR": { "common": [ "--no_wrap_diagnostics", "-e", diff --git a/tools/profiles/save-asm.json b/tools/profiles/save-asm.json index fe4c0c8efd2..04128176d9e 100644 --- a/tools/profiles/save-asm.json +++ b/tools/profiles/save-asm.json @@ -12,5 +12,12 @@ "c": [], "cxx": [], "ld": [] + }, + "uARM": { + "common": ["--asm", "--interleave"], + "asm": [], + "c": [], + "cxx": [], + "ld": [] } } diff --git a/tools/singletest.py b/tools/singletest.py index bde208c5214..a07ecd4b231 100644 --- a/tools/singletest.py +++ b/tools/singletest.py @@ -225,6 +225,8 @@ def get_version(): _test_loops_list=opts.test_loops_list, _muts=MUTs, _clean=opts.clean, + _parser=parser, + _opts=opts, _opts_db_url=opts.db_url, _opts_log_file_name=opts.log_file_name, _opts_report_html_file_name=opts.report_html_file_name, diff --git a/tools/test_api.py b/tools/test_api.py index e4507582410..126328f3ad2 100644 --- a/tools/test_api.py +++ b/tools/test_api.py @@ -60,6 +60,7 @@ from tools.build_api import prepare_toolchain from tools.build_api import scan_resources from tools.libraries import LIBRARIES, LIBRARY_MAP +from tools.options import extract_profile from tools.toolchains import TOOLCHAIN_PATHS from tools.toolchains import TOOLCHAINS from tools.test_exporters import ReportExporter, ResultExporterType @@ -170,6 +171,8 @@ def __init__(self, _test_loops_list=None, _muts={}, _clean=False, + _parser=None, + _opts=None, _opts_db_url=None, _opts_log_file_name=None, _opts_report_html_file_name=None, @@ -258,6 +261,8 @@ def __init__(self, self.opts_consolidate_waterfall_test = _opts_consolidate_waterfall_test self.opts_extend_test_timeout = _opts_extend_test_timeout self.opts_clean = _clean + self.opts_parser = _parser + self.opts = _opts self.opts_auto_detect = _opts_auto_detect self.opts_include_non_automated = _opts_include_non_automated @@ -357,6 +362,8 @@ def execute_thread_slice(self, q, target, toolchains, clean, test_ids, build_rep clean_mbed_libs_options = True if self.opts_goanna_for_mbed_sdk or clean or self.opts_clean else None + profile = extract_profile(self.opts_parser, self.opts, toolchain) + try: build_mbed_libs_result = build_mbed_libs(T, @@ -365,7 +372,8 @@ def execute_thread_slice(self, q, target, toolchains, clean, test_ids, build_rep verbose=self.opts_verbose, jobs=self.opts_jobs, report=build_report, - properties=build_properties) + properties=build_properties, + build_profile=profile) if not build_mbed_libs_result: print self.logger.log_line(self.logger.LogType.NOTIF, 'Skipped tests for %s target. Toolchain %s is not yet supported for this target'% (T.name, toolchain)) @@ -433,7 +441,8 @@ def execute_thread_slice(self, q, target, toolchains, clean, test_ids, build_rep clean=clean_mbed_libs_options, jobs=self.opts_jobs, report=build_report, - properties=build_properties) + properties=build_properties, + build_profile=profile) except ToolException: print self.logger.log_line(self.logger.LogType.ERROR, 'There were errors while building library %s'% (lib_id)) @@ -484,7 +493,8 @@ def execute_thread_slice(self, q, target, toolchains, clean, test_ids, build_rep report=build_report, properties=build_properties, project_id=test_id, - project_description=test.get_description()) + project_description=test.get_description(), + build_profile=profile) except Exception, e: project_name_str = project_name if project_name is not None else test_id @@ -1784,6 +1794,10 @@ def get_default_test_options_parser(): action="store_true", help='Test only peripheral declared for MUT and skip common tests') + parser.add_argument("--profile", dest="profile", action="append", + type=argparse_filestring_type, + default=[]) + parser.add_argument('-C', '--only-commons', dest='test_only_common', default=False, diff --git a/tools/toolchains/arm.py b/tools/toolchains/arm.py index fc543959d54..5eb5387187d 100644 --- a/tools/toolchains/arm.py +++ b/tools/toolchains/arm.py @@ -240,37 +240,5 @@ def __init__(self, target, notify=None, macros=None, ARM.__init__(self, target, notify, macros, silent, extra_verbose=extra_verbose, build_profile=build_profile) - # Extend flags - self.flags['common'].extend(["-D__MICROLIB"]) - self.flags['c'].extend(["--library_type=microlib"]) - self.flags['ld'].extend(["--library_type=microlib"]) - # Run-time values - self.asm += ["-D__MICROLIB"] - self.cc += ["-D__MICROLIB", "--library_type=microlib"] - self.cppc += ["-D__MICROLIB", "--library_type=microlib"] - self.ld += ["--library_type=microlib"] - - # Only allow a single thread - self.cc += ["-DMBED_RTOS_SINGLE_THREAD"] - self.cppc += ["-DMBED_RTOS_SINGLE_THREAD"] - - # We had to patch microlib to add C++ support - # In later releases this patch should have entered mainline - if ARM_MICRO.PATCHED_LIBRARY: - # Run-time values - self.flags['ld'].extend(["--noscanlib"]) - # Run-time values - self.ld += ["--noscanlib"] - - # System Libraries - self.sys_libs.extend([join(TOOLCHAIN_PATHS['ARM'], "lib", "microlib", lib+".l") for lib in ["mc_p", "mf_p", "m_ps"]]) - - if target.core == "Cortex-M3": - self.sys_libs.extend([join(TOOLCHAIN_PATHS['ARM'], "lib", "cpplib", lib+".l") for lib in ["cpp_ws", "cpprt_w"]]) - - elif target.core in ["Cortex-M0", "Cortex-M0+"]: - self.sys_libs.extend([join(TOOLCHAIN_PATHS['ARM'], "lib", "cpplib", lib+".l") for lib in ["cpp_ps", "cpprt_p"]]) - else: - # Run-time values - self.ld.extend(["--libpath", join(TOOLCHAIN_PATHS['ARM'], "lib")]) + self.ld.extend(["--libpath", join(TOOLCHAIN_PATHS['ARM'], "lib")])