mirror of https://github.com/ARMmbed/mbed-os.git
Use Non-blocking Error and LooseVersion
parent
6f54a8fdd7
commit
a87575fec5
|
@ -23,6 +23,7 @@ from os.path import join, dirname, splitext, basename, exists, relpath, isfile
|
|||
from os import makedirs, write, curdir, remove
|
||||
from tempfile import mkstemp
|
||||
from shutil import rmtree
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from tools.toolchains import mbedToolchain, TOOLCHAIN_PATHS
|
||||
from tools.hooks import hook_tool
|
||||
|
@ -39,8 +40,8 @@ class ARM(mbedToolchain):
|
|||
SHEBANG = "#! armcc -E"
|
||||
SUPPORTED_CORES = ["Cortex-M0", "Cortex-M0+", "Cortex-M3", "Cortex-M4",
|
||||
"Cortex-M4F", "Cortex-M7", "Cortex-M7F", "Cortex-M7FD", "Cortex-A9"]
|
||||
ARMCC_VERSION = "5.06"
|
||||
ARMCC_VERSION_RE = re.compile("^Product: ARM Compiler (.*)$")
|
||||
ARMCC_RANGE = (LooseVersion("5.06"), LooseVersion("5.07"))
|
||||
ARMCC_VERSION_RE = re.compile("^Product: ARM Compiler ([.0-9]*)")
|
||||
|
||||
@staticmethod
|
||||
def check_executable():
|
||||
|
@ -95,14 +96,29 @@ class ARM(mbedToolchain):
|
|||
|
||||
def version_check(self):
|
||||
stdout, _, retcode = run_cmd([self.cc[0], "--vsn"], redirect=True)
|
||||
msg = None
|
||||
min_ver, max_ver = self.ARMCC_RANGE
|
||||
first_line = stdout.splitlines()[0]
|
||||
match = self.ARMCC_VERSION_RE.match(first_line)
|
||||
if match:
|
||||
found_version = match.group(1)
|
||||
if not found_version.startswith(self.ARMCC_VERSION):
|
||||
raise NotSupportedException(
|
||||
"ARM compiler version mismatch: Have {}; expected {}"
|
||||
.format(found_version, self.ARMCC_VERSION))
|
||||
found_version = LooseVersion(match.group(1))
|
||||
if found_version < min_ver or found_version > max_ver:
|
||||
msg = ("Compiler version mismatch: Have {}; "
|
||||
"expected >= {} < {}"
|
||||
.format(found_version, min_ver, max_ver))
|
||||
else:
|
||||
msg = ("Compiler version mismatch: Could not detect version; "
|
||||
"expected >= {} < {}"
|
||||
.format(min_ver, max_ver))
|
||||
|
||||
if msg:
|
||||
self.notify.cc_info({
|
||||
"message": msg,
|
||||
"file": "",
|
||||
"line": "",
|
||||
"col": "",
|
||||
"severity": "ERROR",
|
||||
})
|
||||
|
||||
def _get_toolchain_labels(self):
|
||||
if getattr(self.target, "default_lib", "std") == "small":
|
||||
|
@ -337,7 +353,7 @@ class ARMC6(ARM_STD):
|
|||
"Cortex-M4F", "Cortex-M7", "Cortex-M7F", "Cortex-M7FD",
|
||||
"Cortex-M23", "Cortex-M23-NS", "Cortex-M33",
|
||||
"CortexM33-NS", "Cortex-A9"]
|
||||
ARMCC_VERSION = "6.10"
|
||||
ARMCC_RANGE = (LooseVersion("6.10"), LooseVersion("7.0"))
|
||||
|
||||
@staticmethod
|
||||
def check_executable():
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
import re
|
||||
from os.path import join, basename, splitext, dirname, exists
|
||||
from distutils.spawn import find_executable
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from tools.toolchains import mbedToolchain, TOOLCHAIN_PATHS
|
||||
from tools.hooks import hook_tool
|
||||
|
@ -29,7 +30,7 @@ class GCC(mbedToolchain):
|
|||
STD_LIB_NAME = "lib%s.a"
|
||||
DIAGNOSTIC_PATTERN = re.compile('((?P<file>[^:]+):(?P<line>\d+):)(?P<col>\d+):? (?P<severity>warning|[eE]rror|fatal error): (?P<message>.+)')
|
||||
|
||||
GCC_MAJOR = "6"
|
||||
GCC_RANGE = (LooseVersion("6.0.0"), LooseVersion("7.0.0"))
|
||||
GCC_VERSION_RE = re.compile("[0-9]*\.[0-9]*\.[0-9]*")
|
||||
|
||||
def __init__(self, target, notify=None, macros=None, build_profile=None,
|
||||
|
@ -118,15 +119,24 @@ class GCC(mbedToolchain):
|
|||
for word in line.split():
|
||||
match = self.GCC_VERSION_RE.match(word)
|
||||
if match:
|
||||
found_version = match.group(0)
|
||||
if found_version and not found_version.startswith(self.GCC_MAJOR + "."):
|
||||
raise NotSupportedException(
|
||||
"GCC_ARM compiler version mismatch: Have {}; expected major version {}"
|
||||
.format(found_version, self.GCC_MAJOR))
|
||||
found_version = LooseVersion(match.group(0))
|
||||
min_ver, max_ver = self.GCC_RANGE
|
||||
if found_version and (found_version < min_ver or found_version >= max_ver):
|
||||
msg = ("Compiler version mismatch: Have {}; "
|
||||
"expected version >= {} and < {}"
|
||||
.format(found_version, min_ver, max_ver))
|
||||
elif not found_version:
|
||||
raise NotSupportedException(
|
||||
"GCC_ARM compiler version mismatch: Could Not detect compiler "
|
||||
"version; expected {}".format(self.GCC_MAJOR))
|
||||
msg = ("Compiler version mismatch: Could not detect version; "
|
||||
"expected version >= {} and < {}"
|
||||
.format(min_ver, max_ver))
|
||||
if msg:
|
||||
self.notify.cc_info({
|
||||
"message": msg,
|
||||
"file": "",
|
||||
"line": "",
|
||||
"col": "",
|
||||
"severity": "ERROR",
|
||||
})
|
||||
|
||||
def is_not_supported_error(self, output):
|
||||
return "error: #error [NOT_SUPPORTED]" in output
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
import re
|
||||
from os import remove
|
||||
from os.path import join, splitext, exists
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from tools.toolchains import mbedToolchain, TOOLCHAIN_PATHS
|
||||
from tools.hooks import hook_tool
|
||||
|
@ -30,7 +31,7 @@ class IAR(mbedToolchain):
|
|||
DIAGNOSTIC_PATTERN = re.compile('"(?P<file>[^"]+)",(?P<line>[\d]+)\s+(?P<severity>Warning|Error|Fatal error)(?P<message>.+)')
|
||||
INDEX_PATTERN = re.compile('(?P<col>\s*)\^')
|
||||
IAR_VERSION_RE = re.compile("IAR ANSI C/C\+\+ Compiler V([0-9]+.[0-9]+)")
|
||||
IAR_VERSION = "7.80"
|
||||
IAR_VERSION = LooseVersion("7.80")
|
||||
|
||||
@staticmethod
|
||||
def check_executable():
|
||||
|
@ -101,14 +102,21 @@ class IAR(mbedToolchain):
|
|||
match = self.IAR_VERSION_RE.match(line)
|
||||
if match:
|
||||
found_version = match.group(1)
|
||||
if found_version and not found_version.startswith(self.IAR_VERSION):
|
||||
raise NotSupportedException(
|
||||
"IAR compiler version mismatch: Have {}; expected {}"
|
||||
.format(found_version, self.IAR_VERSION))
|
||||
msg = None
|
||||
if found_version and LooseVersion(found_version) != self.IAR_VERSION:
|
||||
msg = "Compiler version mismatch: Have {}; expected {}".format(
|
||||
found_version, self.IAR_VERSION)
|
||||
elif not found_version:
|
||||
raise NotSupportedException(
|
||||
"IAR compiler version mismatch: Could Not detect compiler "
|
||||
msg = ("Compiler version mismatch: Could Not detect compiler "
|
||||
"version; expected {}".format(self.IAR_VERSION))
|
||||
if msg:
|
||||
self.notify.cc_info({
|
||||
"message": msg,
|
||||
"file": "",
|
||||
"line": "",
|
||||
"col": "",
|
||||
"severity": "ERROR",
|
||||
})
|
||||
|
||||
|
||||
def parse_dependencies(self, dep_path):
|
||||
|
|
Loading…
Reference in New Issue