コード例 #1
0
ファイル: iar.py プロジェクト: genba/mbed
    def __init__(self, target, options=None, notify=None):
        mbedToolchain.__init__(self, target, options, notify)
        
        c_flags = [
            "-Oh",
            "--cpu=%s" % target.core, "--thumb",
            "--dlib_config", join(IAR_PATH, "inc", "c", "DLib_Config_Full.h"),
            "-e", # Enable IAR language extension
            "--no_wrap_diagnostics",
            # Pa050: No need to be notified about "non-native end of line sequence"
            # Pa084: Pointless integer comparison -> checks for the values of an enum, but we use values outside of the enum to notify errors (ie: NC).
            # Pa093: Implicit conversion from float to integer (ie: wait_ms(85.4) -> wait_ms(85))
            # Pa082: Operation involving two values from two registers (ie: (float)(*obj->MR)/(float)(LPC_PWM1->MR0))
            "--diag_suppress=Pa050,Pa084,Pa093,Pa082",
        ]

        if "debug-info" in self.options:
            c_flags.append("-r")
        
        IAR_BIN = join(IAR_PATH, "bin")
        main_cc = join(IAR_BIN, "iccarm")
        self.asm  = [join(IAR_BIN, "iasmarm")] + ["--cpu", target.core]
        if not "analyze" in self.options:
            self.cc   = [main_cc] + c_flags
            self.cppc = [main_cc, "--c++",  "--no_rtti", "--no_exceptions"] + c_flags
        else:
            self.cc   = [join(GOANNA_PATH, "goannacc"), '--with-cc="%s"' % main_cc.replace('\\', '/'), "--dialect=iar-arm", '--output-format="%s"' % self.GOANNA_FORMAT] + c_flags
            self.cppc = [join(GOANNA_PATH, "goannac++"), '--with-cxx="%s"' % main_cc.replace('\\', '/'), "--dialect=iar-arm", '--output-format="%s"' % self.GOANNA_FORMAT] + ["--c++", "--no_rtti", "--no_exceptions"] + c_flags
        self.ld   = join(IAR_BIN, "ilinkarm")
        self.ar = join(IAR_BIN, "iarchive")
        self.elf2bin = join(IAR_BIN, "ielftool")
コード例 #2
0
ファイル: gcc.py プロジェクト: jferreir/mbed
    def __init__(self, target, options=None, notify=None, macros=None, silent=False, tool_path=""):
        mbedToolchain.__init__(self, target, options, notify, macros, silent)

        if target.core == "Cortex-M0+":
            cpu = "cortex-m0plus"
        elif target.core == "Cortex-M4F":
            cpu = "cortex-m4"
        else:
            cpu = target.core.lower()

        self.cpu = ["-mcpu=%s" % cpu]
        if target.core.startswith("Cortex"):
            self.cpu.append("-mthumb")

        if target.core == "Cortex-M4F":
            self.cpu.append("-mfpu=fpv4-sp-d16")
            self.cpu.append("-mfloat-abi=softfp")

        if target.core == "Cortex-A9":
            self.cpu.append("-mthumb-interwork")
            self.cpu.append("-marm")
            self.cpu.append("-march=armv7-a")
            self.cpu.append("-mfpu=vfpv3")
            self.cpu.append("-mfloat-abi=hard")
            self.cpu.append("-mno-unaligned-access")


        # Note: We are using "-O2" instead of "-Os" to avoid this known GCC bug:
        # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46762
        common_flags = ["-c", "-Wall", "-Wextra",
            "-Wno-unused-parameter", "-Wno-missing-field-initializers",
            "-fmessage-length=0", "-fno-exceptions", "-fno-builtin",
            "-ffunction-sections", "-fdata-sections",
            "-MMD", "-fno-delete-null-pointer-checks", "-fomit-frame-pointer"
            ] + self.cpu

        if "save-asm" in self.options:
            common_flags.append("-save-temps")

        if "debug-info" in self.options:
            common_flags.append("-g")
            common_flags.append("-O0")
        else:
            common_flags.append("-O2")

        main_cc = join(tool_path, "arm-none-eabi-gcc")
        main_cppc = join(tool_path, "arm-none-eabi-g++")
        self.asm = [main_cc, "-x", "assembler-with-cpp"] + common_flags
        if not "analyze" in self.options:
            self.cc  = [main_cc, "-std=gnu99"] + common_flags
            self.cppc =[main_cppc, "-std=gnu++98", "-fno-rtti"] + common_flags
        else:
            self.cc  = [join(GOANNA_PATH, "goannacc"), "--with-cc=" + main_cc.replace('\\', '/'), "-std=gnu99", "--dialect=gnu", '--output-format="%s"' % self.GOANNA_FORMAT] + common_flags
            self.cppc= [join(GOANNA_PATH, "goannac++"), "--with-cxx=" + main_cppc.replace('\\', '/'), "-std=gnu++98", "-fno-rtti", "--dialect=gnu", '--output-format="%s"' % self.GOANNA_FORMAT] + common_flags

        self.ld = [join(tool_path, "arm-none-eabi-gcc"), "-Wl,--gc-sections", "-Wl,--wrap,main"] + self.cpu
        self.sys_libs = ["stdc++", "supc++", "m", "c", "gcc"]

        self.ar = join(tool_path, "arm-none-eabi-ar")
        self.elf2bin = join(tool_path, "arm-none-eabi-objcopy")
