mirror of https://github.com/ARMmbed/mbed-os.git
Merge 25d126f268
into d723bf9e55
commit
0cbbf7b7d6
|
@ -351,7 +351,7 @@ def test_detect_duplicates(filenames):
|
||||||
@settings(max_examples=20)
|
@settings(max_examples=20)
|
||||||
def test_path_specified_gcc(gcc_loc, exists_at_loc, exists_in_path):
|
def test_path_specified_gcc(gcc_loc, exists_at_loc, exists_in_path):
|
||||||
with patch('tools.toolchains.gcc.exists') as _exists:
|
with patch('tools.toolchains.gcc.exists') as _exists:
|
||||||
with patch('tools.toolchains.gcc.find_executable') as _find:
|
with patch('tools.toolchains.gcc.which') as _find:
|
||||||
_exists.return_value = exists_at_loc
|
_exists.return_value = exists_at_loc
|
||||||
_find.return_value = exists_in_path
|
_find.return_value = exists_in_path
|
||||||
TOOLCHAIN_PATHS['GCC_ARM'] = gcc_loc
|
TOOLCHAIN_PATHS['GCC_ARM'] = gcc_loc
|
||||||
|
|
|
@ -24,7 +24,7 @@ from os.path import join, dirname, splitext, basename, exists, isfile, relpath,
|
||||||
from os import makedirs, write, remove
|
from os import makedirs, write, remove
|
||||||
from tempfile import mkstemp
|
from tempfile import mkstemp
|
||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
from distutils.version import LooseVersion
|
from sys import version_info
|
||||||
|
|
||||||
from tools.toolchains.mbed_toolchain import (
|
from tools.toolchains.mbed_toolchain import (
|
||||||
mbedToolchain, TOOLCHAIN_PATHS, should_replace_small_c_lib
|
mbedToolchain, TOOLCHAIN_PATHS, should_replace_small_c_lib
|
||||||
|
@ -32,6 +32,11 @@ from tools.toolchains.mbed_toolchain import (
|
||||||
from tools.utils import mkdir, NotSupportedException, run_cmd
|
from tools.utils import mkdir, NotSupportedException, run_cmd
|
||||||
from tools.resources import FileRef
|
from tools.resources import FileRef
|
||||||
|
|
||||||
|
if version_info >= (3,10):
|
||||||
|
from packaging.version import Version
|
||||||
|
else:
|
||||||
|
from distutils.version import LooseVersion as Version
|
||||||
|
|
||||||
ARMC5_MIGRATION_WARNING = (
|
ARMC5_MIGRATION_WARNING = (
|
||||||
"Warning: Arm Compiler 5 is no longer supported as of Mbed 6. "
|
"Warning: Arm Compiler 5 is no longer supported as of Mbed 6. "
|
||||||
"Please upgrade your environment to Arm Compiler 6 "
|
"Please upgrade your environment to Arm Compiler 6 "
|
||||||
|
@ -59,7 +64,7 @@ class ARM(mbedToolchain):
|
||||||
"Cortex-M0", "Cortex-M0+", "Cortex-M3", "Cortex-M4", "Cortex-M4F",
|
"Cortex-M0", "Cortex-M0+", "Cortex-M3", "Cortex-M4", "Cortex-M4F",
|
||||||
"Cortex-M7", "Cortex-M7F", "Cortex-M7FD", "Cortex-A5", "Cortex-A9"
|
"Cortex-M7", "Cortex-M7F", "Cortex-M7FD", "Cortex-A5", "Cortex-A9"
|
||||||
]
|
]
|
||||||
ARMCC_RANGE = (LooseVersion("5.06"), LooseVersion("5.07"))
|
ARMCC_RANGE = (Version("5.06"), Version("5.07"))
|
||||||
ARMCC_PRODUCT_RE = re.compile(b"Product: (.*)")
|
ARMCC_PRODUCT_RE = re.compile(b"Product: (.*)")
|
||||||
ARMCC_VERSION_RE = re.compile(b"Component: ARM Compiler (\d+\.\d+)")
|
ARMCC_VERSION_RE = re.compile(b"Component: ARM Compiler (\d+\.\d+)")
|
||||||
|
|
||||||
|
@ -142,7 +147,7 @@ class ARM(mbedToolchain):
|
||||||
output = stdout.encode("utf-8")
|
output = stdout.encode("utf-8")
|
||||||
match = self.ARMCC_VERSION_RE.search(output)
|
match = self.ARMCC_VERSION_RE.search(output)
|
||||||
if match:
|
if match:
|
||||||
found_version = LooseVersion(match.group(1).decode("utf-8"))
|
found_version = Version(match.group(1).decode("utf-8"))
|
||||||
else:
|
else:
|
||||||
found_version = None
|
found_version = None
|
||||||
min_ver, max_ver = self.ARMCC_RANGE
|
min_ver, max_ver = self.ARMCC_RANGE
|
||||||
|
@ -546,7 +551,7 @@ class ARMC6(ARM_STD):
|
||||||
"Cortex-M33-NS", "Cortex-M33F-NS", "Cortex-M33FE-NS", "Cortex-M33FE",
|
"Cortex-M33-NS", "Cortex-M33F-NS", "Cortex-M33FE-NS", "Cortex-M33FE",
|
||||||
"Cortex-A5", "Cortex-A9"
|
"Cortex-A5", "Cortex-A9"
|
||||||
]
|
]
|
||||||
ARMCC_RANGE = (LooseVersion("6.10"), LooseVersion("7.0"))
|
ARMCC_RANGE = (Version("6.10"), Version("7.0"))
|
||||||
LD_DIAGNOSTIC_PATTERN = re.compile(
|
LD_DIAGNOSTIC_PATTERN = re.compile(
|
||||||
'(?P<severity>Warning|Error): (?P<message>.+)'
|
'(?P<severity>Warning|Error): (?P<message>.+)'
|
||||||
)
|
)
|
||||||
|
|
|
@ -19,14 +19,20 @@ import re
|
||||||
import fnmatch
|
import fnmatch
|
||||||
from os.path import join, basename, splitext, dirname, exists
|
from os.path import join, basename, splitext, dirname, exists
|
||||||
from os import getcwd, getenv
|
from os import getcwd, getenv
|
||||||
from distutils.spawn import find_executable
|
from sys import version_info
|
||||||
from distutils.version import LooseVersion
|
|
||||||
|
|
||||||
from tools.toolchains.mbed_toolchain import (
|
from tools.toolchains.mbed_toolchain import (
|
||||||
mbedToolchain, TOOLCHAIN_PATHS, should_replace_small_c_lib
|
mbedToolchain, TOOLCHAIN_PATHS, should_replace_small_c_lib
|
||||||
)
|
)
|
||||||
from tools.utils import run_cmd
|
from tools.utils import run_cmd
|
||||||
|
|
||||||
|
if version_info >= (3,10):
|
||||||
|
from shutil import which
|
||||||
|
from packaging.version import Version
|
||||||
|
else:
|
||||||
|
from distutils.spawn import find_executable as which
|
||||||
|
from distutils.version import LooseVersion as Version
|
||||||
|
|
||||||
|
|
||||||
class GCC(mbedToolchain):
|
class GCC(mbedToolchain):
|
||||||
OFFICIALLY_SUPPORTED = True
|
OFFICIALLY_SUPPORTED = True
|
||||||
|
@ -36,7 +42,7 @@ class GCC(mbedToolchain):
|
||||||
STD_LIB_NAME = "lib%s.a"
|
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>.+)')
|
DIAGNOSTIC_PATTERN = re.compile('((?P<file>[^:]+):(?P<line>\d+):)(?P<col>\d+):? (?P<severity>warning|[eE]rror|fatal error): (?P<message>.+)')
|
||||||
|
|
||||||
GCC_RANGE = (LooseVersion("9.0.0"), LooseVersion("10.0.0"))
|
GCC_RANGE = (Version("9.0.0"), Version("10.0.0"))
|
||||||
GCC_VERSION_RE = re.compile(b"\d+\.\d+\.\d+")
|
GCC_VERSION_RE = re.compile(b"\d+\.\d+\.\d+")
|
||||||
DWARF_PRODUCER_RE = re.compile(r'(DW_AT_producer)(.*:\s*)(?P<producer>.*)')
|
DWARF_PRODUCER_RE = re.compile(r'(DW_AT_producer)(.*:\s*)(?P<producer>.*)')
|
||||||
|
|
||||||
|
@ -183,7 +189,7 @@ class GCC(mbedToolchain):
|
||||||
msg = None
|
msg = None
|
||||||
match = self.GCC_VERSION_RE.search(stdout.encode("utf-8"))
|
match = self.GCC_VERSION_RE.search(stdout.encode("utf-8"))
|
||||||
if match:
|
if match:
|
||||||
found_version = LooseVersion(match.group(0).decode('utf-8'))
|
found_version = Version(match.group(0).decode('utf-8'))
|
||||||
else:
|
else:
|
||||||
found_version = None
|
found_version = None
|
||||||
min_ver, max_ver = self.GCC_RANGE
|
min_ver, max_ver = self.GCC_RANGE
|
||||||
|
@ -395,7 +401,7 @@ class GCC(mbedToolchain):
|
||||||
not TOOLCHAIN_PATHS['GCC_ARM'] or
|
not TOOLCHAIN_PATHS['GCC_ARM'] or
|
||||||
not exists(TOOLCHAIN_PATHS['GCC_ARM'])
|
not exists(TOOLCHAIN_PATHS['GCC_ARM'])
|
||||||
):
|
):
|
||||||
if find_executable('arm-none-eabi-gcc'):
|
if which('arm-none-eabi-gcc'):
|
||||||
TOOLCHAIN_PATHS['GCC_ARM'] = ''
|
TOOLCHAIN_PATHS['GCC_ARM'] = ''
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -18,13 +18,17 @@ limitations under the License.
|
||||||
import re
|
import re
|
||||||
from os import remove
|
from os import remove
|
||||||
from os.path import join, splitext, exists
|
from os.path import join, splitext, exists
|
||||||
from distutils.version import LooseVersion
|
from sys import version_info
|
||||||
|
|
||||||
from tools.toolchains.mbed_toolchain import (
|
from tools.toolchains.mbed_toolchain import (
|
||||||
mbedToolchain, TOOLCHAIN_PATHS, should_replace_small_c_lib
|
mbedToolchain, TOOLCHAIN_PATHS, should_replace_small_c_lib
|
||||||
)
|
)
|
||||||
from tools.utils import run_cmd
|
from tools.utils import run_cmd
|
||||||
|
|
||||||
|
if version_info >= (3,10):
|
||||||
|
from packaging.version import Version
|
||||||
|
else:
|
||||||
|
from distutils.version import LooseVersion as Version
|
||||||
|
|
||||||
class IAR(mbedToolchain):
|
class IAR(mbedToolchain):
|
||||||
OFFICIALLY_SUPPORTED = True
|
OFFICIALLY_SUPPORTED = True
|
||||||
LIBRARY_EXT = '.a'
|
LIBRARY_EXT = '.a'
|
||||||
|
@ -34,7 +38,7 @@ class IAR(mbedToolchain):
|
||||||
DIAGNOSTIC_PATTERN = re.compile('"(?P<file>[^"]+)",(?P<line>[\d]+)\s+(?P<severity>Warning|Error|Fatal error)(?P<message>.+)')
|
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*)\^')
|
INDEX_PATTERN = re.compile('(?P<col>\s*)\^')
|
||||||
IAR_VERSION_RE = re.compile(b"IAR ANSI C/C\+\+ Compiler V(\d+\.\d+)")
|
IAR_VERSION_RE = re.compile(b"IAR ANSI C/C\+\+ Compiler V(\d+\.\d+)")
|
||||||
IAR_VERSION = LooseVersion("8.32")
|
IAR_VERSION = Version("8.32")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def check_executable():
|
def check_executable():
|
||||||
|
@ -123,7 +127,7 @@ class IAR(mbedToolchain):
|
||||||
msg = None
|
msg = None
|
||||||
match = self.IAR_VERSION_RE.search(stdout.encode("utf-8"))
|
match = self.IAR_VERSION_RE.search(stdout.encode("utf-8"))
|
||||||
found_version = match.group(1).decode("utf-8") if match else None
|
found_version = match.group(1).decode("utf-8") if match else None
|
||||||
if found_version and LooseVersion(found_version) != self.IAR_VERSION:
|
if found_version and Version(found_version) != self.IAR_VERSION:
|
||||||
msg = "Compiler version mismatch: Have {}; expected {}".format(
|
msg = "Compiler version mismatch: Have {}; expected {}".format(
|
||||||
found_version, self.IAR_VERSION)
|
found_version, self.IAR_VERSION)
|
||||||
elif not match or len(match.groups()) != 1:
|
elif not match or len(match.groups()) != 1:
|
||||||
|
|
|
@ -29,9 +29,9 @@ from inspect import getmro
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from abc import ABCMeta, abstractmethod
|
from abc import ABCMeta, abstractmethod
|
||||||
from distutils.spawn import find_executable
|
|
||||||
from multiprocessing import Pool, cpu_count
|
from multiprocessing import Pool, cpu_count
|
||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
|
from sys import version_info
|
||||||
|
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
run_cmd,
|
run_cmd,
|
||||||
|
@ -52,6 +52,11 @@ from ..settings import COMPARE_FIXED
|
||||||
from ..settings import ARM_PATH, ARMC6_PATH, GCC_ARM_PATH, IAR_PATH
|
from ..settings import ARM_PATH, ARMC6_PATH, GCC_ARM_PATH, IAR_PATH
|
||||||
from future.utils import with_metaclass
|
from future.utils import with_metaclass
|
||||||
|
|
||||||
|
if version_info >= (3,10):
|
||||||
|
from shutil import which
|
||||||
|
else:
|
||||||
|
from distutils.spawn import find_executable as which
|
||||||
|
|
||||||
|
|
||||||
TOOLCHAIN_PATHS = {
|
TOOLCHAIN_PATHS = {
|
||||||
'ARM': ARM_PATH,
|
'ARM': ARM_PATH,
|
||||||
|
@ -1143,7 +1148,7 @@ class mbedToolchain(with_metaclass(ABCMeta, object)):
|
||||||
"""
|
"""
|
||||||
if (not TOOLCHAIN_PATHS[tool_key] or
|
if (not TOOLCHAIN_PATHS[tool_key] or
|
||||||
not exists(TOOLCHAIN_PATHS[tool_key])):
|
not exists(TOOLCHAIN_PATHS[tool_key])):
|
||||||
exe = find_executable(executable_name)
|
exe = which(executable_name)
|
||||||
if not exe:
|
if not exe:
|
||||||
return False
|
return False
|
||||||
for level in range(levels_up):
|
for level in range(levels_up):
|
||||||
|
|
Loading…
Reference in New Issue