mirror of https://github.com/ARMmbed/mbed-os.git
Fix pylint in iar.py except for the long regex
parent
1712506de2
commit
c9674dc7f8
|
@ -21,7 +21,8 @@ from distutils.version import LooseVersion
|
||||||
|
|
||||||
from tools.targets import CORE_ARCH
|
from tools.targets import CORE_ARCH
|
||||||
from tools.toolchains.mbed_toolchain import mbedToolchain, TOOLCHAIN_PATHS
|
from tools.toolchains.mbed_toolchain import mbedToolchain, TOOLCHAIN_PATHS
|
||||||
from tools.utils import run_cmd, NotSupportedException
|
from tools.utils import run_cmd
|
||||||
|
|
||||||
|
|
||||||
class IAR(mbedToolchain):
|
class IAR(mbedToolchain):
|
||||||
OFFICIALLY_SUPPORTED = True
|
OFFICIALLY_SUPPORTED = True
|
||||||
|
@ -37,13 +38,22 @@ class IAR(mbedToolchain):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def check_executable():
|
def check_executable():
|
||||||
"""Returns True if the executable (arm-none-eabi-gcc) location
|
"""Returns True if the executable (arm-none-eabi-gcc) location
|
||||||
specified by the user exists OR the executable can be found on the PATH.
|
specified by the user exists OR the executable can be found on the
|
||||||
Returns False otherwise."""
|
PATH. Returns False otherwise."""
|
||||||
return mbedToolchain.generic_check_executable("IAR", 'iccarm', 2, "bin")
|
return mbedToolchain.generic_check_executable(
|
||||||
|
"IAR", 'iccarm', 2, "bin"
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, target, notify=None, macros=None, build_profile=None,
|
def __init__(self, target, notify=None, macros=None, build_profile=None,
|
||||||
build_dir=None):
|
build_dir=None):
|
||||||
mbedToolchain.__init__(self, target, notify, macros, build_dir=build_dir, build_profile=build_profile)
|
mbedToolchain.__init__(
|
||||||
|
self,
|
||||||
|
target,
|
||||||
|
notify,
|
||||||
|
macros,
|
||||||
|
build_dir=build_dir,
|
||||||
|
build_profile=build_profile
|
||||||
|
)
|
||||||
core = target.core
|
core = target.core
|
||||||
if CORE_ARCH[target.core] == 8:
|
if CORE_ARCH[target.core] == 8:
|
||||||
# Add linking time preprocessor macro DOMAIN_NS
|
# Add linking time preprocessor macro DOMAIN_NS
|
||||||
|
@ -65,8 +75,8 @@ class IAR(mbedToolchain):
|
||||||
"Cortex-M33F": "Cortex-M33.fp.no_dsp",
|
"Cortex-M33F": "Cortex-M33.fp.no_dsp",
|
||||||
"Cortex-M33FE": "Cortex-M33.fp"}.get(core, core)
|
"Cortex-M33FE": "Cortex-M33.fp"}.get(core, core)
|
||||||
|
|
||||||
# flags_cmd are used only by our scripts, the project files have them already defined,
|
# flags_cmd are used only by our scripts, the project files have them
|
||||||
# using this flags results in the errors (duplication)
|
# already defined, using this flags results in the errors (duplication)
|
||||||
# asm accepts --cpu Core or --fpu FPU, not like c/c++ --cpu=Core
|
# asm accepts --cpu Core or --fpu FPU, not like c/c++ --cpu=Core
|
||||||
asm_flags_cmd = ["--cpu", cpu]
|
asm_flags_cmd = ["--cpu", cpu]
|
||||||
# custom c flags
|
# custom c flags
|
||||||
|
@ -83,11 +93,20 @@ class IAR(mbedToolchain):
|
||||||
IAR_BIN = join(TOOLCHAIN_PATHS['IAR'], "bin")
|
IAR_BIN = join(TOOLCHAIN_PATHS['IAR'], "bin")
|
||||||
main_cc = join(IAR_BIN, "iccarm")
|
main_cc = join(IAR_BIN, "iccarm")
|
||||||
|
|
||||||
self.asm = [join(IAR_BIN, "iasmarm")] + asm_flags_cmd + self.flags["asm"]
|
self.asm = [join(IAR_BIN, "iasmarm")]
|
||||||
|
self.asm += asm_flags_cmd
|
||||||
|
self.asm += self.flags["asm"]
|
||||||
|
|
||||||
self.cc = [main_cc]
|
self.cc = [main_cc]
|
||||||
|
self.cc += self.flags["common"]
|
||||||
|
self.cc += c_flags_cmd
|
||||||
|
self.cc += self.flags["c"]
|
||||||
|
|
||||||
self.cppc = [main_cc]
|
self.cppc = [main_cc]
|
||||||
self.cc += self.flags["common"] + c_flags_cmd + self.flags["c"]
|
self.cppc += self.flags["common"]
|
||||||
self.cppc += self.flags["common"] + c_flags_cmd + cxx_flags_cmd + self.flags["cxx"]
|
self.cppc += c_flags_cmd
|
||||||
|
self.cppc += cxx_flags_cmd
|
||||||
|
self.cppc += self.flags["cxx"]
|
||||||
|
|
||||||
self.ld = [join(IAR_BIN, "ilinkarm")] + self.flags['ld']
|
self.ld = [join(IAR_BIN, "ilinkarm")] + self.flags['ld']
|
||||||
self.ar = join(IAR_BIN, "iarchive")
|
self.ar = join(IAR_BIN, "iarchive")
|
||||||
|
@ -113,10 +132,16 @@ class IAR(mbedToolchain):
|
||||||
"severity": "Warning",
|
"severity": "Warning",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
def _inner_parse_deps(self, dep_path):
|
||||||
|
for path in open(dep_path).readlines():
|
||||||
|
if path and not path.isspace():
|
||||||
|
if self.CHROOT:
|
||||||
|
yield self.CHROOT + path.strip()
|
||||||
|
else:
|
||||||
|
yield path.strip()
|
||||||
|
|
||||||
def parse_dependencies(self, dep_path):
|
def parse_dependencies(self, dep_path):
|
||||||
return [(self.CHROOT if self.CHROOT else '')+path.strip() for path in open(dep_path).readlines()
|
return list(self._inner_parse_deps(dep_path))
|
||||||
if (path and not path.isspace())]
|
|
||||||
|
|
||||||
def parse_output(self, output):
|
def parse_output(self, output):
|
||||||
msg = None
|
msg = None
|
||||||
|
@ -137,7 +162,8 @@ class IAR(mbedToolchain):
|
||||||
'toolchain_name': self.name
|
'toolchain_name': self.name
|
||||||
}
|
}
|
||||||
elif msg is not None:
|
elif msg is not None:
|
||||||
# Determine the warning/error column by calculating the ^ position
|
# Determine the warning/error column by calculating the '^'
|
||||||
|
# position
|
||||||
match = IAR.INDEX_PATTERN.match(line)
|
match = IAR.INDEX_PATTERN.match(line)
|
||||||
if match is not None:
|
if match is not None:
|
||||||
msg['col'] = len(match.group('col'))
|
msg['col'] = len(match.group('col'))
|
||||||
|
@ -165,7 +191,7 @@ class IAR(mbedToolchain):
|
||||||
opts = ['-D%s' % d for d in defines]
|
opts = ['-D%s' % d for d in defines]
|
||||||
if for_asm:
|
if for_asm:
|
||||||
config_macros = self.config.get_config_data_macros()
|
config_macros = self.config.get_config_data_macros()
|
||||||
macros_cmd = ['"-D%s"' % d for d in config_macros if not '"' in d]
|
macros_cmd = ['"-D%s"' % d for d in config_macros if '"' not in d]
|
||||||
if self.RESPONSE_FILES:
|
if self.RESPONSE_FILES:
|
||||||
via_file = self.make_option_file(
|
via_file = self.make_option_file(
|
||||||
macros_cmd, "asm_macros_{}.xcl")
|
macros_cmd, "asm_macros_{}.xcl")
|
||||||
|
@ -186,7 +212,9 @@ class IAR(mbedToolchain):
|
||||||
|
|
||||||
def assemble(self, source, object, includes):
|
def assemble(self, source, object, includes):
|
||||||
# Build assemble command
|
# Build assemble command
|
||||||
cmd = self.asm + self.get_compile_options(self.get_symbols(True), includes, True) + ["-o", object, source]
|
cmd = self.asm + self.get_compile_options(
|
||||||
|
self.get_symbols(True), includes, True
|
||||||
|
) + ["-o", object, source]
|
||||||
|
|
||||||
# Return command array, don't execute
|
# Return command array, don't execute
|
||||||
return [cmd]
|
return [cmd]
|
||||||
|
@ -194,13 +222,9 @@ class IAR(mbedToolchain):
|
||||||
def compile(self, cc, source, object, includes):
|
def compile(self, cc, source, object, includes):
|
||||||
# Build compile command
|
# Build compile command
|
||||||
cmd = cc + self.get_compile_options(self.get_symbols(), includes)
|
cmd = cc + self.get_compile_options(self.get_symbols(), includes)
|
||||||
|
|
||||||
cmd.extend(self.get_dep_option(object))
|
cmd.extend(self.get_dep_option(object))
|
||||||
|
|
||||||
cmd.extend(self.cc_extra(object))
|
cmd.extend(self.cc_extra(object))
|
||||||
|
|
||||||
cmd.extend(["-o", object, source])
|
cmd.extend(["-o", object, source])
|
||||||
|
|
||||||
return [cmd]
|
return [cmd]
|
||||||
|
|
||||||
def compile_c(self, source, object, includes):
|
def compile_c(self, source, object, includes):
|
||||||
|
@ -212,7 +236,9 @@ class IAR(mbedToolchain):
|
||||||
def link(self, output, objects, libraries, lib_dirs, mem_map):
|
def link(self, output, objects, libraries, lib_dirs, mem_map):
|
||||||
# Build linker command
|
# Build linker command
|
||||||
map_file = splitext(output)[0] + ".map"
|
map_file = splitext(output)[0] + ".map"
|
||||||
cmd = self.ld + [ "-o", output, "--map=%s" % map_file] + objects + libraries
|
cmd = self.ld + ["-o", output, "--map=%s" % map_file]
|
||||||
|
cmd += objects
|
||||||
|
cmd += libraries
|
||||||
|
|
||||||
if mem_map:
|
if mem_map:
|
||||||
cmd.extend(["--config", mem_map])
|
cmd.extend(["--config", mem_map])
|
||||||
|
|
Loading…
Reference in New Issue