Clone of official tools
Diff: toolchains/arm.py
- Revision:
- 31:8ea194f6145b
- Parent:
- 30:f12ce67666d0
- Child:
- 35:da9c89f8be7d
--- a/toolchains/arm.py Mon Aug 29 11:56:59 2016 +0100 +++ b/toolchains/arm.py Wed Jan 04 11:58:24 2017 -0600 @@ -15,12 +15,11 @@ limitations under the License. """ import re -from os.path import join, dirname, splitext, basename, exists +from os.path import join, dirname, splitext, basename from tools.toolchains import mbedToolchain, TOOLCHAIN_PATHS from tools.hooks import hook_tool from tools.utils import mkdir -import copy class ARM(mbedToolchain): LINKER_EXT = '.sct' @@ -31,19 +30,18 @@ INDEX_PATTERN = re.compile('(?P<col>\s*)\^') DEP_PATTERN = re.compile('\S+:\s(?P<file>.+)\n') + @staticmethod + def check_executable(): + """Returns True if the executable (armcc) location specified by the + user exists OR the executable can be found on the PATH. + Returns False otherwise.""" + return mbedToolchain.generic_check_executable("ARM", 'armcc', 2, 'bin') - DEFAULT_FLAGS = { - 'common': ["-c", "--gnu", - "-Otime", "--split_sections", "--apcs=interwork", - "--brief_diagnostics", "--restrict", "--multibyte_chars"], - 'asm': [], - 'c': ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"], - 'cxx': ["--cpp", "--no_rtti", "--no_vla"], - 'ld': [], - } - - def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False): - mbedToolchain.__init__(self, target, options, notify, macros, silent, extra_verbose=extra_verbose) + def __init__(self, target, notify=None, macros=None, + silent=False, extra_verbose=False, build_profile=None): + mbedToolchain.__init__(self, target, notify, macros, silent, + extra_verbose=extra_verbose, + build_profile=build_profile) if target.core == "Cortex-M0+": cpu = "Cortex-M0" @@ -62,18 +60,10 @@ main_cc = join(ARM_BIN, "armcc") self.flags['common'] += ["--cpu=%s" % cpu] - if "save-asm" in self.options: - self.flags['common'].extend(["--asm", "--interleave"]) - if "debug-info" in self.options: - self.flags['common'].append("-g") - self.flags['c'].append("-O0") - else: - self.flags['c'].append("-O3") - - self.asm = [main_cc] + self.flags['common'] + self.flags['asm'] + ["-I \""+ARM_INC+"\""] - self.cc = [main_cc] + self.flags['common'] + self.flags['c'] + ["-I \""+ARM_INC+"\""] - self.cppc = [main_cc] + self.flags['common'] + self.flags['c'] + self.flags['cxx'] + ["-I \""+ARM_INC+"\""] + self.asm = [main_cc] + self.flags['common'] + self.flags['asm'] + self.cc = [main_cc] + self.flags['common'] + self.flags['c'] + self.cppc = [main_cc] + self.flags['common'] + self.flags['c'] + self.flags['cxx'] self.ld = [join(ARM_BIN, "armlink")] self.sys_libs = [] @@ -97,6 +87,7 @@ if match is not None: if msg is not None: self.cc_info(msg) + msg = None msg = { 'severity': match.group('severity').lower(), 'file': match.group('file'), @@ -232,50 +223,8 @@ class ARM_STD(ARM): - def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False): - ARM.__init__(self, target, options, notify, macros, silent, extra_verbose=extra_verbose) - - # Run-time values - self.ld.extend(["--libpath", join(TOOLCHAIN_PATHS['ARM'], "lib")]) + pass class ARM_MICRO(ARM): PATCHED_LIBRARY = False - - def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False): - ARM.__init__(self, target, options, notify, macros, silent, extra_verbose=extra_verbose) - - # 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")])