Skip to content

Commit ae033da

Browse files
committed
Use mapping of core->arch ver. for tc picking
1 parent c030c6a commit ae033da

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

tools/build_api.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
BUILD_DIR)
4545
from .resources import Resources, FileType, FileRef
4646
from .notifier.mock import MockNotifier
47-
from .targets import TARGET_NAMES, TARGET_MAP
47+
from .targets import TARGET_NAMES, TARGET_MAP, CORE_ARCH
4848
from .libraries import Library
4949
from .toolchains import TOOLCHAIN_CLASSES
5050
from .config import Config
@@ -316,9 +316,7 @@ def prepare_toolchain(src_paths, build_dir, target, toolchain_name,
316316
raise NotSupportedException(
317317
"Target {} is not supported by toolchain {}".format(
318318
target.name, toolchain_name))
319-
if (toolchain_name == "ARM" and
320-
target.core in ("Cortex-M23", "Cortex-M23-NS",
321-
"Cortex-M33", "Cortex-M33-NS")):
319+
if (toolchain_name == "ARM" and CORE_ARCH[target.core] == 8):
322320
toolchain_name = "ARMC6"
323321

324322
try:

tools/targets/__init__.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from tools.utils import json_file_to_dict
3131

3232
__all__ = ["target", "TARGETS", "TARGET_MAP", "TARGET_NAMES", "CORE_LABELS",
33-
"HookError", "generate_py_target", "Target",
33+
"CORE_ARCH", "HookError", "generate_py_target", "Target",
3434
"CUMULATIVE_ATTRIBUTES", "get_resolution_order"]
3535

3636
CORE_LABELS = {
@@ -50,6 +50,23 @@
5050
"Cortex-M33-NS": ["M33", "M33_NS", "CORTEX_M", "LIKE_CORTEX_M33", "CORTEX"]
5151
}
5252

53+
CORE_ARCH = {
54+
"Cortex-M0": 6,
55+
"Cortex-M0+": 6,
56+
"Cortex-M1": 6,
57+
"Cortex-M3": 7,
58+
"Cortex-M4": 7,
59+
"Cortex-M4F": 7,
60+
"Cortex-M7": 7,
61+
"Cortex-M7F": 7,
62+
"Cortex-M7FD": 7,
63+
"Cortex-A9": 7,
64+
"Cortex-M23": 8,
65+
"Cortex-M23-NS": 8,
66+
"Cortex-M33": 8,
67+
"Cortex-M33-NS": 8,
68+
}
69+
5370
################################################################################
5471
# Generic Target class that reads and interprets the data in targets.json
5572

0 commit comments

Comments
 (0)