コード例 #3
0
ファイル: gcc.py プロジェクト: jtoews32/mbed
    def __init__(self, target, options=None, notify=None, macros=None, silent=False, tool_path=""):
        mbedToolchain.__init__(self, target, options, notify, macros, silent)

        if target.core == "Cortex-M0+":
            cpu = "cortex-m0plus"
        elif target.core == "Cortex-M4F":
            cpu = "cortex-m4"
        else:
            cpu = target.core.lower()

        self.cpu = ["-mcpu=%s" % cpu]
        if target.core.startswith("Cortex"):
            self.cpu.append("-mthumb")

        if target.core == "Cortex-M4F":
            self.cpu.append("-mfpu=fpv4-sp-d16")
            self.cpu.append("-mfloat-abi=softfp")

        if target.core == "Cortex-A9":
            self.cpu.append("-mthumb-interwork")
            self.cpu.append("-marm")
            self.cpu.append("-march=armv7-a")
            self.cpu.append("-mfpu=vfpv3")
            self.cpu.append("-mfloat-abi=hard")
            self.cpu.append("-mno-unaligned-access")


        # Note: We are using "-O2" instead of "-Os" to avoid this known GCC bug:
        # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46762
        common_flags = ["-c", "-Wall", "-Wextra",
            "-Wno-unused-parameter", "-Wno-missing-field-initializers",
            "-fmessage-length=0", "-fno-exceptions", "-fno-builtin",
            "-ffunction-sections", "-fdata-sections",
            "-MMD", "-fno-delete-null-pointer-checks", "-fomit-frame-pointer"
            ] + self.cpu

        if "save-asm" in self.options:
            common_flags.append("-save-temps")

        if "debug-info" in self.options:
            common_flags.append("-g")
            common_flags.append("-O0")
        else:
            common_flags.append("-O2")

        main_cc = join(tool_path, "arm-none-eabi-gcc")
        main_cppc = join(tool_path, "arm-none-eabi-g++")
        self.asm = [main_cc, "-x", "assembler-with-cpp"] + common_flags
        if not "analyze" in self.options:
            self.cc  = [main_cc, "-std=gnu99"] + common_flags
            self.cppc =[main_cppc, "-std=gnu++98", "-fno-rtti"] + common_flags
        else:
            self.cc  = [join(GOANNA_PATH, "goannacc"), "--with-cc=" + main_cc.replace('\\', '/'), "-std=gnu99", "--dialect=gnu", '--output-format="%s"' % self.GOANNA_FORMAT] + common_flags
            self.cppc= [join(GOANNA_PATH, "goannac++"), "--with-cxx=" + main_cppc.replace('\\', '/'), "-std=gnu++98", "-fno-rtti", "--dialect=gnu", '--output-format="%s"' % self.GOANNA_FORMAT] + common_flags

        self.ld = [join(tool_path, "arm-none-eabi-gcc"), "-Wl,--gc-sections", "-Wl,--wrap,main"] + self.cpu
        self.sys_libs = ["stdc++", "supc++", "m", "c", "gcc"]

        self.ar = join(tool_path, "arm-none-eabi-ar")
        self.elf2bin = join(tool_path, "arm-none-eabi-objcopy")
