Skip to content

Commit 939ed69

Browse files
urutvaPatater
authored andcommitted
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 <[email protected]>
1 parent 0961f31 commit 939ed69

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tools/targets/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,9 +405,13 @@ def is_TrustZone_target(self):
405405
def is_PSA_non_secure_target(self):
406406
return 'NSPE_Target' in self.labels
407407

408+
@property
409+
def is_PSA_target(self):
410+
return 'PSA' in self.features
411+
408412
@property
409413
def is_TFM_target(self):
410-
return getattr(self, 'tfm_target_name', False)
414+
return 'TFM' in self.labels
411415

412416
def get_post_build_hook(self, toolchain_labels):
413417
"""Initialize the post-build hooks for a toolchain. For now, this

0 commit comments

Comments
 (0)