1#-------------------------------------------------------------------------------
2# Copyright (c) 2020-2023, Arm Limited. All rights reserved.
3# Copyright (c) 2022 Cypress Semiconductor Corporation (an Infineon company)
4# or an affiliate of Cypress Semiconductor Corporation. All rights reserved.
5#
6# SPDX-License-Identifier: BSD-3-Clause
7#
8#-------------------------------------------------------------------------------
9cmake_minimum_required(VERSION 3.15)
10cmake_policy(SET CMP0076 NEW)
11cmake_policy(SET CMP0079 NEW)
12
13if (EXISTS ${TARGET_PLATFORM_PATH}/preload_ns.cmake)
14    include(${TARGET_PLATFORM_PATH}/preload_ns.cmake)
15    tfm_toolchain_reload_compiler()
16endif()
17
18add_library(platform_ns STATIC EXCLUDE_FROM_ALL)
19
20target_sources(platform_ns
21    PRIVATE
22        $<$<BOOL:${PLATFORM_DEFAULT_UART_STDOUT}>:${CMAKE_CURRENT_SOURCE_DIR}/../ext/common/uart_stdout.c>
23        $<$<AND:$<NOT:$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>>,$<BOOL:${TEST_NS_ATTESTATION}>>:${CMAKE_CURRENT_SOURCE_DIR}/../ext/common/template/tfm_initial_attest_pub_key.c>
24    PUBLIC
25        $<$<OR:$<BOOL:${TEST_S_FPU}>,$<BOOL:${TEST_NS_FPU}>>:${CMAKE_SOURCE_DIR}/platform/ext/common/test_interrupt.c>
26)
27
28target_link_libraries(platform_ns
29    PUBLIC
30        platform_common_interface
31        platform_region_defs
32        tfm_fih_headers
33        tfm_ns_interface
34)
35
36target_compile_definitions(platform_ns
37    PUBLIC
38        $<$<STREQUAL:${CONFIG_TFM_FLOAT_ABI},hard>:CONFIG_TFM_FLOAT_ABI=2>
39        $<$<STREQUAL:${CONFIG_TFM_FLOAT_ABI},soft>:CONFIG_TFM_FLOAT_ABI=0>
40        $<$<BOOL:${TEST_NS_FPU}>:TEST_NS_FPU>
41        $<$<BOOL:${CONFIG_TFM_ENABLE_CP10CP11}>:CONFIG_TFM_ENABLE_CP10CP11>
42        $<$<BOOL:${PLATFORM_DEFAULT_CRYPTO_KEYS}>:PLATFORM_DEFAULT_CRYPTO_KEYS>
43        $<$<BOOL:${CONFIG_ENABLE_NS_UART_TX_RX_CONTROL}>:UART_TX_RX_CONTROL_ENABLED>
44    PRIVATE
45        $<$<BOOL:${TEST_NS_SLIH_IRQ}>:TEST_NS_SLIH_IRQ>
46)
47
48target_compile_options(platform_ns
49    PUBLIC
50        ${COMPILER_CP_FLAG}
51)
52