1#-------------------------------------------------------------------------------
2# Copyright (c) 2020-2022, Arm Limited. All rights reserved.
3# Copyright (c) 2023 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#-------------------------------------------------------------------------------
9
10cmake_minimum_required(VERSION 3.15)
11
12add_library(tfm_sprt STATIC)
13
14target_include_directories(tfm_sprt
15    PUBLIC
16        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
17        ${CMAKE_SOURCE_DIR}/secure_fw/include
18)
19
20target_sources(tfm_sprt
21    PUBLIC
22        $<$<BOOL:${CONFIG_GNU_SYSCALL_STUB_ENABLED}>:${CMAKE_SOURCE_DIR}/platform/ext/common/syscalls_stub.c>
23    PRIVATE
24        ./crt_memcmp.c
25        ./crt_memmove.c
26        ./crt_strnlen.c
27        ./service_api.c
28        ${CMAKE_SOURCE_DIR}/secure_fw/shared/crt_memcpy.c
29        ${CMAKE_SOURCE_DIR}/secure_fw/shared/crt_memset.c
30        $<$<BOOL:${CONFIG_TFM_PARTITION_META}>:./sprt_partition_metadata_indicator.c>
31        $<$<BOOL:${CONFIG_TFM_SPM_BACKEND_IPC}>:./sfn_common_thread.c>
32        $<$<BOOL:${CONFIG_TFM_SPM_BACKEND_IPC}>:./psa_api_ipc.c>
33        $<$<BOOL:${TFM_SP_LOG_RAW_ENABLED}>:./tfm_sp_log_raw.c>
34        $<$<BOOL:${TFM_SP_LOG_RAW_ENABLED}>:${CMAKE_SOURCE_DIR}/platform/ext/common/tfm_hal_sp_logdev_periph.c>
35)
36
37target_link_libraries(tfm_sprt
38    PUBLIC
39        psa_interface
40        tfm_spm_defs
41        tfm_partition_defs
42        platform_s
43    PRIVATE
44        tfm_spm
45)
46
47target_compile_definitions(tfm_partition_defs
48    INTERFACE
49        TFM_PARTITION_LOG_LEVEL=${TFM_PARTITION_LOG_LEVEL}
50        $<$<BOOL:${TFM_SP_LOG_RAW_ENABLED}>:TFM_SP_LOG_RAW_ENABLED>
51)
52
53target_include_directories(tfm_sprt
54    INTERFACE
55        $<BUILD_INTERFACE:$<$<BOOL:${CONFIG_TFM_PARTITION_META}>:${CMAKE_CURRENT_SOURCE_DIR}/include>>
56)
57