コード例 #4
0
ファイル: iar.py プロジェクト: bskup/tmk_keyboard_bskup
    def __init__(self, target, options=None, notify=None, macros=None, silent=False):
        mbedToolchain.__init__(self, target, options, notify, macros, silent)

        c_flags = [
            "--cpu=%s" % target.core, "--thumb",
            "--dlib_config", join(IAR_PATH, "inc", "c", "DLib_Config_Full.h"),
            "-e", # Enable IAR language extension
            "--no_wrap_diagnostics",
            # Pa050: No need to be notified about "non-native end of line sequence"
            # Pa084: Pointless integer comparison -> checks for the values of an enum, but we use values outside of the enum to notify errors (ie: NC).
            # Pa093: Implicit conversion from float to integer (ie: wait_ms(85.4) -> wait_ms(85))
            # Pa082: Operation involving two values from two registers (ie: (float)(*obj->MR)/(float)(LPC_PWM1->MR0))
            "--diag_suppress=Pa050,Pa084,Pa093,Pa082",
        ]

        if "debug-info" in self.options:
            c_flags.append("-r")
            c_flags.append("-On")
        else:
            c_flags.append("-Oh")

        IAR_BIN = join(IAR_PATH, "bin")
        main_cc = join(IAR_BIN, "iccarm")
        self.asm  = [join(IAR_BIN, "iasmarm")] + ["--cpu", target.core]
        if not "analyze" in self.options:
            self.cc   = [main_cc] + c_flags
            self.cppc = [main_cc, "--c++",  "--no_rtti", "--no_exceptions"] + c_flags
        else:
            self.cc   = [join(GOANNA_PATH, "goannacc"), '--with-cc="%s"' % main_cc.replace('\\', '/'), "--dialect=iar-arm", '--output-format="%s"' % self.GOANNA_FORMAT] + c_flags
            self.cppc = [join(GOANNA_PATH, "goannac++"), '--with-cxx="%s"' % main_cc.replace('\\', '/'), "--dialect=iar-arm", '--output-format="%s"' % self.GOANNA_FORMAT] + ["--c++", "--no_rtti", "--no_exceptions"] + c_flags
        self.ld   = join(IAR_BIN, "ilinkarm")
        self.ar = join(IAR_BIN, "iarchive")
        self.elf2bin = join(IAR_BIN, "ielftool")
コード例 #5
0
    def __init__(self, target, options=None, notify=None):
        mbedToolchain.__init__(self, target, options, notify)

        if target.core == "Cortex-M0+":
            cpu = "Cortex-M0"
        elif target.core == "Cortex-M4":
            cpu = "Cortex-M4.fp"
        else:
            cpu = target.core

        common = [
            join(ARM_BIN, "armcc"), "-c",
            "--cpu=%s" % cpu, "--gnu", "-Ospace", "--split_sections",
            "--apcs=interwork", "--brief_diagnostics", "--restrict"
        ]

        if "save-asm" in self.options:
            common.extend(["--asm", "--interleave"])

        if "debug-info" in self.options:
            common.append("-g")

        common_c = ["--md", "--no_depend_system_headers", '-I%s' % ARM_INC]

        self.asm = common
        self.cc = common + common_c + ["--c99"]
        self.cppc = common + common_c + ["--cpp", "--no_rtti"]

        self.ld = [join(ARM_BIN, "armlink")]
        self.sys_libs = []

        self.ar = join(ARM_BIN, "armar")
        self.elf2bin = join(ARM_BIN, "fromelf")
