Clone of official tools
Diff: toolchains/arm.py
- Revision:
- 2:07730b0f452c
- Parent:
- 0:66f3b5499f7f
- Child:
- 5:f45a4ca92830
--- a/toolchains/arm.py Fri May 20 20:16:44 2016 +0100 +++ b/toolchains/arm.py Fri May 20 22:27:03 2016 +0100 @@ -23,6 +23,7 @@ from tools.utils import mkdir class ARM(mbedToolchain): + PROFILE = {} LINKER_EXT = '.sct' LIBRARY_EXT = '.ar' @@ -30,8 +31,8 @@ DIAGNOSTIC_PATTERN = re.compile('"(?P<file>[^"]+)", line (?P<line>\d+)( \(column (?P<column>\d+)\)|): (?P<severity>Warning|Error): (?P<message>.+)') DEP_PATTERN = re.compile('\S+:\s(?P<file>.+)\n') - 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, options=None, notify=None, macros=None, silent=False, extra_verbose=False, profile=None): + mbedToolchain.__init__(self, target, options, notify, macros, silent, extra_verbose=extra_verbose, profile=profile) if target.core == "Cortex-M0+": cpu = "Cortex-M0" @@ -43,11 +44,11 @@ cpu = target.core main_cc = join(ARM_BIN, "armcc") - common = ["-c", - "--cpu=%s" % cpu, "--gnu", + common = self.PROFILE.get('COMMON_FLAGS', ["-c", "--gnu", "-O3", "-Otime", "--split_sections", "--apcs=interwork", - "--brief_diagnostics", "--restrict", "--multibyte_chars" - ] + ]) + common.extend(["--cpu=%s" % cpu, "--brief_diagnostics", "--restrict", "--multibyte_chars"]) + common.extend(['-I%s' % ARM_INC]) if "save-asm" in self.options: common.extend(["--asm", "--interleave"]) @@ -56,23 +57,16 @@ common.append("-O0") else: common.append("-O3") + # add debug symbols for all builds common.append("-g") - common_c = [ - "--md", "--no_depend_system_headers", - '-I%s' % ARM_INC - ] + common_c = self.PROFILE.get('COMMON_C_FLAGS', ["--no_depend_system_headers"]) + ['--md'] - self.asm = [main_cc] + common + ['-I%s' % ARM_INC] - if not "analyze" in self.options: - self.cc = [main_cc] + common + common_c + ["--c99"] - self.cppc = [main_cc] + common + common_c + ["--cpp", "--no_rtti"] - else: - self.cc = [join(GOANNA_PATH, "goannacc"), "--with-cc=" + main_cc.replace('\\', '/'), "--dialect=armcc", '--output-format="%s"' % self.GOANNA_FORMAT] + common + common_c + ["--c99"] - self.cppc= [join(GOANNA_PATH, "goannac++"), "--with-cxx=" + main_cc.replace('\\', '/'), "--dialect=armcc", '--output-format="%s"' % self.GOANNA_FORMAT] + common + common_c + ["--cpp", "--no_rtti"] - - self.ld = [join(ARM_BIN, "armlink")] + self.asm = [main_cc] + common + self.cc = [main_cc] + common + common_c + self.PROFILE.get('COMMON_CC_FLAGS', ["--c99"]) + self.cppc = [main_cc] + common + common_c + self.PROFILE.get('COMMON_CPP_FLAGS', ["--cpp", "--no_rtti"]) + self.ld = [join(ARM_BIN, "armlink")] + rofile.get('COMMON_LD_FLAGS', []) self.sys_libs = [] self.ar = join(ARM_BIN, "armar") @@ -211,8 +205,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) + def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False, profile=None): + ARM.__init__(self, target, options, notify, macros, silent, extra_verbose=extra_verbose, profile=profile) self.cc += ["-D__ASSERT_MSG"] self.cppc += ["-D__ASSERT_MSG"] self.ld.extend(["--libpath", ARM_LIB]) @@ -221,8 +215,8 @@ 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) + def __init__(self, target, options=None, notify=None, macros=None, silent=False, extra_verbose=False, profile=None): + ARM.__init__(self, target, options, notify, macros, silent, extra_verbose=extra_verbose, profile=profile) # Compiler self.asm += ["-D__MICROLIB"]