1#-------------------------------------------------------------------------------
2# Copyright (c) 2021-2022, Arm Limited. All rights reserved.
3# Copyright (c) 2021-2023 Cypress Semiconductor Corporationn (an Infineon company)
4# or an affiliate of Cypress Semiconductor Corporation. All rights reserved.
5#
6# SPDX-License-Identifier: BSD-3-Clause
7#
8#-------------------------------------------------------------------------------
9
10if (NOT TFM_PARTITION_NS_AGENT_TZ)
11    return()
12endif()
13
14cmake_minimum_required(VERSION 3.21)
15
16target_sources(tfm_partitions
17    INTERFACE
18        ${CMAKE_CURRENT_SOURCE_DIR}/load_info_ns_agent_tz.c
19)
20
21set(ARM_V80M_ARCH armv8-m.base armv8-m.main)
22
23# Trustzone NS Agent is tighly coupled with SPM
24target_sources(tfm_spm
25    PRIVATE
26        "$<$<IN_LIST:${TFM_SYSTEM_ARCHITECTURE},${ARM_V80M_ARCH}>:${CMAKE_CURRENT_SOURCE_DIR}/ns_agent_tz_v80m.c>"
27        "$<$<NOT:$<IN_LIST:${TFM_SYSTEM_ARCHITECTURE},${ARM_V80M_ARCH}>>:${CMAKE_CURRENT_SOURCE_DIR}/ns_agent_tz.c>"
28)
29
30# If this is added to the spm, it is discarded as it is not used. Since the
31# spm is a static library it can't generate veneers under all compilers so
32# instead this single file is added to the 'tfm_s' target.
33target_sources(tfm_s
34    PRIVATE
35        "$<$<IN_LIST:${TFM_SYSTEM_ARCHITECTURE},${ARM_V80M_ARCH}>:${CMAKE_CURRENT_SOURCE_DIR}/psa_api_veneers_v80m.c>"
36        "$<$<NOT:$<IN_LIST:${TFM_SYSTEM_ARCHITECTURE},${ARM_V80M_ARCH}>>:${CMAKE_CURRENT_SOURCE_DIR}/psa_api_veneers.c>"
37)
38
39target_compile_definitions(tfm_config
40    INTERFACE
41        TFM_PARTITION_NS_AGENT_TZ
42)
43