コード例 #6
0
ファイル: iar.py プロジェクト: rsethuram/mbed
    def __init__(self, target, options=None, notify=None):
        mbedToolchain.__init__(self, target, options, notify)
        
        c_flags = [
            "-Oh",
            "--cpu=%s" % target.core, "--thumb",
            "--dlib_config", join(IAR_PATH, "inc", "c", "DLib_Config_Full.h"),
            "-e", # Enable IAR language extension
            "--no_wrap_diagnostics",
            # Pa050: No need to be notified about "non-native end of line sequence"
            # Pa084: Pointless integer comparison -> checks for the values of an enum, but we use values outside of the enum to notify errors (ie: NC).
            # Pa093: Implicit conversion from float to integer (ie: wait_ms(85.4) -> wait_ms(85))
            # Pa082: Operation involving two values from two registers (ie: (float)(*obj->MR)/(float)(LPC_PWM1->MR0))
            "--diag_suppress=Pa050,Pa084,Pa093,Pa082",
        ]

        if "debug-info" in self.options:
            c_flags.append("-r")
        
        IAR_BIN = join(IAR_PATH, "bin")
        self.asm  = [join(IAR_BIN, "iasmarm")] + ["--cpu", target.core]
        self.cc   = [join(IAR_BIN, "iccarm")] + c_flags
        self.cppc = [join(IAR_BIN, "iccarm"), "--c++",  "--no_rtti", "--no_exceptions"] + c_flags
        
        self.ld   = join(IAR_BIN, "ilinkarm")
        self.ar = join(IAR_BIN, "iarchive")
        self.elf2bin = join(IAR_BIN, "ielftool")
コード例 #7
0
    def __init__(self,
                 target,
                 options=None,
                 notify=None,
                 macros=None,
                 silent=False):
        mbedToolchain.__init__(self, target, options, notify, macros, silent)

        if target.core == "Cortex-M0+":
            cpu = "Cortex-M0"
        elif target.core == "Cortex-M4F":
            cpu = "Cortex-M4.fp"
        elif target.core == "Cortex-M7F":
            cpu = "Cortex-M7.fp.sp"
        else:
            cpu = target.core

        main_cc = join(ARM_BIN, "armcc")
        common = [
            "-c",
            "--cpu=%s" % cpu, "--gnu", "-Otime", "--split_sections",
            "--apcs=interwork", "--brief_diagnostics", "--restrict",
            "--multibyte_chars"
        ]

        if "save-asm" in self.options:
            common.extend(["--asm", "--interleave"])

        if "debug-info" in self.options:
            common.append("-g")
            common.append("-O0")
        else:
            common.append("-O3")

        common_c = ["--md", "--no_depend_system_headers", '-I%s' % ARM_INC]

        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.sys_libs = []

        self.ar = join(ARM_BIN, "armar")
        self.elf2bin = join(ARM_BIN, "fromelf")
