Clone of official tools
Diff: toolchains/arm.py
- Revision:
- 20:835f6355470d
- Parent:
- 13:ab47a20b66f0
- Child:
- 21:4fdf0dd04f6f
--- a/toolchains/arm.py Fri Jul 15 13:11:30 2016 +0100 +++ b/toolchains/arm.py Fri Jul 15 15:28:09 2016 +0100 @@ -17,8 +17,8 @@ import re from os.path import join, dirname, splitext, basename, exists -from tools.toolchains import mbedToolchain -from tools.settings import ARM_BIN, ARM_INC, ARM_LIB, MY_ARM_CLIB, ARM_CPPLIB, GOANNA_PATH +from tools.toolchains import mbedToolchain, TOOLCHAIN_PATHS +from tools.settings import GOANNA_PATH from tools.hooks import hook_tool from tools.utils import mkdir import copy @@ -35,7 +35,7 @@ DEFAULT_FLAGS = { 'common': ["-c", "--gnu", "-Otime", "--split_sections", "--apcs=interwork", - "--brief_diagnostics", "--restrict", "--multibyte_chars", "-I \""+ARM_INC+"\""], + "--brief_diagnostics", "--restrict", "--multibyte_chars"], 'asm': [], 'c': ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"], 'cxx': ["--cpp", "--no_rtti", "--no_vla"], @@ -56,6 +56,9 @@ else: cpu = target.core + ARM_BIN = join(TOOLCHAIN_PATHS['ARM'], "bin") + ARM_INC = join(TOOLCHAIN_PATHS['ARM'], "include") + main_cc = join(ARM_BIN, "armcc") self.flags['common'] += ["--cpu=%s" % cpu] @@ -68,13 +71,13 @@ else: self.flags['c'].append("-O3") - self.asm = [main_cc] + self.flags['common'] + self.flags['asm'] + self.asm = [main_cc] + self.flags['common'] + self.flags['asm'] + ["-I \""+ARM_INC+"\""] if not "analyze" in self.options: - self.cc = [main_cc] + self.flags['common'] + self.flags['c'] - self.cppc = [main_cc] + self.flags['common'] + self.flags['c'] + self.flags['cxx'] + 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+"\""] else: - self.cc = [join(GOANNA_PATH, "goannacc"), "--with-cc=" + main_cc.replace('\\', '/'), "--dialect=armcc", '--output-format="%s"' % self.GOANNA_FORMAT] + self.flags['common'] + self.flags['c'] - self.cppc= [join(GOANNA_PATH, "goannac++"), "--with-cxx=" + main_cc.replace('\\', '/'), "--dialect=armcc", '--output-format="%s"' % self.GOANNA_FORMAT] + self.flags['common'] + self.flags['c'] + self.flags['cxx'] + self.cc = [join(GOANNA_PATH, "goannacc"), "--with-cc=" + main_cc.replace('\\', '/'), "--dialect=armcc", '--output-format="%s"' % self.GOANNA_FORMAT] + self.flags['common'] + self.flags['c'] + ["-I \""+ARM_INC+"\""] + self.cppc= [join(GOANNA_PATH, "goannac++"), "--with-cxx=" + main_cc.replace('\\', '/'), "--dialect=armcc", '--output-format="%s"' % self.GOANNA_FORMAT] + self.flags['common'] + self.flags['c'] + self.flags['cxx'] + ["-I \""+ARM_INC+"\""] self.ld = [join(ARM_BIN, "armlink")] self.sys_libs = [] @@ -116,7 +119,7 @@ dep_path = base + '.d' return ["--depend", dep_path] - def get_config_option(self, config_header) : + def get_config_option(self, config_header): return ['--preinclude=' + config_header] def get_compile_options(self, defines, includes): @@ -184,15 +187,8 @@ cmd = self.hook.get_cmdline_linker(cmd) # Split link command to linker executable + response file - link_files = join(dirname(output), ".link_files.txt") - with open(link_files, "wb") as f: - cmd_linker = cmd[0] - cmd_list = [] - for c in cmd[1:]: - if c: - cmd_list.append(('"%s"' % c) if not c.startswith('-') else c) - string = " ".join(cmd_list).replace("\\", "/") - f.write(string) + cmd_linker = cmd[0] + link_files = self.get_link_file(cmd[1:]) # Exec command self.default_cmd([cmd_linker, '--via', link_files]) @@ -227,7 +223,7 @@ ARM.__init__(self, target, options, notify, macros, silent, extra_verbose=extra_verbose) # Run-time values - self.ld.extend(["--libpath \"%s\"" % ARM_LIB]) + self.ld.extend(["--libpath \"%s\"" % join(TOOLCHAIN_PATHS['ARM'], "lib")]) class ARM_MICRO(ARM): @@ -260,13 +256,13 @@ self.ld += ["--noscanlib"] # System Libraries - self.sys_libs.extend([join(MY_ARM_CLIB, lib+".l") for lib in ["mc_p", "mf_p", "m_ps"]]) + 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(ARM_CPPLIB, lib+".l") for lib in ["cpp_ws", "cpprt_w"]]) + 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(ARM_CPPLIB, lib+".l") for lib in ["cpp_ps", "cpprt_p"]]) + 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 \"%s\"" % ARM_LIB]) + self.ld.extend(["--libpath \"%s\"" % join(TOOLCHAIN_PATHS['ARM'], "lib")])