tools: Improve PSA target identification logic

Current logic `is_TFM_target` relies on the availability of attribute
`tfm_target_name` to identify PSA targets. The API `is_TFM_target` is
used in pytest to validate PSA target configuration which again checks
the availability of `tfm_target_name`. If a target doesn't contain the
attribute `tfm_target_name` then this check will fail instead of
catching it. Therefore, we now check for `TFM` config option in `labels`
attribute.

The API `is_TFM_target()` returns true for Mbed OS PSA targets which are
supported by TF-M also.

Add a new API `is_PSA_target()` which returns true for all Mbed OS PSA
targets.

Signed-off-by: Devaraj Ranganna <devaraj.ranganna@arm.com>
pull/12955/head
Devaraj Ranganna 2020-05-15 16:24:12 +01:00 committed by Jaeden Amero
parent 0961f312c6
commit 939ed6940c
1 changed files with 5 additions and 1 deletions

View File

@ -405,9 +405,13 @@ class Target(namedtuple(
def is_PSA_non_secure_target(self):
return 'NSPE_Target' in self.labels
@property
def is_PSA_target(self):
return 'PSA' in self.features
@property
def is_TFM_target(self):
return getattr(self, 'tfm_target_name', False)
return 'TFM' in self.labels
def get_post_build_hook(self, toolchain_labels):
"""Initialize the post-build hooks for a toolchain. For now, this