コード例 #8
0
    def __init__(self, target, options=None, notify=None, tool_path=""):
        mbedToolchain.__init__(self, target, options, notify)

        if target.core == "Cortex-M0+":
            cpu = "cortex-m0"
        else:
            cpu = target.core.lower()

        self.cpu = ["-mcpu=%s" % cpu]
        if target.core.startswith("Cortex"):
            self.cpu.append("-mthumb")

        if target.core == "Cortex-M4":
            self.cpu.append("-mfpu=fpv4-sp-d16")
            self.cpu.append("-mfloat-abi=softfp")

        # Note: We are using "-O2" instead of "-Os" to avoid this known GCC bug:
        # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46762
        common_flags = [
            "-c",
            "-O2",
            "-Wall",
            "-Wextra",
            "-Wno-unused-parameter",
            "-Wno-missing-field-initializers",
            "-fmessage-length=0",
            "-fno-exceptions",
            "-fno-builtin",
            "-ffunction-sections",
            "-fdata-sections",
            "-MMD",
            "-fno-delete-null-pointer-checks",
        ] + self.cpu

        if "save-asm" in self.options:
            common_flags.append("-save-temps")

        if "debug-info" in self.options:
            common_flags.append("-g")

        self.asm = [join(tool_path, "arm-none-eabi-as")] + self.cpu

        self.cc = [join(tool_path, "arm-none-eabi-gcc"), "-std=gnu99"
                   ] + common_flags
        self.cppc = [join(tool_path, "arm-none-eabi-g++"), "-std=gnu++98"
                     ] + common_flags

        self.ld = [
            join(tool_path, "arm-none-eabi-gcc"), "-Wl,--gc-sections",
            "-Wl,--wrap,main"
        ] + self.cpu
        self.sys_libs = ["stdc++", "supc++", "m", "c", "gcc"]

        self.ar = join(tool_path, "arm-none-eabi-ar")
        self.elf2bin = join(tool_path, "arm-none-eabi-objcopy")
コード例 #9
0
ファイル: arm.py プロジェクト: Babody/mbed
    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)

        if target.core == "Cortex-M0+":
            cpu = "Cortex-M0"
        elif target.core == "Cortex-M4F":
            cpu = "Cortex-M4.fp"
        elif target.core == "Cortex-M7F":
            cpu = "Cortex-M7.fp.sp"
        else:
            cpu = target.core

        main_cc = join(ARM_BIN, "armcc")
        common = ["-c",
            "--cpu=%s" % cpu, "--gnu",
            "-Otime", "--split_sections", "--apcs=interwork",
            "--brief_diagnostics", "--restrict", "--multibyte_chars"
        ]

        if "save-asm" in self.options:
            common.extend(["--asm", "--interleave"])

        if "debug-info" in self.options:
            common.append("-g")
            common.append("-O0")
        else:
            common.append("-O3")

        common_c = [
            "--md", "--no_depend_system_headers",
            '-I%s' % ARM_INC
        ]

        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.sys_libs = []

        self.ar = join(ARM_BIN, "armar")
        self.elf2bin = join(ARM_BIN, "fromelf")
コード例 #10
0
ファイル: gcc.py プロジェクト: jbbmicro/mbed
    def __init__(self, target, options=None, notify=None, tool_path=""):
        mbedToolchain.__init__(self, target, options, notify)
        
        if target.core == "Cortex-M0+":
            cpu = "cortex-m0"
        else:
            cpu = target.core.lower()
        
        self.cpu = ["-mcpu=%s" % cpu]
        if target.core.startswith("Cortex"):
            self.cpu.append("-mthumb")
        
        if target.core == "Cortex-M4":
            self.cpu.append("-mfpu=fpv4-sp-d16")
            self.cpu.append("-mfloat-abi=softfp")
        
        # Note: We are using "-O2" instead of "-Os" to avoid this known GCC bug:
        # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46762
        common_flags = ["-c", "-O2", "-Wall", "-Wextra",
            "-Wno-unused-parameter", "-Wno-missing-field-initializers",
            "-fmessage-length=0", "-fno-exceptions", "-fno-builtin",
            "-ffunction-sections", "-fdata-sections",
            "-MMD", "-fno-delete-null-pointer-checks",
            ] + self.cpu
        
        if "save-asm" in self.options:
            common_flags.append("-save-temps")

        if "debug-info" in self.options:
            common_flags.append("-g")
        
        self.asm = [join(tool_path, "arm-none-eabi-as")] + self.cpu
        
        self.cc  = [join(tool_path, "arm-none-eabi-gcc"), "-std=gnu99"] + common_flags
        self.cppc =[join(tool_path, "arm-none-eabi-g++"), "-std=gnu++98"] + common_flags
        
        self.ld = [join(tool_path, "arm-none-eabi-gcc"), "-Wl,--gc-sections", "-Wl,--wrap,main"] + self.cpu
        self.sys_libs = ["stdc++", "supc++", "m", "c", "gcc"]
        
        self.ar = join(tool_path, "arm-none-eabi-ar")
        self.elf2bin = join(tool_path, "arm-none-eabi-objcopy")
