Skip to content

Commit fd74d67

Browse files
urutvaPatater
authored andcommitted
psa: Remove PSA secure binary building tools
The PSA-implementing secure binary is not built using Mbed OS build tools anymore. Instead, the TrustedFirmware-M (TF-M) build system is used to produce the secure binary. As such, we remove PSA related hooks from the build system, remove PSA related scripts from tools/test folder, and also remove the psa-autogen job from travis which was running the now unecessary and removed generate_partition_code.py. Remove the ability to generate new PSA binaries in the old manner, where Mbed OS implements PSA. We don't yet remove any PSA binaries or break the currently checked-in Mbed-implemented PSA support. PSA targets integrated in the old manner will continue working at this point. Signed-off-by: Devaraj Ranganna <[email protected]> Signed-off-by: Jaeden Amero <[email protected]>
1 parent fcf427a commit fd74d67

35 files changed

+14
-3907
lines changed

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,3 @@ test_suite.json
9797

9898
# default delivery dir
9999
DELIVERY/
100-
101-
# Directory hosting PSA autogenerated source files
102-
PSA_AUTOGEN/

.travis.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ matrix:
226226
### Extended Tests ###
227227
- &extended-vm
228228
stage: "Extended"
229-
name: "psa autogen"
230-
env: NAME=psa-autogen
229+
name: "events"
230+
env: NAME=events EVENTS=events
231231
language: python
232232
python: 3.7
233233
install:
@@ -239,13 +239,6 @@ matrix:
239239
- python -m pip install --upgrade setuptools==40.4.3
240240
- pip install -r requirements.txt
241241
- pip list --verbose
242-
script:
243-
- python tools/psa/generate_partition_code.py
244-
- git diff --exit-code
245-
246-
- <<: *extended-vm
247-
name: "events"
248-
env: NAME=events EVENTS=events
249242
script:
250243
# Check that example compiles
251244
- sed -n '/``` cpp/,/```/{/```$/Q;/```/d;p;}' ${EVENTS}/README.md > main.cpp

tools/build.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@
4444
from tools.utils import argparse_dir_not_parent
4545
from tools.utils import NoValidToolchainException
4646
from tools.utils import print_end_warnings
47-
from tools.psa import generate_psa_sources
48-
from tools.resources import OsAndSpeResourceFilter
4947

5048
def main():
5149
start = time()
@@ -189,12 +187,6 @@ def main():
189187

190188
if options.source_dir:
191189
resource_filter = None
192-
if target.is_PSA_secure_target:
193-
generate_psa_sources(
194-
source_dirs=options.source_dir,
195-
ignore_paths=[options.build_dir]
196-
)
197-
resource_filter = OsAndSpeResourceFilter()
198190

199191
lib_build_res = build_library(
200192
options.source_dir, options.build_dir, target, toolchain_name,

tools/build_api.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
MBED_CONFIG_FILE, MBED_LIBRARIES_DRIVERS,
4343
MBED_LIBRARIES_PLATFORM, MBED_LIBRARIES_HAL,
4444
BUILD_DIR)
45-
from .resources import Resources, FileType, FileRef, PsaManifestResourceFilter
45+
from .resources import Resources, FileType, FileRef
4646
from .notifier.mock import MockNotifier
4747
from .targets import TARGET_NAMES, TARGET_MAP, CORE_ARCH, Target
4848
from .libraries import Library
@@ -422,7 +422,6 @@ def get_mbed_official_release(version):
422422
) for target in TARGET_NAMES \
423423
if (hasattr(TARGET_MAP[target], 'release_versions')
424424
and version in TARGET_MAP[target].release_versions)
425-
and not Target.get_target(target).is_PSA_secure_target
426425
)
427426
)
428427

