Clone of official tools
Diff: toolchains/arm.py
- Revision:
- 29:1210849dba19
- Parent:
- 24:25bff2709c20
- Child:
- 30:f12ce67666d0
--- a/toolchains/arm.py Mon Aug 29 10:55:42 2016 +0100 +++ b/toolchains/arm.py Mon Aug 29 11:18:36 2016 +0100 @@ -15,12 +15,12 @@ limitations under the License. """ import re -from os.path import join, dirname, splitext, basename, exists +from os.path import join, dirname, splitext, basename +from distutils.spawn import find_executable 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' @@ -56,6 +56,11 @@ else: cpu = target.core + if not TOOLCHAIN_PATHS['ARM']: + exe = find_executable('armcc') + if exe: + TOOLCHAIN_PATHS['ARM'] = dirname(dirname(exe)) + ARM_BIN = join(TOOLCHAIN_PATHS['ARM'], "bin") ARM_INC = join(TOOLCHAIN_PATHS['ARM'], "include") @@ -81,6 +86,8 @@ self.ar = join(ARM_BIN, "armar") self.elf2bin = join(ARM_BIN, "fromelf") + self.toolchain_path = TOOLCHAIN_PATHS['ARM'] + def parse_dependencies(self, dep_path): dependencies = [] for line in open(dep_path).readlines(): @@ -128,16 +135,17 @@ def get_config_option(self, config_header): return ['--preinclude=' + config_header] - def get_compile_options(self, defines, includes): + def get_compile_options(self, defines, includes, for_asm=False): opts = ['-D%s' % d for d in defines] if self.RESPONSE_FILES: opts += ['--via', self.get_inc_file(includes)] else: opts += ["-I%s" % i for i in includes] - config_header = self.get_config_header() - if config_header is not None: - opts = opts + self.get_config_option(config_header) + if not for_asm: + config_header = self.get_config_header() + if config_header is not None: + opts = opts + self.get_config_option(config_header) return opts @hook_tool @@ -148,7 +156,7 @@ tempfile = join(dir, basename(object) + '.E.s') # Build preprocess assemble command - cmd_pre = self.asm + self.get_compile_options(self.get_symbols(), includes) + ["-E", "-o", tempfile, source] + cmd_pre = self.asm + self.get_compile_options(self.get_symbols(True), includes) + ["-E", "-o", tempfile, source] # Build main assemble command cmd = self.asm + ["-o", object, tempfile]