コード例 #11
0
ファイル: arm.py プロジェクト: rsethuram/mbed
    def __init__(self, target, options=None, notify=None):
        mbedToolchain.__init__(self, target, options, notify)

        if target.core == "Cortex-M0+":
            cpu = "Cortex-M0"
        elif target.core == "Cortex-M4":
            cpu = "Cortex-M4.fp"
        else:
            cpu = target.core

        common = [
            join(ARM_BIN, "armcc"),
            "-c",
            "--cpu=%s" % cpu,
            "--gnu",
            "-Ospace",
            "--split_sections",
            "--apcs=interwork",
            "--brief_diagnostics",
            "--restrict",
        ]

        if "save-asm" in self.options:
            common.extend(["--asm", "--interleave"])

        if "debug-info" in self.options:
            common.append("-g")

        common_c = ["--md", "--no_depend_system_headers", "-I%s" % ARM_INC]

        self.asm = common
        self.cc = common + common_c + ["--c99"]
        self.cppc = common + common_c + ["--cpp", "--no_rtti"]

        self.ld = [join(ARM_BIN, "armlink")]
        self.sys_libs = []

        self.ar = join(ARM_BIN, "armar")
        self.elf2bin = join(ARM_BIN, "fromelf")
コード例 #12
0
ファイル: arm.py プロジェクト: fritzprix/mbed
    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)

        if target.core == "Cortex-M0+":
            cpu = "Cortex-M0"
        elif target.core == "Cortex-M4F":
            cpu = "Cortex-M4.fp"
        elif target.core == "Cortex-M7F":
            cpu = "Cortex-M7.fp.sp"
        else:
            cpu = target.core

        main_cc = join(ARM_BIN, "armcc")

        self.flags = self.DEFAULT_FLAGS
        self.flags['common'] += ["--cpu=%s" % cpu]
        if "save-asm" in self.options:
            self.flags['common'].extend(["--asm", "--interleave"])

        if "debug-info" in self.options:
            self.flags['common'].append("-g")
            self.flags['common'].append("-O0")
        else:
            self.flags['common'].append("-O3")

        self.asm = [main_cc] + self.flags['common'] + self.flags['asm']
        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']
        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.ld = [join(ARM_BIN, "armlink")]
        self.sys_libs = []

        self.ar = join(ARM_BIN, "armar")
        self.elf2bin = join(ARM_BIN, "fromelf")
コード例 #13
0
ファイル: arm.py プロジェクト: suse110/mbed
    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)

        if target.core == "Cortex-M0+":
            cpu = "Cortex-M0"
        elif target.core == "Cortex-M4F":
            cpu = "Cortex-M4.fp"
        elif target.core == "Cortex-M7F":
            cpu = "Cortex-M7.fp.sp"
        else:
            cpu = target.core

        main_cc = join(ARM_BIN, "armcc")

        self.flags = copy.deepcopy(self.DEFAULT_FLAGS)
        self.flags['common'] += ["--cpu=%s" % cpu]
        if "save-asm" in self.options:
            self.flags['common'].extend(["--asm", "--interleave"])

        if "debug-info" in self.options:
            self.flags['common'].append("-g")
            self.flags['c'].append("-O0")
        else:
            self.flags['c'].append("-O3")

        self.asm = [
            main_cc
        ] + self.flags['common'] + self.flags['asm'] + self.flags['c']
        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']
        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.ld = [join(ARM_BIN, "armlink")]
        self.sys_libs = []

        self.ar = join(ARM_BIN, "armar")
        self.elf2bin = join(ARM_BIN, "fromelf")