From ae033da12f923e5f8cbfa568e1f9d1dac0eac92e Mon Sep 17 00:00:00 2001 From: Jimmy Brisson Date: Thu, 19 Jul 2018 10:55:35 -0500 Subject: [PATCH] Use mapping of core->arch ver. for tc picking --- tools/build_api.py | 6 ++---- tools/targets/__init__.py | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/tools/build_api.py b/tools/build_api.py index 55f8712505..c9cf80b43e 100644 --- a/tools/build_api.py +++ b/tools/build_api.py @@ -44,7 +44,7 @@ from .paths import (MBED_CMSIS_PATH, MBED_TARGETS_PATH, MBED_LIBRARIES, BUILD_DIR) from .resources import Resources, FileType, FileRef from .notifier.mock import MockNotifier -from .targets import TARGET_NAMES, TARGET_MAP +from .targets import TARGET_NAMES, TARGET_MAP, CORE_ARCH from .libraries import Library from .toolchains import TOOLCHAIN_CLASSES from .config import Config @@ -316,9 +316,7 @@ def prepare_toolchain(src_paths, build_dir, target, toolchain_name, raise NotSupportedException( "Target {} is not supported by toolchain {}".format( target.name, toolchain_name)) - if (toolchain_name == "ARM" and - target.core in ("Cortex-M23", "Cortex-M23-NS", - "Cortex-M33", "Cortex-M33-NS")): + if (toolchain_name == "ARM" and CORE_ARCH[target.core] == 8): toolchain_name = "ARMC6" try: diff --git a/tools/targets/__init__.py b/tools/targets/__init__.py index bf1864554d..594381cc07 100644 --- a/tools/targets/__init__.py +++ b/tools/targets/__init__.py @@ -30,7 +30,7 @@ from tools.paths import TOOLS_BOOTLOADERS from tools.utils import json_file_to_dict __all__ = ["target", "TARGETS", "TARGET_MAP", "TARGET_NAMES", "CORE_LABELS", - "HookError", "generate_py_target", "Target", + "CORE_ARCH", "HookError", "generate_py_target", "Target", "CUMULATIVE_ATTRIBUTES", "get_resolution_order"] CORE_LABELS = { @@ -50,6 +50,23 @@ CORE_LABELS = { "Cortex-M33-NS": ["M33", "M33_NS", "CORTEX_M", "LIKE_CORTEX_M33", "CORTEX"] } +CORE_ARCH = { + "Cortex-M0": 6, + "Cortex-M0+": 6, + "Cortex-M1": 6, + "Cortex-M3": 7, + "Cortex-M4": 7, + "Cortex-M4F": 7, + "Cortex-M7": 7, + "Cortex-M7F": 7, + "Cortex-M7FD": 7, + "Cortex-A9": 7, + "Cortex-M23": 8, + "Cortex-M23-NS": 8, + "Cortex-M33": 8, + "Cortex-M33-NS": 8, +} + ################################################################################ # Generic Target class that reads and interprets the data in targets.json