|
25 | 25 | import shutil
|
26 | 26 | import logging
|
27 | 27 | from psa_builder import *
|
28 |
| - |
29 |
| -try: |
30 |
| - import yaml |
31 |
| -except ImportError as e: |
32 |
| - print(str(e) + " To install it, type:") |
33 |
| - print("python3 -m pip install PyYAML") |
34 |
| - exit(1) |
35 |
| - |
36 | 28 | from tools.toolchains import TOOLCHAIN_CLASSES, TOOLCHAIN_PATHS
|
37 | 29 | from tools.targets import Target, TARGET_MAP, TARGET_NAMES
|
38 | 30 |
|
@@ -92,37 +84,6 @@ def _clone_tfm_repo(commit):
|
92 | 84 | )
|
93 | 85 |
|
94 | 86 |
|
95 |
| -def _get_tfm_secure_targets(): |
96 |
| - """ |
97 |
| - Creates a list of TF-M secure targets from Mbed OS targets.json. |
98 |
| -
|
99 |
| - :return: List of TF-M secure targets. |
100 |
| - """ |
101 |
| - return [str(t) for t in TARGET_NAMES if Target.get_target(t).is_TFM_target] |
102 |
| - |
103 |
| - |
104 |
| -def _get_tfm_regression_targets(): |
105 |
| - """ |
106 |
| - Creates a list of TF-M regression tests supported targets |
107 |
| - This parses the yaml file for supported target names and compares them |
108 |
| - with TF-M targets supported in Mbed OS |
109 |
| -
|
110 |
| - :return: List of supported TF-M regression targets. |
111 |
| - """ |
112 |
| - with open(join(dirname(__file__), "tfm_ns_import.yaml")) as ns_import: |
113 |
| - yaml_data = yaml.safe_load(ns_import) |
114 |
| - mbed_os_data = yaml_data["mbed-os"] |
115 |
| - tfm_regression_data = yaml_data["tf-m-regression"] |
116 |
| - |
117 |
| - regression_targets = list( |
118 |
| - set(_get_tfm_secure_targets()) |
119 |
| - & set(mbed_os_data) |
120 |
| - & set(tfm_regression_data) |
121 |
| - ) |
122 |
| - |
123 |
| - return regression_targets |
124 |
| - |
125 |
| - |
126 | 87 | def _get_target_info(target, toolchain=None):
|
127 | 88 | """
|
128 | 89 | Creates a TF-M target tuple (target name, TF-M target name, toolchain,
|
@@ -176,7 +137,7 @@ def _get_mbed_supported_tfm_targets():
|
176 | 137 | Returns a generator with every element containing a TF-M target tuple
|
177 | 138 | (target name, TF-M target name, toolchain, delivery directory)
|
178 | 139 | """
|
179 |
| - tfm_secure_targets = _get_tfm_secure_targets() |
| 140 | + tfm_secure_targets = get_tfm_secure_targets() |
180 | 141 | logging.info(
|
181 | 142 | "Found the following TF-M targets: {}".format(
|
182 | 143 | ", ".join(tfm_secure_targets)
|
@@ -572,7 +533,7 @@ def _get_parser():
|
572 | 533 | "--mcu",
|
573 | 534 | help="Build for the given MCU",
|
574 | 535 | default=None,
|
575 |
| - choices=_get_tfm_regression_targets(), |
| 536 | + choices=get_tfm_regression_targets(), |
576 | 537 | )
|
577 | 538 |
|
578 | 539 | hmsg = "Build for the given toolchain (default is tfm_default_toolchain)"
|
@@ -641,7 +602,7 @@ def _main():
|
641 | 602 | if args.list:
|
642 | 603 | logging.info(
|
643 | 604 | "Supported TF-M regression targets are: {}".format(
|
644 |
| - ", ".join([t for t in _get_tfm_regression_targets()]) |
| 605 | + ", ".join([t for t in get_tfm_regression_targets()]) |
645 | 606 | )
|
646 | 607 | )
|
647 | 608 | return
|
|
0 commit comments