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.15)
15cmake_policy(SET CMP0079 NEW)
16
17target_sources(tfm_partitions
18    INTERFACE
19        ${CMAKE_CURRENT_SOURCE_DIR}/load_info_ns_agent_tz.c
20)
21
22set(ARM_V80M_ARCH armv8-m.base armv8-m.main)
23
24# Trustzone NS Agent is tighly coupled with SPM
25target_sources(tfm_spm
26    PRIVATE
27        "$<$<IN_LIST:${TFM_SYSTEM_ARCHITECTURE},${ARM_V80M_ARCH}>:${CMAKE_CURRENT_SOURCE_DIR}/ns_agent_tz_v80m.c>"
28        "$<$<NOT:$<IN_LIST:${TFM_SYSTEM_ARCHITECTURE},${ARM_V80M_ARCH}>>:${CMAKE_CURRENT_SOURCE_DIR}/ns_agent_tz.c>"
29)
30
31# If this is added to the spm, it is discarded as it is not used. Since the
32# spm is a static library it can't generate veneers under all compilers so
33# instead this single file is added to the 'tfm_s' target.
34target_sources(tfm_s
35    PRIVATE
36        "$<$<IN_LIST:${TFM_SYSTEM_ARCHITECTURE},${ARM_V80M_ARCH}>:${CMAKE_CURRENT_SOURCE_DIR}/psa_api_veneers_v80m.c>"
37        "$<$<NOT:$<IN_LIST:${TFM_SYSTEM_ARCHITECTURE},${ARM_V80M_ARCH}>>:${CMAKE_CURRENT_SOURCE_DIR}/psa_api_veneers.c>"
38)
39
40target_compile_definitions(tfm_partition_defs
41    INTERFACE
42        TFM_PARTITION_NS_AGENT_TZ
43)
44