@@ -624,11 +623,7 @@ def build_project(src_paths, build_path, target, toolchain_name,
624623
into_dir, extra_artifacts = toolchain.config.deliver_into()
625624
if into_dir:
626625
copy_when_different(res[0], into_dir)
627-
if not extra_artifacts:
628-
if toolchain.target.is_TrustZone_secure_target:
629-
cmse_lib = join(dirname(res[0]), "cmse_lib.o")
630-
copy_when_different(cmse_lib, into_dir)
631-
else:
626+
if extra_artifacts:
632627
for tc, art in extra_artifacts:
633628
if toolchain_name == tc:
634629
copy_when_different(join(build_path, art), into_dir)
@@ -774,7 +769,6 @@ def build_library(src_paths, build_path, target, toolchain_name,
774769
res = Resources(notify).scan_with_toolchain(
775770
src_paths, toolchain, dependencies_paths, inc_dirs=inc_dirs)
776771
res.filter(resource_filter)
777-
res.filter(PsaManifestResourceFilter())
778772

779773
# Copy headers, objects and static libraries - all files needed for
780774
# static lib

tools/config/__init__.py

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -706,25 +706,14 @@ def _get_primary_memory_override(self, memory_type):
706706
)
707707
if hasattr(self.target, "mbed_{}_size".format(memory_type)):
708708
mem_size = getattr(self.target, "mbed_{}_size".format(memory_type))
709-
if (
710-
self.target.is_PSA_non_secure_target or
711-
self.target.is_PSA_secure_target
712-
):
709+
if self.target.is_PSA_non_secure_target:
713710
config, _ = self.get_config_data()
714-
if self.target.is_PSA_secure_target:
715-
mem_start = config.get(
716-
"target.secure-{}-start".format(memory_type), mem_start
717-
).value
718-
mem_size = config.get(
719-
"target.secure-{}-size".format(memory_type), mem_size
720-
).value
721-
elif self.target.is_PSA_non_secure_target:
722-
mem_start = config.get(
723-
"target.non-secure-{}-start".format(memory_type), mem_start
724-
).value
725-
mem_size = config.get(
726-
"target.non-secure-{}-size".format(memory_type), mem_size
727-
).value
711+
mem_start = config.get(
712+
"target.non-secure-{}-start".format(memory_type), mem_start
713+
).value
714+
mem_size = config.get(
715+
"target.non-secure-{}-size".format(memory_type), mem_size
716+
).value
728717
if mem_start and not isinstance(mem_start, int):
729718
mem_start = int(mem_start, 0)
730719
if mem_size and not isinstance(mem_size, int):

tools/importer/tfm_importer.json

Lines changed: 0 additions & 100 deletions
This file was deleted.

tools/make.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@
5555
from tools.utils import print_large_string
5656
from tools.settings import ROOT
5757
from tools.targets import Target
58-
from tools.psa import generate_psa_sources
59-
from tools.resources import OsAndSpeResourceFilter
6058

6159
def default_args_dict(options):
6260
return dict(
@@ -336,13 +334,6 @@ def main():
336334

337335
if options.source_dir is not None:
338336
resource_filter = None
339-
if target.is_PSA_secure_target:
340-
generate_psa_sources(
341-
source_dirs=options.source_dir,
342-
ignore_paths=[options.build_dir]
343-
)
344-
resource_filter = OsAndSpeResourceFilter()
345-
346337
wrapped_build_project(
347338
options.source_dir,
348339
options.build_dir,

tools/project.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@
5353
from tools.utils import NotSupportedException
5454
from tools.options import extract_profile, list_profiles, extract_mcus
5555
from tools.notifier.term import TerminalNotifier
56-
from tools.psa import generate_psa_sources
57-
from tools.resources import OsAndSpeResourceFilter
5856

5957
""" The CLI entry point for exporting projects from the mbed tools to any of the
6058
supported IDEs or project structures.
@@ -389,14 +387,7 @@ def main():
389387
args_error(parser, "%s not supported by %s" % (mcu, ide))
390388

391389
try:
392-
target = Target.get_target(mcu)
393390
resource_filter = None
394-
if target.is_PSA_secure_target:
395-
generate_psa_sources(source_dirs=options.source_dir,
396-
ignore_paths=[]
397-
)
398-
resource_filter = OsAndSpeResourceFilter()
399-
400391
export(
401392
mcu,
402393
ide,

tools/psa/README.md

Lines changed: 0 additions & 69 deletions
This file was deleted.

tools/psa/__init__.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/env python
22
# Copyright (c) 2019 ARM Limited
33
#
44
# SPDX-License-Identifier: Apache-2.0
@@ -16,13 +16,7 @@
1616
# limitations under the License.
1717

1818
import os
19-
import shutil
20-
2119
from tools.resources import FileType
22-
from tools.settings import ROOT
23-
from .generate_partition_code import manifests_discovery, generate_spm_code
24-
25-
2620

2721
def find_secure_image(notify, resources, ns_image_path,
2822
configured_s_image_filename, image_type):
@@ -56,12 +50,3 @@ def find_secure_image(notify, resources, ns_image_path,
5650
raise Exception("Required secure image not found.")
5751

5852
return secure_image
59-
60-
def generate_psa_sources(source_dirs, ignore_paths):
61-
services, apps = manifests_discovery(root_dirs=source_dirs,
62-
ignore_paths=ignore_paths + ['.git'])
63-
assert len(services + apps), 'PSA manifest discovery failed'
64-
psa_out_dir = os.path.join(ROOT, 'components', 'TARGET_PSA')
65-
66-
generate_spm_code(services, apps, psa_out_dir)
67-
return psa_out_dir

0 commit comments

Comments
 (0)