1#/** @file
2# * Copyright (c) 2021-2022, Arm Limited or its affiliates. All rights reserved.
3# * SPDX-License-Identifier : Apache-2.0
4# *
5# * Licensed under the Apache License, Version 2.0 (the "License");
6# * you may not use this file except in compliance with the License.
7# * You may obtain a copy of the License at
8# *
9# *  http://www.apache.org/licenses/LICENSE-2.0
10# *
11# * Unless required by applicable law or agreed to in writing, software
12# * distributed under the License is distributed on an "AS IS" BASIS,
13# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# * See the License for the specific language governing permissions and
15# * limitations under the License.
16#**/
17
18
19
20# PAL C source files part of NSPE library
21list(APPEND PAL_SRC_C_NSPE )
22
23# PAL ASM source files part of NSPE library
24list(APPEND PAL_SRC_ASM_NSPE )
25
26# PAL C source files part of SPE library - driver partition
27list(APPEND PAL_SRC_C_DRIVER_SP )
28
29# PAL ASM source files part of SPE library - driver partition
30list(APPEND PAL_SRC_ASM_DRIVER_SP )
31
32# Listing all the sources required for given target
33if(${SUITE} STREQUAL "IPC")
34	message(FATAL_ERROR "IPC not supported")
35else()
36	list(APPEND PAL_SRC_C_NSPE
37		# driver files will be compiled as part of NSPE
38		${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe/pal_driver_intf.c
39	)
40endif()
41if(${SUITE} STREQUAL "CRYPTO")
42	list(APPEND PAL_SRC_C_NSPE
43		${PSA_ROOT_DIR}/platform/targets/common/nspe/crypto/pal_crypto_intf.c
44	)
45endif()
46if(${SUITE} STREQUAL "PROTECTED_STORAGE")
47	list(APPEND PAL_SRC_C_NSPE
48		${PSA_ROOT_DIR}/platform/targets/common/nspe/protected_storage/pal_protected_storage_intf.c
49	)
50endif()
51if(${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE")
52	list(APPEND PAL_SRC_C_NSPE
53		${PSA_ROOT_DIR}/platform/targets/common/nspe/internal_trusted_storage/pal_internal_trusted_storage_intf.c
54	)
55endif()
56if(${SUITE} STREQUAL "STORAGE")
57	list(APPEND PAL_SRC_C_NSPE
58		${PSA_ROOT_DIR}/platform/targets/common/nspe/internal_trusted_storage/pal_internal_trusted_storage_intf.c
59		${PSA_ROOT_DIR}/platform/targets/common/nspe/protected_storage/pal_protected_storage_intf.c
60	)
61endif()
62if(${SUITE} STREQUAL "INITIAL_ATTESTATION")
63	list(APPEND PAL_SRC_C_NSPE
64		${PSA_ROOT_DIR}/platform/targets/common/nspe/initial_attestation/pal_attestation_intf.c
65		${PSA_ROOT_DIR}/platform/targets/common/nspe/initial_attestation/pal_attestation_crypto.c
66                ${PSA_TARGET_QCBOR}/src/UsefulBuf.c
67                ${PSA_TARGET_QCBOR}/src/ieee754.c
68                ${PSA_TARGET_QCBOR}/src/qcbor_decode.c
69                ${PSA_TARGET_QCBOR}/src/qcbor_encode.c
70	)
71endif()
72
73# Create NSPE library
74add_library(${PSA_TARGET_PAL_NSPE_LIB} STATIC ${PAL_SRC_C_NSPE} ${PAL_SRC_ASM_NSPE})
75
76# PSA Include directories
77foreach(psa_inc_path ${PSA_INCLUDE_PATHS})
78	target_include_directories(${PSA_TARGET_PAL_NSPE_LIB} PRIVATE ${psa_inc_path})
79endforeach()
80
81target_include_directories(${PSA_TARGET_PAL_NSPE_LIB} PRIVATE
82	${PSA_ROOT_DIR}/platform/targets/common/nspe
83	${PSA_ROOT_DIR}/platform/targets/common/nspe/crypto
84	${PSA_ROOT_DIR}/platform/targets/common/nspe/protected_storage
85	${PSA_ROOT_DIR}/platform/targets/common/nspe/internal_trusted_storage
86	${PSA_ROOT_DIR}/platform/targets/common/nspe/initial_attestation
87	${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe
88)
89
90if(${SUITE} STREQUAL "INITIAL_ATTESTATION")
91	target_include_directories(${PSA_TARGET_PAL_NSPE_LIB} PRIVATE
92		${PSA_QCBOR_INCLUDE_PATH}
93	)
94endif()
95