Skip to content
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
15 changes: 14 additions & 1 deletion tools/build_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions tools/profiles/debug.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@
"cxx": ["--cpp", "--no_rtti", "--no_vla"],
"ld": []
},
"uARM": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bridadan @theotherjimmy
Why did we add another "toolchain" in order to use MicroLib instead of having something like this in arm.py?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hugueskamba The uARM toolchain was present in Mbed OS 2.0, so it would have been a breaking change to remove it. In Mbed OS 5.0 the default_lib parameter was added to GCC (and maybe IAR as well?). I always hoped we would eventually deprecate the uARM toolchain and use the default_lib in its place!

Copy link
Collaborator

@hugueskamba hugueskamba Oct 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bridadan,
Wouldn't removing uARM cause other changes? The first thing I see is the fact that the boot code is different. However, would it just be as simple as moving the stuff from mbed_boot_arm_micro.c to mbed_boot_arm_std.c, renaming mbed_boot_arm_std.c to mbed_boot_arm.c and adding a bunch of macros?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup like you said its more complicated than just changing the tools. I think that's one of the main reasons we didn't do it at the time. Changing all the device code would be a big effort that's for sure.

But yeah I think that's the general gist. I have to admit I'm not as familiar with the boot sequence requirements for uARM so I may be missing a few details.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uARM was one of the first toolchains as I recall, came after ARM.
We added much much later default_lib (when we wanted to use newlib with GCC ARM) and due to wide use of uARM back then (lot of small devices had it) it stayed for backward compatibility. Things changed after we moved to 5, rtos and thread safety.

"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",
Expand Down
10 changes: 10 additions & 0 deletions tools/profiles/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 7 additions & 0 deletions tools/profiles/save-asm.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,12 @@
"c": [],
"cxx": [],
"ld": []
},
"uARM": {
"common": ["--asm", "--interleave"],
"asm": [],
"c": [],
"cxx": [],
"ld": []
}
}
2 changes: 2 additions & 0 deletions tools/singletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
20 changes: 17 additions & 3 deletions tools/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand All @@ -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))
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
34 changes: 1 addition & 33 deletions tools/toolchains/arm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")])