Clone of official tools
Diff: toolchains/iar.py
- Revision:
- 36:96847d42f010
- Parent:
- 35:da9c89f8be7d
- Child:
- 40:7d3fa6b99b2b
--- a/toolchains/iar.py Wed Feb 15 13:53:18 2017 -0600 +++ b/toolchains/iar.py Thu Jun 22 11:12:28 2017 -0500 @@ -37,8 +37,10 @@ return mbedToolchain.generic_check_executable("IAR", 'iccarm', 2, "bin") def __init__(self, target, notify=None, macros=None, - silent=False, extra_verbose=False, build_profile=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 == "Cortex-M7F" or target.core == "Cortex-M7FD": @@ -89,6 +91,7 @@ self.cppc = [main_cc] self.cc += self.flags["common"] + c_flags_cmd + self.flags["c"] self.cppc += self.flags["common"] + c_flags_cmd + cxx_flags_cmd + self.flags["cxx"] + self.ld = [join(IAR_BIN, "ilinkarm")] self.ar = join(IAR_BIN, "iarchive") self.elf2bin = join(IAR_BIN, "ielftool") @@ -222,8 +225,10 @@ @hook_tool def binary(self, resources, elf, bin): + _, fmt = splitext(bin) + bin_arg = {".bin": "--bin", ".hex": "--ihex"}[fmt] # Build binary command - cmd = [self.elf2bin, "--bin", elf, bin] + cmd = [self.elf2bin, bin_arg, elf, bin] # Call cmdline hook cmd = self.hook.get_cmdline_binary(cmd) @@ -231,3 +236,15 @@ # Exec command self.cc_verbose("FromELF: %s" % ' '.join(cmd)) self.default_cmd(cmd) + + @staticmethod + def name_mangle(name): + return "_Z%i%sv" % (len(name), name) + + @staticmethod + def make_ld_define(name, value): + return "--config_def %s=0x%x" % (name, value) + + @staticmethod + def redirect_symbol(source, sync, build_dir): + return "--redirect %s=%s" % (source, sync)