blob: da77ff376e66ea855f6aa00e0e7acaad17c5ff38 [file] [log] [blame]
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +05301#/** @file
Dávid Házi330c4b12023-05-03 11:20:02 +02002# * Copyright (c) 2019-2023, Arm Limited or its affiliates. All rights reserved.
Bruno De Smet593db412023-03-15 18:47:19 +01003# * Copyright 2023 NXP
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +05304# * SPDX-License-Identifier : Apache-2.0
5# *
6# * Licensed under the Apache License, Version 2.0 (the "License");
7# * you may not use this file except in compliance with the License.
8# * You may obtain a copy of the License at
9# *
10# * http://www.apache.org/licenses/LICENSE-2.0
11# *
12# * Unless required by applicable law or agreed to in writing, software
13# * distributed under the License is distributed on an "AS IS" BASIS,
14# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# * See the License for the specific language governing permissions and
16# * limitations under the License.
17#**/
18
19# Set the minimum required version of CMake for the project
20cmake_minimum_required(VERSION 3.10)
21
22# cmake_policy
23cmake_policy(SET CMP0057 NEW)
24
25# Find python interpreter version 3 or greater
26find_package(PythonInterp 3 REQUIRED)
27# Find Git package
28find_package(Git REQUIRED)
29
30get_filename_component(PSA_ROOT_DIR . ABSOLUTE)
31
Lingkai Dong9d4e7df2021-01-13 16:57:54 +000032include(${PSA_ROOT_DIR}/tools/cmake/common/Utils.cmake)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053033include(${PSA_ROOT_DIR}/tools/cmake/common/CMakeSettings.cmake)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +053034include(${PSA_ROOT_DIR}/tools/cmake/common/CMakeExternal.cmake)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053035
jotman016d7dd4e2020-11-10 17:32:28 +080036if(NOT DEFINED TFM_PROFILE)
37 message(STATUS "[PSA] : Building Default profile")
38list(APPEND PSA_SUITES
39 "IPC"
40 "CRYPTO"
41 "INTERNAL_TRUSTED_STORAGE"
42 "PROTECTED_STORAGE"
43 "STORAGE"
44 "INITIAL_ATTESTATION"
45)
46else()
47
48if("${TFM_PROFILE}" STREQUAL "profile_small")
49# list of supported suites
50list(APPEND PSA_SUITES
51 "CRYPTO"
52 "INTERNAL_TRUSTED_STORAGE"
53 "INITIAL_ATTESTATION"
54)
55else()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053056# list of supported suites
57list(APPEND PSA_SUITES
58 "IPC"
59 "CRYPTO"
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053060 "INTERNAL_TRUSTED_STORAGE"
jotman016d7dd4e2020-11-10 17:32:28 +080061 "PROTECTED_STORAGE"
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +053062 "STORAGE"
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053063 "INITIAL_ATTESTATION"
64)
jotman016d7dd4e2020-11-10 17:32:28 +080065endif()
66endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053067# list of ipc files required
68list(APPEND PSA_IPC_FILES
69 "psa/client.h"
70 "psa/service.h"
Jaykumar Pitambarbhai Patel1c2b0282019-11-06 11:29:13 +053071 "psa/lifecycle.h"
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053072 "psa_manifest/sid.h"
73 "psa_manifest/pid.h"
Jaykumar Pitambarbhai Patel1c2b0282019-11-06 11:29:13 +053074 "psa_manifest/driver_partition_psa.h"
75 "psa_manifest/client_partition_psa.h"
76 "psa_manifest/server_partition_psa.h"
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053077)
78
79# list of crypto files required
80list(APPEND PSA_CRYPTO_FILES
81 "psa/crypto.h"
82)
83
84# list of protected_storage files required
85list(APPEND PSA_PROTECTED_STORAGE_FILES
86 "psa/protected_storage.h"
87)
88
89# list of internal_trusted_storage files required
90list(APPEND PSA_INTERNAL_TRUSTED_STORAGE_FILES
91 "psa/internal_trusted_storage.h"
92)
93
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +053094# list of storage files required
95list(APPEND PSA_STORAGE_FILES
96 ${PSA_INTERNAL_TRUSTED_STORAGE_FILES}
97 ${PSA_PROTECTED_STORAGE_FILES}
98)
99
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530100# list of initial_attestation files required
101list(APPEND PSA_INITIAL_ATTESTATION_FILES
102 "psa/initial_attestation.h"
103 "psa/crypto.h"
104)
105
106# list of supported toolchains
107list(APPEND PSA_TOOLCHAIN_SUPPORT
108 GNUARM
109 ARMCLANG
110 HOST_GCC
jk-arm7e6145a2021-07-19 19:36:14 +0530111 GCC_LINUX
112 INHERIT
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530113)
114
Øyvind Rønningstadc50804e2021-03-12 12:43:25 +0100115# list of supported CROSS_COMPILE toolchains
116list(APPEND CROSS_COMPILE_TOOLCHAIN_SUPPORT
117 GNUARM
jk-arm7e6145a2021-07-19 19:36:14 +0530118 ARMCLANG
119 INHERIT
Øyvind Rønningstadc50804e2021-03-12 12:43:25 +0100120)
121
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530122# list of suported CPU arch
123list(APPEND PSA_CPU_ARCH_SUPPORT
124 armv8m_ml
125 armv8m_bl
Dávid Házi330c4b12023-05-03 11:20:02 +0200126 armv81m_ml
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530127 armv7m
jotman01bed7a152021-05-25 22:57:17 +0800128 armv8a
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530129)
130
131# list of VERBOSE options
132list(APPEND PSA_VERBOSE_OPTIONS 1 2 3 4 5)
133
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530134# list of PLATFORM_PSA_ISOLATION_LEVEL options
jotman016d7dd4e2020-11-10 17:32:28 +0800135if("${TFM_PROFILE}" STREQUAL "profile_medium")
136list(APPEND PLATFORM_PSA_ISOLATION_LEVEL_OPTIONS 1 2)
137else()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530138list(APPEND PLATFORM_PSA_ISOLATION_LEVEL_OPTIONS 1 2 3)
jotman016d7dd4e2020-11-10 17:32:28 +0800139endif()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530140
jk-arm01ee3ff2021-10-18 22:41:47 +0530141#list of INCLUDE_PANIC_TESTS options
142list(APPEND PSA_INCLUDE_PANIC_TESTS_OPTIONS 0 1)
143
jk-armbf532fd2021-05-07 13:58:22 +0530144# list of available spec version
145if("${SUITE}" STREQUAL "STORAGE" OR ${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE" OR ${SUITE} STREQUAL "PROTECTED_STORAGE")
146list(APPEND PSA_SPEC_VERSION
147 1.0-BETA2
148 1.0
149)
150elseif("${SUITE}" STREQUAL "CRYPTO")
151list(APPEND PSA_SPEC_VERSION
152 1.0-BETA1
153 1.0-BETA2
154 1.0-BETA3
155)
156elseif("${SUITE}" STREQUAL "INITIAL_ATTESTATION")
157list(APPEND PSA_SPEC_VERSION
158 1.0-BETA0
159 1.0.0
160 1.0.1
161 1.0.2
162)
jk-arm957cfea2021-06-18 15:52:12 +0530163elseif("${SUITE}" STREQUAL "IPC")
164list(APPEND PSA_SPEC_VERSION
165 1.0
166 1.1
167)
jk-arm957cfea2021-06-18 15:52:12 +0530168endif()
169
170#list of values available for connection based
171if(${SUITE} STREQUAL "IPC")
172list(APPEND PSA_STATELESS_ROT 0 1)
jk-armbf532fd2021-05-07 13:58:22 +0530173endif()
174
jk-arm01ee3ff2021-10-18 22:41:47 +0530175#list of TESTS_COVERAGE available options
176list(APPEND PSA_TESTS_COVERAGE_OPTIONS
177 "ALL"
178 "PASS"
179)
180
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530181message(STATUS "[PSA] : ----------Process input arguments- start-------------")
182
183# Check for TARGET command line argument
184_check_arguments("TARGET")
185# Check for SUTIE command line argument
186_check_arguments("SUITE")
187# Check for PSA_INCLUDE_PATHS command line argument
188_check_arguments("PSA_INCLUDE_PATHS")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530189
190string(TOLOWER ${SUITE} SUITE_LOWER)
191
192# Check for valid targets
193_get_sub_dir_list(PSA_TARGET_LIST ${PSA_ROOT_DIR}/platform/targets)
194if(NOT ${TARGET} IN_LIST PSA_TARGET_LIST)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100195 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DTARGET=${TARGET}, supported targets are : ${PSA_TARGET_LIST}")
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530196else()
197 message(STATUS "[PSA] : TARGET is set to ${TARGET}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530198endif()
199
200# Check for the presence of required test suite directories
201if((NOT IS_DIRECTORY ${PSA_ROOT_DIR}/dev_apis) OR (NOT IS_DIRECTORY ${PSA_ROOT_DIR}/ff))
202 message(STATUS "[PSA] : Error: Could not find architecture test suite directories in psa root path ${PSA_ROOT_DIR}")
203endif()
204
205if(FALSE)
206# Check for build directory specified
207if(NOT DEFINED BUILD)
208 set(BUILD ${CMAKE_CURRENT_BINARY_DIR}/BUILD CACHE INTERNAL "Defaulting build directory to ${BUILD}" FORCE)
209else()
210 set(BUILD ${CMAKE_CURRENT_BINARY_DIR}/${BUILD}/BUILD CACHE INTERNAL "Defaulting build directory to ${BUILD}" FORCE)
211endif()
212endif()
213
214# Check for valid suite cmake argument passed
215if(NOT ${SUITE} IN_LIST PSA_SUITES)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100216 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DSUITE=${SUITE}, select one from supported suites which are : ${PSA_SUITES}")
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530217else()
218 message(STATUS "[PSA] : SUITE is set to ${SUITE}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530219endif()
220
221# Project variables
222set(PSA_TARGET_PRE_BUILD psa_pre_build)
223set(PSA_TARGET_GENERATE_DATABASE_PRE psa_generate_database_prerequisite)
224set(PSA_TARGET_GENERATE_DATABASE psa_generate_database)
225set(PSA_TARGET_GENERATE_DATABASE_POST psa_generate_database_cleanup)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530226if(${SUITE} STREQUAL "INITIAL_ATTESTATION")
Gyorgy Szing42d62332022-02-08 17:50:04 +0000227 set(PSA_TARGET_QCBOR ${CMAKE_CURRENT_BINARY_DIR}/psa_qcbor CACHE PATH "Location of Q_CBOR sources.")
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530228endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530229set(PSA_TARGET_PAL_NSPE_LIB pal_nspe)
230set(PSA_TARGET_VAL_NSPE_LIB val_nspe)
231set(PSA_TARGET_TEST_COMBINE_LIB test_combine)
jk-armbf532fd2021-05-07 13:58:22 +0530232set(PSA_TARGET_DRIVER_PARTITION_LIB tfm_psa_rot_partition_driver_partition)
233set(PSA_TARGET_CLIENT_PARTITION_LIB tfm_app_rot_partition_client_partition)
234set(PSA_TARGET_SERVER_PARTITION_LIB tfm_app_rot_partition_server_partition)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530235if(${SUITE} STREQUAL "IPC")
236 set(PSA_SUITE_DIR ${PSA_ROOT_DIR}/ff/${SUITE_LOWER})
237 set(PSA_SUITE_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/ff/${SUITE_LOWER})
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +0530238elseif((${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE") OR (${SUITE} STREQUAL "PROTECTED_STORAGE"))
239 set(PSA_SUITE_DIR ${PSA_ROOT_DIR}/dev_apis/storage)
240 set(PSA_SUITE_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/dev_apis/storage)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530241else()
242 set(PSA_SUITE_DIR ${PSA_ROOT_DIR}/dev_apis/${SUITE_LOWER})
243 set(PSA_SUITE_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/dev_apis/${SUITE_LOWER})
244endif()
245set(PSA_TARGET_CONFIG_HEADER_GENERATOR ${PSA_ROOT_DIR}/tools/scripts/target_cfg/targetConfigGen.py)
246set(PSA_TESTLIST_GENERATOR ${PSA_ROOT_DIR}/tools/scripts/gen_tests_list.py)
247set(TARGET_CONFIGURATION_FILE ${PSA_ROOT_DIR}/platform/targets/${TARGET}/target.cfg)
248set(TGT_CONFIG_SOURCE_C ${CMAKE_CURRENT_BINARY_DIR}/targetConfigGen.c)
249set(OUTPUT_HEADER target_database.h)
250set(DATABASE_TABLE_NAME target_database)
251set(DATABASE_TABLE_SECTION_NAME "NOSECTION")
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +0530252set(TARGET_HEADER_GEN_INCLUDE_PATHS "${PSA_ROOT_DIR}/val/nspe|${PSA_ROOT_DIR}/val/common|${PSA_ROOT_DIR}/platform/targets/common/nspe|${PSA_ROOT_DIR}/platform/targets/common/nspe/crypto|${PSA_ROOT_DIR}/platform/targets/${TARGET}/nspe")
jk-armbf532fd2021-05-07 13:58:22 +0530253if(NOT DEFINED SPEC_VERSION)
254 if(${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE")
255 set(TESTSUITE_DB ${PSA_SUITE_DIR}/its_testsuite.db)
256 elseif((${SUITE} STREQUAL "PROTECTED_STORAGE") OR (${SUITE} STREQUAL "STORAGE"))
257 set(TESTSUITE_DB ${PSA_SUITE_DIR}/ps_testsuite.db)
258 else()
259 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
260 endif()
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +0530261else()
jk-armbf532fd2021-05-07 13:58:22 +0530262 if(${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE")
263 if(${SPEC_VERSION} STREQUAL "1.0-BETA2")
264 set(TESTSUITE_DB ${PSA_SUITE_DIR}/its_1.0-beta2_testsuite.db)
265 endif()
266 if(${SPEC_VERSION} STREQUAL "1.0")
267 set(TESTSUITE_DB ${PSA_SUITE_DIR}/its_1.0_testsuite.db)
268 endif()
269 elseif((${SUITE} STREQUAL "PROTECTED_STORAGE") OR (${SUITE} STREQUAL "STORAGE"))
270 if(${SPEC_VERSION} STREQUAL "1.0-BETA2")
271 set(TESTSUITE_DB ${PSA_SUITE_DIR}/ps_1.0-beta2_testsuite.db)
272 endif()
273 if(${SPEC_VERSION} STREQUAL "1.0")
274 set(TESTSUITE_DB ${PSA_SUITE_DIR}/ps_1.0_testsuite.db)
275 endif()
276 elseif(${SUITE} STREQUAL "CRYPTO")
277 if(${SPEC_VERSION} STREQUAL "1.0-BETA1")
278 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0-beta1_testsuite.db)
279 endif()
280 if(${SPEC_VERSION} STREQUAL "1.0-BETA2")
281 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0-beta2_testsuite.db)
282 endif()
283 if(${SPEC_VERSION} STREQUAL "1.0-BETA3")
284 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0-beta3_testsuite.db)
285 endif()
286 elseif(${SUITE} STREQUAL "INITIAL_ATTESTATION")
287 if(${SPEC_VERSION} STREQUAL "1.0-BETA0")
288 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0-beta0_testsuite.db)
289 endif()
290 if(${SPEC_VERSION} STREQUAL "1.0.0")
291 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0.0_testsuite.db)
292 endif()
293 if(${SPEC_VERSION} STREQUAL "1.0.1")
294 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0.1_testsuite.db)
295 endif()
296 if(${SPEC_VERSION} STREQUAL "1.0.2")
297 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0.2_testsuite.db)
298 endif()
jk-arm957cfea2021-06-18 15:52:12 +0530299 elseif(${SUITE} STREQUAL "IPC")
300 if(${SPEC_VERSION} STREQUAL "1.1")
301 if(DEFINED STATELESS_ROT_TESTS)
302 if(${STATELESS_ROT_TESTS} EQUAL 1)
303 set(TESTSUITE_DB ${PSA_SUITE_DIR}/stateless_rot_testsuite.db)
304 else()
305 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
306 endif()
307 else()
308 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
309 endif()
310 else()
311 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
312 endif()
313 endif()
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +0530314endif()
315set(PSA_TESTLIST_FILE ${CMAKE_CURRENT_BINARY_DIR}/${SUITE_LOWER}_testlist.txt)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530316set(PSA_TEST_ENTRY_LIST_INC ${CMAKE_CURRENT_BINARY_DIR}/test_entry_list.inc)
317set(PSA_TEST_ENTRY_FUN_DECLARE_INC ${CMAKE_CURRENT_BINARY_DIR}/test_entry_fn_declare_list.inc)
318set(PSA_CLIENT_TEST_LIST_DELCARE_INC ${CMAKE_CURRENT_BINARY_DIR}/client_tests_list_declare.inc)
319set(PSA_CLIENT_TEST_LIST_INC ${CMAKE_CURRENT_BINARY_DIR}/client_tests_list.inc)
320set(PSA_SERVER_TEST_LIST_DECLARE_INC ${CMAKE_CURRENT_BINARY_DIR}/server_tests_list_declare.inc)
321set(PSA_SERVER_TEST_LIST ${CMAKE_CURRENT_BINARY_DIR}/server_tests_list.inc)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530322if(${SUITE} STREQUAL "INITIAL_ATTESTATION")
Gyorgy Szing42d62332022-02-08 17:50:04 +0000323 set(PSA_QCBOR_INCLUDE_PATH ${PSA_TARGET_QCBOR}/inc)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530324endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530325
326# Validity check for required files for a given suite
327if(NOT DEFINED PSA_${SUITE}_FILES)
328 message(FATAL_ERROR "[PSA] : List of file/s to verify against ${suite} is not defined")
329endif()
330foreach(file_item ${PSA_${SUITE}_FILES})
331 set(PSA_FILE_FOUND FALSE)
332 foreach(include_path ${PSA_INCLUDE_PATHS})
333 if((EXISTS ${include_path}/${file_item}) AND
334 (NOT PSA_FILE_FOUND))
335 set(PSA_FILE_FOUND TRUE)
336 break()
337 endif()
338 endforeach()
339 if(NOT PSA_FILE_FOUND)
340 message(FATAL_ERROR "[PSA] : Couldn't find ${file_item} in ${PSA_INCLUDE_PATHS}")
341 endif()
342endforeach()
343
344# Check for TOOLCHAIN command line argument
345if(NOT DEFINED TOOLCHAIN)
346 set(TOOLCHAIN "GNUARM" CACHE INTERNAL "Compiler used" FORCE)
347 message(STATUS "[PSA] : Defaulting compiler to ${TOOLCHAIN}")
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530348else()
349 message(STATUS "[PSA] : TOOLCHAIN is set to ${TOOLCHAIN}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530350endif()
351
Gowtham Siddarth1d6d4692019-09-16 11:47:29 +0530352if(${TOOLCHAIN} STREQUAL "ARMCLANG" OR ${TOOLCHAIN} STREQUAL "GNUARM")
353 if(NOT DEFINED CPU_ARCH)
354 message(FATAL_ERROR "[PSA] : Error: -DCPU_ARCH option missing")
355 else()
356 # Check for CPU architecture
357 if(NOT ${CPU_ARCH} IN_LIST PSA_CPU_ARCH_SUPPORT)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100358 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DCPU_ARCH=${CPU_ARCH}, supported CPU arch are : ${PSA_CPU_ARCH_SUPPORT}")
Gowtham Siddarth1d6d4692019-09-16 11:47:29 +0530359 endif()
360 endif()
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530361 message(STATUS "[PSA] : CPU_ARCH is set to ${CPU_ARCH}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530362endif()
363
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530364# Check for VERBOSE
365if(NOT DEFINED VERBOSE)
366 set(VERBOSE 3 CACHE INTERNAL "Default VERBOSE value" FORCE)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530367 message(STATUS "[PSA] : Defaulting VERBOSE to ${VERBOSE}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530368else()
369 if(NOT ${VERBOSE} IN_LIST PSA_VERBOSE_OPTIONS)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100370 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DVERBOSE=${VERBOSE}, supported values are : ${PSA_VERBOSE_OPTIONS}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530371 endif()
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530372 message(STATUS "[PSA] : VERBOSE is set to ${VERBOSE}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530373endif()
374
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530375# Check for PLATFORM_PSA_ISOLATION_LEVEL
376if(NOT DEFINED PLATFORM_PSA_ISOLATION_LEVEL)
jotman016d7dd4e2020-11-10 17:32:28 +0800377 if("${TFM_PROFILE}" STREQUAL "profile_medium")
378 set(PLATFORM_PSA_ISOLATION_LEVEL 2 CACHE INTERNAL "Default PLATFORM_PSA_ISOLATION_LEVEL value" FORCE)
379 else()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530380 set(PLATFORM_PSA_ISOLATION_LEVEL 3 CACHE INTERNAL "Default PLATFORM_PSA_ISOLATION_LEVEL value" FORCE)
jotman016d7dd4e2020-11-10 17:32:28 +0800381 endif()
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530382 if(${SUITE} STREQUAL "IPC")
383 message(STATUS "[PSA] : Defaulting PLATFORM_PSA_ISOLATION_LEVEL to ${PLATFORM_PSA_ISOLATION_LEVEL}")
384 endif()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530385else()
386 if(NOT ${PLATFORM_PSA_ISOLATION_LEVEL} IN_LIST PLATFORM_PSA_ISOLATION_LEVEL_OPTIONS)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100387 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DPLATFORM_PSA_ISOLATION_LEVEL=${PLATFORM_PSA_ISOLATION_LEVEL}, supported values are : ${PLATFORM_PSA_ISOLATION_LEVEL_OPTIONS}")
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530388 endif()
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530389 if(${SUITE} STREQUAL "IPC")
390 message(STATUS "[PSA] : PLATFORM_PSA_ISOLATION_LEVEL is set to ${PLATFORM_PSA_ISOLATION_LEVEL}")
391 endif()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530392endif()
393
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530394if(NOT DEFINED INCLUDE_PANIC_TESTS)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530395 #By default panic tests are disabled
396 set(INCLUDE_PANIC_TESTS 0 CACHE INTERNAL "Default INCLUDE_PANIC_TESTS value" FORCE)
397 message(STATUS "[PSA] : Defaulting INCLUDE_PANIC_TESTS to ${INCLUDE_PANIC_TESTS}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530398else()
jk-arm01ee3ff2021-10-18 22:41:47 +0530399 if(NOT ${INCLUDE_PANIC_TESTS} IN_LIST PSA_INCLUDE_PANIC_TESTS_OPTIONS)
400 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DINCLUDE_PANIC_TESTS=${INCLUDE_PANIC_TESTS}, supported values are : ${PSA_INCLUDE_PANIC_TESTS_OPTIONS}")
401 endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530402 if(INCLUDE_PANIC_TESTS EQUAL 1)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530403 message(STATUS "[PSA] : "
404 "INCLUDE_PANIC_TESTS set to 1, therefore including PSA APIs panic tests into the regression,\n"
405 "\tensure that watchdog.num is set to 1 in ${PSA_ROOT_DIR}/platform/targets/${TARGET}/target.cfg")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530406 endif()
407endif()
408
409if(NOT DEFINED WATCHDOG_AVAILABLE)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530410 #Assuming watchdog is available to program by test suite
411 set(WATCHDOG_AVAILABLE 1 CACHE INTERNAL "Default WATCHDOG_AVAILABLE value" FORCE)
412 message(STATUS "[PSA] : Defaulting WATCHDOG_AVAILABLE to ${WATCHDOG_AVAILABLE}")
413else()
414 message(STATUS "[PSA] : WATCHDOG_AVAILABLE is set to ${WATCHDOG_AVAILABLE}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530415endif()
416
417if((INCLUDE_PANIC_TESTS EQUAL 1) AND
418 (WATCHDOG_AVAILABLE EQUAL 0))
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530419 message(WARNING "[PSA]: "
420 "Note that to test PSA APIs panic conditions, test harness may require to access"
421 "the watchdog timer in oder to recover from panic and to be able to continue with"
422 "next test. Ignore this warning if system under test has capability to reset the"
423 "system when it encounters panic condition.")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530424endif()
425
426if(NOT DEFINED SP_HEAP_MEM_SUPP)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530427 #Are dynamic memory functions available to secure partition?
428 set(SP_HEAP_MEM_SUPP 1 CACHE INTERNAL "Default SP_HEAP_MEM_SUPP value" FORCE)
429 message(STATUS "[PSA] : Defaulting SP_HEAP_MEM_SUPP to ${SP_HEAP_MEM_SUPP}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530430endif()
431
Vinay Kumar Kotegowderac218992020-04-03 12:56:00 +0530432if(NOT DEFINED SUITE_TEST_RANGE)
433 set(SUITE_TEST_RANGE_MIN None)
434 set(SUITE_TEST_RANGE_MAX None)
435else()
436 list(LENGTH SUITE_TEST_RANGE SUITE_TEST_RANGE_LENGTH)
437 if(${SUITE_TEST_RANGE_LENGTH} GREATER "2")
438 message(FATAL_ERROR "[PSA] : -DSUITE_TEST_RANGE=<...> value error! accepts two "
439 " numbers in quotes separated with ';'")
440 endif()
441 if(${SUITE_TEST_RANGE_LENGTH} EQUAL "2")
442 list(GET SUITE_TEST_RANGE 0 SUITE_TEST_RANGE_MIN)
443 list(GET SUITE_TEST_RANGE 1 SUITE_TEST_RANGE_MAX)
444 message(STATUS "[PSA] : Testing (${SUITE_TEST_RANGE_MIN}, ${SUITE_TEST_RANGE_MAX}) of ${SUITE} suite")
445 endif()
446 if(${SUITE_TEST_RANGE_LENGTH} EQUAL "1")
447 set(SUITE_TEST_RANGE_MIN ${SUITE_TEST_RANGE})
448 set(SUITE_TEST_RANGE_MAX ${SUITE_TEST_RANGE})
449 message(STATUS "[PSA] : Testing ${SUITE_TEST_RANGE_MIN} of ${SUITE} suite")
450 endif()
451endif()
452
jk-armbf532fd2021-05-07 13:58:22 +0530453if(NOT DEFINED SPEC_VERSION)
454 message(STATUS "[PSA] : Default spec version")
455else()
456 if(NOT ${SPEC_VERSION} IN_LIST PSA_SPEC_VERSION)
457 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DSPEC_VERSION=${SPEC_VERSION}, supported values are : ${PSA_SPEC_VERSION} for ${SUITE}")
458 else()
459 message(STATUS "[PSA] : Testing ${SUITE} for spec version ${SPEC_VERSION}")
460 endif()
461endif()
462
jk-arm957cfea2021-06-18 15:52:12 +0530463if(DEFINED STATELESS_ROT_TESTS)
464 if(NOT ${STATELESS_ROT_TESTS} IN_LIST PSA_STATELESS_ROT)
465 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DSTATELESS_ROT_TESTS=${STATELESS_ROT_TESTS}, supported values are : ${PSA_STATELESS_ROT}")
466 elseif(${STATELESS_ROT_TESTS} EQUAL 1)
467 message(STATUS "[PSA] : Testing ${SUITE} for stateless rot")
468 elseif(${STATELESS_ROT_TESTS} EQUAL 0)
469 message(STATUS "[PSA] : Testing ${SUITE} for connection based")
470 endif()
471
472 if(NOT DEFINED SPEC_VERSION)
473 message(FATAL_ERROR "[PSA] : Error: SPEC_VERSION is require for STATELESS_ROT_TESTS.")
474 elseif(${SUITE} STREQUAL "IPC")
475 if(${SPEC_VERSION} STREQUAL "1.0")
476 message(FATAL_ERROR "[PSA] : Error: STATELESS_ROT_TESTS is only valid for SPEC_VERSION=1.1.")
477 elseif(${SPEC_VERSION} STREQUAL "1.1")
478 add_definitions(-DSPEC_VERSION=11)
479 if(${STATELESS_ROT_TESTS} EQUAL 1)
480 add_definitions(-DSTATELESS_ROT=1)
481 elseif(${STATELESS_ROT_TESTS} EQUAL 0)
482 add_definitions(-DSTATELESS_ROT=0)
483 endif()
484 endif()
485 else()
486 message(FATAL_ERROR "[PSA] : Error: STATELESS_ROT_TESTS is only applicable to IPC Test Suite.")
487 endif()
488else()
489 add_definitions(-DSTATELESS_ROT=0)
490 if(DEFINED SPEC_VERSION)
491 if(${SUITE} STREQUAL "IPC")
492 if(${SPEC_VERSION} STREQUAL "1.0")
493 add_definitions(-DSPEC_VERSION=10)
494 endif()
495 if(${SPEC_VERSION} STREQUAL "1.1")
496 add_definitions(-DSPEC_VERSION=11)
497 endif()
498 endif()
499 endif()
500endif()
501
jk-arm01ee3ff2021-10-18 22:41:47 +0530502if(NOT DEFINED TESTS_COVERAGE)
503 #By default all tests are included
504 set(TESTS_COVERAGE "ALL" CACHE INTERNAL "Default TESTS_COVERAGE value" FORCE)
505 message(STATUS "[PSA] : Defaulting TESTS_COVERAGE to ${TESTS_COVERAGE}")
506else()
507 if(NOT ${TESTS_COVERAGE} IN_LIST PSA_TESTS_COVERAGE_OPTIONS)
508 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DTESTS_COVERAGE=${TESTS_COVERAGE}, supported values are : ${PSA_TESTS_COVERAGE_OPTIONS}")
509 endif()
510 if(TESTS_COVERAGE STREQUAL ALL)
511 message(STATUS "[PSA] : "
512 "TESTS_COVERAGE set to ALL, therefore all tests are included.")
513 endif()
514 if(TESTS_COVERAGE STREQUAL PASS)
515 message(STATUS "[PSA] : "
516 "TESTS_COVERAGE set to PASS, therefore known failure tests are not included.")
517 add_definitions(-DTESTS_COVERAGE)
518 endif()
519endif()
520
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530521message(STATUS "[PSA] : ----------Process input arguments- complete-------------")
522
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530523
Gyorgy Szing42d62332022-02-08 17:50:04 +0000524if((${SUITE} STREQUAL "INITIAL_ATTESTATION") AND (NOT EXISTS ${PSA_TARGET_QCBOR}))
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530525# Clone QCBOR and move to specified tag
526execute_process(COMMAND ${GIT_EXECUTABLE} clone ${PSA_QCBOR_GIT_REPO_LINK} ${PSA_TARGET_QCBOR}
Gyorgy Szing42d62332022-02-08 17:50:04 +0000527 RESULT_VARIABLE qcbor_clone_result
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530528 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
Gyorgy Szing42d62332022-02-08 17:50:04 +0000529if(qcbor_clone_result)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530530 message(FATAL_ERROR "git clone failed for ${PSA_QCBOR_GIT_REPO_LINK}")
531endif()
532
Gyorgy Szing42d62332022-02-08 17:50:04 +0000533if(NOT qcbor_clone_result)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530534execute_process(COMMAND ${GIT_EXECUTABLE} checkout -q "${PSA_QCBOR_GIT_REPO_TAG}"
Gyorgy Szing42d62332022-02-08 17:50:04 +0000535 RESULT_VARIABLE qcbor_checkout_result
536 WORKING_DIRECTORY ${PSA_TARGET_QCBOR})
537if(qcbor_checkout_result)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530538 message(FATAL_ERROR "git checkout failed for Repo : ${PSA_QCBOR_GIT_REPO_LINK}, Tag : ${PSA_QCBOR_GIT_REPO_TAG}")
539endif()
540endif()
541endif()
gowtham siddarth12833042020-02-10 22:11:11 +0530542
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530543# Create PSA clean list
544list(APPEND PSA_CLEAN_LIST
545 ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_HEADER}
546 ${PSA_TESTLIST_FILE}
547 ${PSA_TEST_ENTRY_LIST_INC}
548 ${PSA_TEST_ENTRY_FUN_DECLARE_INC}
549 ${PSA_CLIENT_TEST_LIST_DELCARE_INC}
550 ${PSA_CLIENT_TEST_LIST_INC}
551 ${PSA_SERVER_TEST_LIST_DECLARE_INC}
552 ${PSA_SERVER_TEST_LIST}
553)
554
555# Process testsuite.db
556message(STATUS "[PSA] : Creating testlist.txt 'available at ${PSA_TESTLIST_FILE}'")
557execute_process(COMMAND ${PYTHON_EXECUTABLE} ${PSA_TESTLIST_GENERATOR}
558 ${SUITE_LOWER}
559 ${TESTSUITE_DB}
560 ${INCLUDE_PANIC_TESTS}
jk-arm01ee3ff2021-10-18 22:41:47 +0530561 ${TESTS_COVERAGE}
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530562 ${PSA_TESTLIST_FILE}
563 ${PSA_TEST_ENTRY_LIST_INC}
564 ${PSA_TEST_ENTRY_FUN_DECLARE_INC}
565 ${PSA_CLIENT_TEST_LIST_DELCARE_INC}
566 ${PSA_CLIENT_TEST_LIST_INC}
567 ${PSA_SERVER_TEST_LIST_DECLARE_INC}
Vinay Kumar Kotegowderac218992020-04-03 12:56:00 +0530568 ${PSA_SERVER_TEST_LIST}
569 ${SUITE_TEST_RANGE_MIN}
570 ${SUITE_TEST_RANGE_MAX})
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530571
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530572# Creating CMake list variable from file
573file(READ ${PSA_TESTLIST_FILE} PSA_TEST_LIST)
Vinay Kumar Kotegowderac218992020-04-03 12:56:00 +0530574if(NOT PSA_TEST_LIST)
575 message(FATAL_ERROR "[PSA] : Invalid test number!")
576endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530577string(REGEX REPLACE "\n" ";" PSA_TEST_LIST "${PSA_TEST_LIST}")
578
579add_custom_target(
580 ${PSA_TARGET_GENERATE_DATABASE_PRE}
581 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/platform
582 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/val
583 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/partition
584 COMMAND ${CMAKE_COMMAND} -E make_directory ${PSA_SUITE_OUT_DIR}
585)
586
587# Generate target files from User provided data base
588include(ExternalProject)
589ExternalProject_Add(
590 ${PSA_TARGET_GENERATE_DATABASE}
591 PREFIX ${CMAKE_CURRENT_BINARY_DIR}
592 DOWNLOAD_COMMAND ""
593 UPDATE_COMMAND ""
594 PATCH_COMMAND ""
jothikumar manied3f1c02023-04-28 16:17:25 +0800595 BUILD_ALWAYS TRUE
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530596 SOURCE_DIR "${PSA_ROOT_DIR}/tools/scripts/target_cfg"
597 CMAKE_ARGS -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
598 -DOUT_DIR=${CMAKE_CURRENT_BINARY_DIR}
599 -DTARGET=${TARGET}
600 -DGENERATOR_FILE=${PSA_TARGET_CONFIG_HEADER_GENERATOR}
601 -DINCLUDE_DIR=${PSA_ROOT_DIR}/val/common
602 -DTARGET_CONFIGURATION_FILE=${TARGET_CONFIGURATION_FILE}
603 -DTGT_CONFIG_SOURCE_C=${TGT_CONFIG_SOURCE_C}
604 -DOUTPUT_HEADER=${OUTPUT_HEADER}
605 -DDATABASE_TABLE_NAME=${DATABASE_TABLE_NAME}
606 -DDATABASE_TABLE_SECTION_NAME=${DATABASE_TABLE_SECTION_NAME}
607 -DTARGET_HEADER_GEN_INCLUDE_PATHS=${TARGET_HEADER_GEN_INCLUDE_PATHS}
608 LIST_SEPARATOR |
609 TEST_COMMAND ""
610)
611
612# Add custom target to clean generated files of the external project
613add_custom_target(
614 ${PSA_TARGET_GENERATE_DATABASE_POST}
615 COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/src/${PSA_TARGET_GENERATE_DATABASE}-build/ -- clean
616)
617
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530618# Check for supported toolchain/s
619if(${TOOLCHAIN} IN_LIST PSA_TOOLCHAIN_SUPPORT)
jk-armbf532fd2021-05-07 13:58:22 +0530620 if (DEFINED CROSS_COMPILE)
jk-arm7e6145a2021-07-19 19:36:14 +0530621 if(NOT (${TOOLCHAIN} IN_LIST CROSS_COMPILE_TOOLCHAIN_SUPPORT))
622 message(FATAL_ERROR "[PSA] : Error: CROSS_COMPILE not supported for this toolchain, supported toolchain are : ${CROSS_COMPILE_TOOLCHAIN_SUPPORT}")
623 endif()
jk-armbf532fd2021-05-07 13:58:22 +0530624 endif()
jk-arm7e6145a2021-07-19 19:36:14 +0530625 include(${PSA_ROOT_DIR}/tools/cmake/compiler/${TOOLCHAIN}.cmake)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530626else()
jk-arm7e6145a2021-07-19 19:36:14 +0530627 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DTOOLCHAIN=${TOOLCHAIN}, supported toolchain are : ${PSA_TOOLCHAIN_SUPPORT}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530628endif()
629
630# Global macro to identify the PSA test suite cmake build
631add_definitions(-DPSA_CMAKE_BUILD)
632add_definitions(-D${SUITE})
633add_definitions(-DVERBOSE=${VERBOSE})
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530634add_definitions(-DPLATFORM_PSA_ISOLATION_LEVEL=${PLATFORM_PSA_ISOLATION_LEVEL})
Vinay Kumar Kotegowder52bbfc92020-07-03 17:23:59 +0530635add_definitions(-D${TARGET})
jotman016d7dd4e2020-11-10 17:32:28 +0800636if("${TFM_PROFILE}" STREQUAL "profile_small")
637 message(STATUS "[PSA] : Building SMALL profile")
638 add_definitions(-DTF_M_PROFILE_SMALL)
639elseif("${TFM_PROFILE}" STREQUAL "profile_medium")
640 message(STATUS "[PSA] : Building MEDIUM profile")
641 add_definitions(-DTF_M_PROFILE_MEDIUM)
642endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530643if(${SP_HEAP_MEM_SUPP} EQUAL 1)
644 add_definitions(-DSP_HEAP_MEM_SUPP)
645endif()
jotman0138cb53a2023-02-14 16:27:06 +0800646
Summer Qin937a1ed2022-07-13 10:29:26 +0800647if(${CC312_LEGACY_DRIVER_API_ENABLED})
648 add_definitions(-DCC312_LEGACY_DRIVER_API_ENABLED)
649endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530650
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530651# Build PAL NSPE LIB
Bruno De Smet593db412023-03-15 18:47:19 +0100652include(${PSA_ROOT_DIR}/platform/targets/common/nspe/pal_nspe.cmake)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530653include(${PSA_ROOT_DIR}/platform/targets/${TARGET}/target.cmake)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530654# Build VAL NSPE LIB
655#add_definitions(-DVAL_NSPE_BUILD)
656include(${PSA_ROOT_DIR}/val/val_nspe.cmake)
657# Build test
658include(${PSA_SUITE_DIR}/suite.cmake)
659if(${SUITE} STREQUAL "IPC")
660# Build SPE LIB
661include(${PSA_ROOT_DIR}/val/val_spe.cmake)
662endif()
663
664add_dependencies(${PSA_TARGET_GENERATE_DATABASE} ${PSA_TARGET_GENERATE_DATABASE_PRE})
665add_dependencies(${PSA_TARGET_GENERATE_DATABASE_POST} ${PSA_TARGET_GENERATE_DATABASE})
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530666add_dependencies(${PSA_TARGET_PAL_NSPE_LIB} ${PSA_TARGET_GENERATE_DATABASE_POST})
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530667add_dependencies(${PSA_TARGET_VAL_NSPE_LIB} ${PSA_TARGET_PAL_NSPE_LIB})
668add_dependencies(${PSA_TARGET_TEST_COMBINE_LIB} ${PSA_TARGET_VAL_NSPE_LIB})
669if(${SUITE} STREQUAL "IPC")
670add_dependencies(${PSA_TARGET_DRIVER_PARTITION_LIB} ${PSA_TARGET_TEST_COMBINE_LIB})
671add_dependencies(${PSA_TARGET_CLIENT_PARTITION_LIB} ${PSA_TARGET_DRIVER_PARTITION_LIB})
672add_dependencies(${PSA_TARGET_SERVER_PARTITION_LIB} ${PSA_TARGET_CLIENT_PARTITION_LIB})
673endif()
674
675# Include the files for make clean
676foreach(clean_item ${PSA_CLEAN_LIST})
677 set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${clean_item})
678endforeach()
679
680set_property(TARGET ${PSA_TARGET_VAL_NSPE_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/val)
681set_property(TARGET ${PSA_TARGET_PAL_NSPE_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/platform)
682set_property(TARGET ${PSA_TARGET_TEST_COMBINE_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${PSA_SUITE_OUT_DIR})
683if(${SUITE} STREQUAL "IPC")
684set_property(TARGET ${PSA_TARGET_DRIVER_PARTITION_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/partition)
685set_property(TARGET ${PSA_TARGET_CLIENT_PARTITION_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/partition)
686set_property(TARGET ${PSA_TARGET_SERVER_PARTITION_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/partition)
687endif()