def __init__(self, target, notify=None, macros=None, build_profile=None, build_dir=None, coverage_patterns=None): mbedToolchain.__init__(self, target, notify, macros, build_dir=build_dir, build_profile=build_profile) if target.core not in self.SUPPORTED_CORES: raise NotSupportedException( "this compiler does not support the core %s" % target.core) self.check_c_lib_supported(target, "arm") if (getattr(target, "default_toolchain", "ARM") == "uARM" or getattr(target, "c_lib", "std") == "small"): if "-DMBED_RTOS_SINGLE_THREAD" not in self.flags['common']: self.flags['common'].append("-DMBED_RTOS_SINGLE_THREAD") if "-D__MICROLIB" not in self.flags['common']: self.flags['common'].append("-D__MICROLIB") if "--library_type=microlib" not in self.flags['ld']: self.flags['ld'].append("--library_type=microlib") if "--library_type=microlib" not in self.flags['common']: self.flags['common'].append("--library_type=microlib") self.check_and_add_minimal_printf(target) cpu = { "Cortex-M0+": "Cortex-M0plus", "Cortex-M4F": "Cortex-M4.fp.sp", "Cortex-M7F": "Cortex-M7.fp.sp", "Cortex-M7FD": "Cortex-M7.fp.dp" }.get(target.core, target.core) ARM_BIN = join(TOOLCHAIN_PATHS['ARM'], "bin") main_cc = join(ARM_BIN, "armcc") self.flags['common'] += ["--cpu=%s" % cpu] 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.flags['ld'] self.ar = join(ARM_BIN, "armar") self.elf2bin = join(ARM_BIN, "fromelf") self.SHEBANG += " --cpu=%s" % cpu self.product_name = None
def __init__(self, target, notify=None, macros=None, silent=False, extra_verbose=False, build_profile=None, build_dir=None): mbedToolchain.__init__(self, target, notify, macros, silent, build_dir=build_dir, extra_verbose=extra_verbose, build_profile=build_profile) if target.core not in self.SUPPORTED_CORES: raise NotSupportedException( "this compiler does not support the core %s" % target.core) if target.core == "Cortex-M0+": cpu = "Cortex-M0" elif target.core == "Cortex-M4F": cpu = "Cortex-M4.fp" elif target.core == "Cortex-M7FD": cpu = "Cortex-M7.fp.dp" elif target.core == "Cortex-M7F": cpu = "Cortex-M7.fp.sp" 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] 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.flags['ld'] self.ar = join(ARM_BIN, "armar") self.elf2bin = join(ARM_BIN, "fromelf") self.SHEBANG += " --cpu=%s" % cpu
def __init__(self, target, notify=None, macros=None, build_profile=None, build_dir=None): ARM.__init__(self, target, notify, macros, build_dir=build_dir, build_profile=build_profile) if "ARM" not in target.supported_toolchains: raise NotSupportedException( "ARM compiler support is required for ARM build")
def generate(self): """Generate the makefile Note: subclasses should not need to override this method """ self.resources.win_to_unix() to_be_compiled = [ splitext(src)[0] + ".o" for src in self.resources.s_sources + self.resources.c_sources + self.resources.cpp_sources ] libraries = [splitext(lib)[0][3:] for lib in self.resources.libraries] ctx = { 'name': self.project_name, 'to_be_compiled': to_be_compiled, 'object_files': self.resources.objects, 'include_paths': list(set(self.resources.inc_dirs)), 'library_paths': self.resources.lib_dirs, 'linker_script': self.resources.linker_script, 'libraries': libraries, 'hex_files': self.resources.hex_files, 'vpath': (["../../.."] if (basename(dirname(dirname(self.export_dir))) == "projectfiles") else [".."]), 'cc_cmd': " ".join(["\"" + part + "\"" for part in self.toolchain.cc]), 'cppc_cmd': " ".join(["\"" + part + "\"" for part in self.toolchain.cppc]), 'asm_cmd': " ".join(["\"" + part + "\"" for part in self.toolchain.asm]), 'ld_cmd': " ".join(["\"" + part + "\"" for part in self.toolchain.ld]), 'elf2bin_cmd': self.toolchain.elf2bin, 'link_script_ext': self.toolchain.LINKER_EXT, 'link_script_option': self.LINK_SCRIPT_OPTION, } for key in [ 'include_paths', 'library_paths', 'linker_script', 'hex_files' ]: if isinstance(ctx[key], list): ctx[key] = [ctx['vpath'][0] + "/" + t for t in ctx[key]] else: ctx[key] = ctx['vpath'][0] + "/" + ctx[key] if "../." not in ctx["include_paths"]: ctx["include_paths"] += ['../.'] for key in [ 'include_paths', 'library_paths', 'hex_files', 'to_be_compiled' ]: ctx[key] = sorted(ctx[key]) ctx.update(self.flags) for templatefile in \ ['makefile/%s_%s.tmpl' % (self.NAME.lower(), self.target.lower())] + \ ['makefile/%s_%s.tmpl' % (self.NAME.lower(), label.lower()) for label in self.toolchain.target.extra_labels] +\ ['makefile/%s.tmpl' % self.NAME.lower()]: try: self.gen_file(templatefile, ctx, 'Makefile') break except TemplateNotFound: pass else: raise NotSupportedException("This make tool is in development")