blob: 18973733e9823194c4e99c6b27790887d2db5b8a [file] [log] [blame]
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +05301#/** @file
Gyorgy Szing42d62332022-02-08 17:50:04 +00002# * Copyright (c) 2019-2022, 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
126 armv7m
jotman01bed7a152021-05-25 22:57:17 +0800127 armv8a
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530128)
129
130# list of VERBOSE options
131list(APPEND PSA_VERBOSE_OPTIONS 1 2 3 4 5)
132
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530133# list of PLATFORM_PSA_ISOLATION_LEVEL options
jotman016d7dd4e2020-11-10 17:32:28 +0800134if("${TFM_PROFILE}" STREQUAL "profile_medium")
135list(APPEND PLATFORM_PSA_ISOLATION_LEVEL_OPTIONS 1 2)
136else()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530137list(APPEND PLATFORM_PSA_ISOLATION_LEVEL_OPTIONS 1 2 3)
jotman016d7dd4e2020-11-10 17:32:28 +0800138endif()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530139
jk-arm01ee3ff2021-10-18 22:41:47 +0530140#list of INCLUDE_PANIC_TESTS options
141list(APPEND PSA_INCLUDE_PANIC_TESTS_OPTIONS 0 1)
142
jk-armbf532fd2021-05-07 13:58:22 +0530143# list of available spec version
144if("${SUITE}" STREQUAL "STORAGE" OR ${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE" OR ${SUITE} STREQUAL "PROTECTED_STORAGE")
145list(APPEND PSA_SPEC_VERSION
146 1.0-BETA2
147 1.0
148)
149elseif("${SUITE}" STREQUAL "CRYPTO")
150list(APPEND PSA_SPEC_VERSION
151 1.0-BETA1
152 1.0-BETA2
153 1.0-BETA3
154)
155elseif("${SUITE}" STREQUAL "INITIAL_ATTESTATION")
156list(APPEND PSA_SPEC_VERSION
157 1.0-BETA0
158 1.0.0
159 1.0.1
160 1.0.2
161)
jk-arm957cfea2021-06-18 15:52:12 +0530162elseif("${SUITE}" STREQUAL "IPC")
163list(APPEND PSA_SPEC_VERSION
164 1.0
165 1.1
166)
jk-arm957cfea2021-06-18 15:52:12 +0530167endif()
168
169#list of values available for connection based
170if(${SUITE} STREQUAL "IPC")
171list(APPEND PSA_STATELESS_ROT 0 1)
jk-armbf532fd2021-05-07 13:58:22 +0530172endif()
173
jk-arm01ee3ff2021-10-18 22:41:47 +0530174#list of TESTS_COVERAGE available options
175list(APPEND PSA_TESTS_COVERAGE_OPTIONS
176 "ALL"
177 "PASS"
178)
179
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530180message(STATUS "[PSA] : ----------Process input arguments- start-------------")
181
182# Check for TARGET command line argument
183_check_arguments("TARGET")
184# Check for SUTIE command line argument
185_check_arguments("SUITE")
186# Check for PSA_INCLUDE_PATHS command line argument
187_check_arguments("PSA_INCLUDE_PATHS")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530188
189string(TOLOWER ${SUITE} SUITE_LOWER)
190
191# Check for valid targets
192_get_sub_dir_list(PSA_TARGET_LIST ${PSA_ROOT_DIR}/platform/targets)
193if(NOT ${TARGET} IN_LIST PSA_TARGET_LIST)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100194 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DTARGET=${TARGET}, supported targets are : ${PSA_TARGET_LIST}")
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530195else()
196 message(STATUS "[PSA] : TARGET is set to ${TARGET}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530197endif()
198
199# Check for the presence of required test suite directories
200if((NOT IS_DIRECTORY ${PSA_ROOT_DIR}/dev_apis) OR (NOT IS_DIRECTORY ${PSA_ROOT_DIR}/ff))
201 message(STATUS "[PSA] : Error: Could not find architecture test suite directories in psa root path ${PSA_ROOT_DIR}")
202endif()
203
204if(FALSE)
205# Check for build directory specified
206if(NOT DEFINED BUILD)
207 set(BUILD ${CMAKE_CURRENT_BINARY_DIR}/BUILD CACHE INTERNAL "Defaulting build directory to ${BUILD}" FORCE)
208else()
209 set(BUILD ${CMAKE_CURRENT_BINARY_DIR}/${BUILD}/BUILD CACHE INTERNAL "Defaulting build directory to ${BUILD}" FORCE)
210endif()
211endif()
212
213# Check for valid suite cmake argument passed
214if(NOT ${SUITE} IN_LIST PSA_SUITES)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100215 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 +0530216else()
217 message(STATUS "[PSA] : SUITE is set to ${SUITE}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530218endif()
219
220# Project variables
221set(PSA_TARGET_PRE_BUILD psa_pre_build)
222set(PSA_TARGET_GENERATE_DATABASE_PRE psa_generate_database_prerequisite)
223set(PSA_TARGET_GENERATE_DATABASE psa_generate_database)
224set(PSA_TARGET_GENERATE_DATABASE_POST psa_generate_database_cleanup)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530225if(${SUITE} STREQUAL "INITIAL_ATTESTATION")
Gyorgy Szing42d62332022-02-08 17:50:04 +0000226 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 +0530227endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530228set(PSA_TARGET_PAL_NSPE_LIB pal_nspe)
229set(PSA_TARGET_VAL_NSPE_LIB val_nspe)
230set(PSA_TARGET_TEST_COMBINE_LIB test_combine)
jk-armbf532fd2021-05-07 13:58:22 +0530231set(PSA_TARGET_DRIVER_PARTITION_LIB tfm_psa_rot_partition_driver_partition)
232set(PSA_TARGET_CLIENT_PARTITION_LIB tfm_app_rot_partition_client_partition)
233set(PSA_TARGET_SERVER_PARTITION_LIB tfm_app_rot_partition_server_partition)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530234if(${SUITE} STREQUAL "IPC")
235 set(PSA_SUITE_DIR ${PSA_ROOT_DIR}/ff/${SUITE_LOWER})
236 set(PSA_SUITE_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/ff/${SUITE_LOWER})
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +0530237elseif((${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE") OR (${SUITE} STREQUAL "PROTECTED_STORAGE"))
238 set(PSA_SUITE_DIR ${PSA_ROOT_DIR}/dev_apis/storage)
239 set(PSA_SUITE_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/dev_apis/storage)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530240else()
241 set(PSA_SUITE_DIR ${PSA_ROOT_DIR}/dev_apis/${SUITE_LOWER})
242 set(PSA_SUITE_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/dev_apis/${SUITE_LOWER})
243endif()
244set(PSA_TARGET_CONFIG_HEADER_GENERATOR ${PSA_ROOT_DIR}/tools/scripts/target_cfg/targetConfigGen.py)
245set(PSA_TESTLIST_GENERATOR ${PSA_ROOT_DIR}/tools/scripts/gen_tests_list.py)
246set(TARGET_CONFIGURATION_FILE ${PSA_ROOT_DIR}/platform/targets/${TARGET}/target.cfg)
247set(TGT_CONFIG_SOURCE_C ${CMAKE_CURRENT_BINARY_DIR}/targetConfigGen.c)
248set(OUTPUT_HEADER target_database.h)
249set(DATABASE_TABLE_NAME target_database)
250set(DATABASE_TABLE_SECTION_NAME "NOSECTION")
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +0530251set(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 +0530252if(NOT DEFINED SPEC_VERSION)
253 if(${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE")
254 set(TESTSUITE_DB ${PSA_SUITE_DIR}/its_testsuite.db)
255 elseif((${SUITE} STREQUAL "PROTECTED_STORAGE") OR (${SUITE} STREQUAL "STORAGE"))
256 set(TESTSUITE_DB ${PSA_SUITE_DIR}/ps_testsuite.db)
257 else()
258 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
259 endif()
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +0530260else()
jk-armbf532fd2021-05-07 13:58:22 +0530261 if(${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE")
262 if(${SPEC_VERSION} STREQUAL "1.0-BETA2")
263 set(TESTSUITE_DB ${PSA_SUITE_DIR}/its_1.0-beta2_testsuite.db)
264 endif()
265 if(${SPEC_VERSION} STREQUAL "1.0")
266 set(TESTSUITE_DB ${PSA_SUITE_DIR}/its_1.0_testsuite.db)
267 endif()
268 elseif((${SUITE} STREQUAL "PROTECTED_STORAGE") OR (${SUITE} STREQUAL "STORAGE"))
269 if(${SPEC_VERSION} STREQUAL "1.0-BETA2")
270 set(TESTSUITE_DB ${PSA_SUITE_DIR}/ps_1.0-beta2_testsuite.db)
271 endif()
272 if(${SPEC_VERSION} STREQUAL "1.0")
273 set(TESTSUITE_DB ${PSA_SUITE_DIR}/ps_1.0_testsuite.db)
274 endif()
275 elseif(${SUITE} STREQUAL "CRYPTO")
276 if(${SPEC_VERSION} STREQUAL "1.0-BETA1")
277 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0-beta1_testsuite.db)
278 endif()
279 if(${SPEC_VERSION} STREQUAL "1.0-BETA2")
280 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0-beta2_testsuite.db)
281 endif()
282 if(${SPEC_VERSION} STREQUAL "1.0-BETA3")
283 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0-beta3_testsuite.db)
284 endif()
285 elseif(${SUITE} STREQUAL "INITIAL_ATTESTATION")
286 if(${SPEC_VERSION} STREQUAL "1.0-BETA0")
287 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0-beta0_testsuite.db)
288 endif()
289 if(${SPEC_VERSION} STREQUAL "1.0.0")
290 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0.0_testsuite.db)
291 endif()
292 if(${SPEC_VERSION} STREQUAL "1.0.1")
293 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0.1_testsuite.db)
294 endif()
295 if(${SPEC_VERSION} STREQUAL "1.0.2")
296 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0.2_testsuite.db)
297 endif()
jk-arm957cfea2021-06-18 15:52:12 +0530298 elseif(${SUITE} STREQUAL "IPC")
299 if(${SPEC_VERSION} STREQUAL "1.1")
300 if(DEFINED STATELESS_ROT_TESTS)
301 if(${STATELESS_ROT_TESTS} EQUAL 1)
302 set(TESTSUITE_DB ${PSA_SUITE_DIR}/stateless_rot_testsuite.db)
303 else()
304 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
305 endif()
306 else()
307 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
308 endif()
309 else()
310 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
311 endif()
312 endif()
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +0530313endif()
314set(PSA_TESTLIST_FILE ${CMAKE_CURRENT_BINARY_DIR}/${SUITE_LOWER}_testlist.txt)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530315set(PSA_TEST_ENTRY_LIST_INC ${CMAKE_CURRENT_BINARY_DIR}/test_entry_list.inc)
316set(PSA_TEST_ENTRY_FUN_DECLARE_INC ${CMAKE_CURRENT_BINARY_DIR}/test_entry_fn_declare_list.inc)
317set(PSA_CLIENT_TEST_LIST_DELCARE_INC ${CMAKE_CURRENT_BINARY_DIR}/client_tests_list_declare.inc)
318set(PSA_CLIENT_TEST_LIST_INC ${CMAKE_CURRENT_BINARY_DIR}/client_tests_list.inc)
319set(PSA_SERVER_TEST_LIST_DECLARE_INC ${CMAKE_CURRENT_BINARY_DIR}/server_tests_list_declare.inc)
320set(PSA_SERVER_TEST_LIST ${CMAKE_CURRENT_BINARY_DIR}/server_tests_list.inc)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530321if(${SUITE} STREQUAL "INITIAL_ATTESTATION")
Gyorgy Szing42d62332022-02-08 17:50:04 +0000322 set(PSA_QCBOR_INCLUDE_PATH ${PSA_TARGET_QCBOR}/inc)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530323endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530324
325# Validity check for required files for a given suite
326if(NOT DEFINED PSA_${SUITE}_FILES)
327 message(FATAL_ERROR "[PSA] : List of file/s to verify against ${suite} is not defined")
328endif()
329foreach(file_item ${PSA_${SUITE}_FILES})
330 set(PSA_FILE_FOUND FALSE)
331 foreach(include_path ${PSA_INCLUDE_PATHS})
332 if((EXISTS ${include_path}/${file_item}) AND
333 (NOT PSA_FILE_FOUND))
334 set(PSA_FILE_FOUND TRUE)
335 break()
336 endif()
337 endforeach()
338 if(NOT PSA_FILE_FOUND)
339 message(FATAL_ERROR "[PSA] : Couldn't find ${file_item} in ${PSA_INCLUDE_PATHS}")
340 endif()
341endforeach()
342
343# Check for TOOLCHAIN command line argument
344if(NOT DEFINED TOOLCHAIN)
345 set(TOOLCHAIN "GNUARM" CACHE INTERNAL "Compiler used" FORCE)
346 message(STATUS "[PSA] : Defaulting compiler to ${TOOLCHAIN}")
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530347else()
348 message(STATUS "[PSA] : TOOLCHAIN is set to ${TOOLCHAIN}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530349endif()
350
Gowtham Siddarth1d6d4692019-09-16 11:47:29 +0530351if(${TOOLCHAIN} STREQUAL "ARMCLANG" OR ${TOOLCHAIN} STREQUAL "GNUARM")
352 if(NOT DEFINED CPU_ARCH)
353 message(FATAL_ERROR "[PSA] : Error: -DCPU_ARCH option missing")
354 else()
355 # Check for CPU architecture
356 if(NOT ${CPU_ARCH} IN_LIST PSA_CPU_ARCH_SUPPORT)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100357 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 +0530358 endif()
359 endif()
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530360 message(STATUS "[PSA] : CPU_ARCH is set to ${CPU_ARCH}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530361endif()
362
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530363# Check for VERBOSE
364if(NOT DEFINED VERBOSE)
365 set(VERBOSE 3 CACHE INTERNAL "Default VERBOSE value" FORCE)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530366 message(STATUS "[PSA] : Defaulting VERBOSE to ${VERBOSE}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530367else()
368 if(NOT ${VERBOSE} IN_LIST PSA_VERBOSE_OPTIONS)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100369 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DVERBOSE=${VERBOSE}, supported values are : ${PSA_VERBOSE_OPTIONS}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530370 endif()
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530371 message(STATUS "[PSA] : VERBOSE is set to ${VERBOSE}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530372endif()
373
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530374# Check for PLATFORM_PSA_ISOLATION_LEVEL
375if(NOT DEFINED PLATFORM_PSA_ISOLATION_LEVEL)
jotman016d7dd4e2020-11-10 17:32:28 +0800376 if("${TFM_PROFILE}" STREQUAL "profile_medium")
377 set(PLATFORM_PSA_ISOLATION_LEVEL 2 CACHE INTERNAL "Default PLATFORM_PSA_ISOLATION_LEVEL value" FORCE)
378 else()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530379 set(PLATFORM_PSA_ISOLATION_LEVEL 3 CACHE INTERNAL "Default PLATFORM_PSA_ISOLATION_LEVEL value" FORCE)
jotman016d7dd4e2020-11-10 17:32:28 +0800380 endif()
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530381 if(${SUITE} STREQUAL "IPC")
382 message(STATUS "[PSA] : Defaulting PLATFORM_PSA_ISOLATION_LEVEL to ${PLATFORM_PSA_ISOLATION_LEVEL}")
383 endif()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530384else()
385 if(NOT ${PLATFORM_PSA_ISOLATION_LEVEL} IN_LIST PLATFORM_PSA_ISOLATION_LEVEL_OPTIONS)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100386 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 +0530387 endif()
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530388 if(${SUITE} STREQUAL "IPC")
389 message(STATUS "[PSA] : PLATFORM_PSA_ISOLATION_LEVEL is set to ${PLATFORM_PSA_ISOLATION_LEVEL}")
390 endif()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530391endif()
392
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530393if(NOT DEFINED INCLUDE_PANIC_TESTS)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530394 #By default panic tests are disabled
395 set(INCLUDE_PANIC_TESTS 0 CACHE INTERNAL "Default INCLUDE_PANIC_TESTS value" FORCE)
396 message(STATUS "[PSA] : Defaulting INCLUDE_PANIC_TESTS to ${INCLUDE_PANIC_TESTS}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530397else()
jk-arm01ee3ff2021-10-18 22:41:47 +0530398 if(NOT ${INCLUDE_PANIC_TESTS} IN_LIST PSA_INCLUDE_PANIC_TESTS_OPTIONS)
399 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DINCLUDE_PANIC_TESTS=${INCLUDE_PANIC_TESTS}, supported values are : ${PSA_INCLUDE_PANIC_TESTS_OPTIONS}")
400 endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530401 if(INCLUDE_PANIC_TESTS EQUAL 1)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530402 message(STATUS "[PSA] : "
403 "INCLUDE_PANIC_TESTS set to 1, therefore including PSA APIs panic tests into the regression,\n"
404 "\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 +0530405 endif()
406endif()
407
408if(NOT DEFINED WATCHDOG_AVAILABLE)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530409 #Assuming watchdog is available to program by test suite
410 set(WATCHDOG_AVAILABLE 1 CACHE INTERNAL "Default WATCHDOG_AVAILABLE value" FORCE)
411 message(STATUS "[PSA] : Defaulting WATCHDOG_AVAILABLE to ${WATCHDOG_AVAILABLE}")
412else()
413 message(STATUS "[PSA] : WATCHDOG_AVAILABLE is set to ${WATCHDOG_AVAILABLE}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530414endif()
415
416if((INCLUDE_PANIC_TESTS EQUAL 1) AND
417 (WATCHDOG_AVAILABLE EQUAL 0))
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530418 message(WARNING "[PSA]: "
419 "Note that to test PSA APIs panic conditions, test harness may require to access"
420 "the watchdog timer in oder to recover from panic and to be able to continue with"
421 "next test. Ignore this warning if system under test has capability to reset the"
422 "system when it encounters panic condition.")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530423endif()
424
425if(NOT DEFINED SP_HEAP_MEM_SUPP)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530426 #Are dynamic memory functions available to secure partition?
427 set(SP_HEAP_MEM_SUPP 1 CACHE INTERNAL "Default SP_HEAP_MEM_SUPP value" FORCE)
428 message(STATUS "[PSA] : Defaulting SP_HEAP_MEM_SUPP to ${SP_HEAP_MEM_SUPP}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530429endif()
430
Vinay Kumar Kotegowderac218992020-04-03 12:56:00 +0530431if(NOT DEFINED SUITE_TEST_RANGE)
432 set(SUITE_TEST_RANGE_MIN None)
433 set(SUITE_TEST_RANGE_MAX None)
434else()
435 list(LENGTH SUITE_TEST_RANGE SUITE_TEST_RANGE_LENGTH)
436 if(${SUITE_TEST_RANGE_LENGTH} GREATER "2")
437 message(FATAL_ERROR "[PSA] : -DSUITE_TEST_RANGE=<...> value error! accepts two "
438 " numbers in quotes separated with ';'")
439 endif()
440 if(${SUITE_TEST_RANGE_LENGTH} EQUAL "2")
441 list(GET SUITE_TEST_RANGE 0 SUITE_TEST_RANGE_MIN)
442 list(GET SUITE_TEST_RANGE 1 SUITE_TEST_RANGE_MAX)
443 message(STATUS "[PSA] : Testing (${SUITE_TEST_RANGE_MIN}, ${SUITE_TEST_RANGE_MAX}) of ${SUITE} suite")
444 endif()
445 if(${SUITE_TEST_RANGE_LENGTH} EQUAL "1")
446 set(SUITE_TEST_RANGE_MIN ${SUITE_TEST_RANGE})
447 set(SUITE_TEST_RANGE_MAX ${SUITE_TEST_RANGE})
448 message(STATUS "[PSA] : Testing ${SUITE_TEST_RANGE_MIN} of ${SUITE} suite")
449 endif()
450endif()
451
jk-armbf532fd2021-05-07 13:58:22 +0530452if(NOT DEFINED SPEC_VERSION)
453 message(STATUS "[PSA] : Default spec version")
454else()
455 if(NOT ${SPEC_VERSION} IN_LIST PSA_SPEC_VERSION)
456 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DSPEC_VERSION=${SPEC_VERSION}, supported values are : ${PSA_SPEC_VERSION} for ${SUITE}")
457 else()
458 message(STATUS "[PSA] : Testing ${SUITE} for spec version ${SPEC_VERSION}")
459 endif()
460endif()
461
jk-arm957cfea2021-06-18 15:52:12 +0530462if(DEFINED STATELESS_ROT_TESTS)
463 if(NOT ${STATELESS_ROT_TESTS} IN_LIST PSA_STATELESS_ROT)
464 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DSTATELESS_ROT_TESTS=${STATELESS_ROT_TESTS}, supported values are : ${PSA_STATELESS_ROT}")
465 elseif(${STATELESS_ROT_TESTS} EQUAL 1)
466 message(STATUS "[PSA] : Testing ${SUITE} for stateless rot")
467 elseif(${STATELESS_ROT_TESTS} EQUAL 0)
468 message(STATUS "[PSA] : Testing ${SUITE} for connection based")
469 endif()
470
471 if(NOT DEFINED SPEC_VERSION)
472 message(FATAL_ERROR "[PSA] : Error: SPEC_VERSION is require for STATELESS_ROT_TESTS.")
473 elseif(${SUITE} STREQUAL "IPC")
474 if(${SPEC_VERSION} STREQUAL "1.0")
475 message(FATAL_ERROR "[PSA] : Error: STATELESS_ROT_TESTS is only valid for SPEC_VERSION=1.1.")
476 elseif(${SPEC_VERSION} STREQUAL "1.1")
477 add_definitions(-DSPEC_VERSION=11)
478 if(${STATELESS_ROT_TESTS} EQUAL 1)
479 add_definitions(-DSTATELESS_ROT=1)
480 elseif(${STATELESS_ROT_TESTS} EQUAL 0)
481 add_definitions(-DSTATELESS_ROT=0)
482 endif()
483 endif()
484 else()
485 message(FATAL_ERROR "[PSA] : Error: STATELESS_ROT_TESTS is only applicable to IPC Test Suite.")
486 endif()
487else()
488 add_definitions(-DSTATELESS_ROT=0)
489 if(DEFINED SPEC_VERSION)
490 if(${SUITE} STREQUAL "IPC")
491 if(${SPEC_VERSION} STREQUAL "1.0")
492 add_definitions(-DSPEC_VERSION=10)
493 endif()
494 if(${SPEC_VERSION} STREQUAL "1.1")
495 add_definitions(-DSPEC_VERSION=11)
496 endif()
497 endif()
498 endif()
499endif()
500
jk-arm01ee3ff2021-10-18 22:41:47 +0530501if(NOT DEFINED TESTS_COVERAGE)
502 #By default all tests are included
503 set(TESTS_COVERAGE "ALL" CACHE INTERNAL "Default TESTS_COVERAGE value" FORCE)
504 message(STATUS "[PSA] : Defaulting TESTS_COVERAGE to ${TESTS_COVERAGE}")
505else()
506 if(NOT ${TESTS_COVERAGE} IN_LIST PSA_TESTS_COVERAGE_OPTIONS)
507 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DTESTS_COVERAGE=${TESTS_COVERAGE}, supported values are : ${PSA_TESTS_COVERAGE_OPTIONS}")
508 endif()
509 if(TESTS_COVERAGE STREQUAL ALL)
510 message(STATUS "[PSA] : "
511 "TESTS_COVERAGE set to ALL, therefore all tests are included.")
512 endif()
513 if(TESTS_COVERAGE STREQUAL PASS)
514 message(STATUS "[PSA] : "
515 "TESTS_COVERAGE set to PASS, therefore known failure tests are not included.")
516 add_definitions(-DTESTS_COVERAGE)
517 endif()
518endif()
519
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530520message(STATUS "[PSA] : ----------Process input arguments- complete-------------")
521
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530522
Gyorgy Szing42d62332022-02-08 17:50:04 +0000523if((${SUITE} STREQUAL "INITIAL_ATTESTATION") AND (NOT EXISTS ${PSA_TARGET_QCBOR}))
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530524# Clone QCBOR and move to specified tag
525execute_process(COMMAND ${GIT_EXECUTABLE} clone ${PSA_QCBOR_GIT_REPO_LINK} ${PSA_TARGET_QCBOR}
Gyorgy Szing42d62332022-02-08 17:50:04 +0000526 RESULT_VARIABLE qcbor_clone_result
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530527 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
Gyorgy Szing42d62332022-02-08 17:50:04 +0000528if(qcbor_clone_result)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530529 message(FATAL_ERROR "git clone failed for ${PSA_QCBOR_GIT_REPO_LINK}")
530endif()
531
Gyorgy Szing42d62332022-02-08 17:50:04 +0000532if(NOT qcbor_clone_result)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530533execute_process(COMMAND ${GIT_EXECUTABLE} checkout -q "${PSA_QCBOR_GIT_REPO_TAG}"
Gyorgy Szing42d62332022-02-08 17:50:04 +0000534 RESULT_VARIABLE qcbor_checkout_result
535 WORKING_DIRECTORY ${PSA_TARGET_QCBOR})
536if(qcbor_checkout_result)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530537 message(FATAL_ERROR "git checkout failed for Repo : ${PSA_QCBOR_GIT_REPO_LINK}, Tag : ${PSA_QCBOR_GIT_REPO_TAG}")
538endif()
539endif()
540endif()
gowtham siddarth12833042020-02-10 22:11:11 +0530541
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530542# Create PSA clean list
543list(APPEND PSA_CLEAN_LIST
544 ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_HEADER}
545 ${PSA_TESTLIST_FILE}
546 ${PSA_TEST_ENTRY_LIST_INC}
547 ${PSA_TEST_ENTRY_FUN_DECLARE_INC}
548 ${PSA_CLIENT_TEST_LIST_DELCARE_INC}
549 ${PSA_CLIENT_TEST_LIST_INC}
550 ${PSA_SERVER_TEST_LIST_DECLARE_INC}
551 ${PSA_SERVER_TEST_LIST}
552)
553
554# Process testsuite.db
555message(STATUS "[PSA] : Creating testlist.txt 'available at ${PSA_TESTLIST_FILE}'")
556execute_process(COMMAND ${PYTHON_EXECUTABLE} ${PSA_TESTLIST_GENERATOR}
557 ${SUITE_LOWER}
558 ${TESTSUITE_DB}
559 ${INCLUDE_PANIC_TESTS}
jk-arm01ee3ff2021-10-18 22:41:47 +0530560 ${TESTS_COVERAGE}
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530561 ${PSA_TESTLIST_FILE}
562 ${PSA_TEST_ENTRY_LIST_INC}
563 ${PSA_TEST_ENTRY_FUN_DECLARE_INC}
564 ${PSA_CLIENT_TEST_LIST_DELCARE_INC}
565 ${PSA_CLIENT_TEST_LIST_INC}
566 ${PSA_SERVER_TEST_LIST_DECLARE_INC}
Vinay Kumar Kotegowderac218992020-04-03 12:56:00 +0530567 ${PSA_SERVER_TEST_LIST}
568 ${SUITE_TEST_RANGE_MIN}
569 ${SUITE_TEST_RANGE_MAX})
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530570
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530571# Creating CMake list variable from file
572file(READ ${PSA_TESTLIST_FILE} PSA_TEST_LIST)
Vinay Kumar Kotegowderac218992020-04-03 12:56:00 +0530573if(NOT PSA_TEST_LIST)
574 message(FATAL_ERROR "[PSA] : Invalid test number!")
575endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530576string(REGEX REPLACE "\n" ";" PSA_TEST_LIST "${PSA_TEST_LIST}")
577
578add_custom_target(
579 ${PSA_TARGET_GENERATE_DATABASE_PRE}
580 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/platform
581 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/val
582 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/partition
583 COMMAND ${CMAKE_COMMAND} -E make_directory ${PSA_SUITE_OUT_DIR}
584)
585
586# Generate target files from User provided data base
587include(ExternalProject)
588ExternalProject_Add(
589 ${PSA_TARGET_GENERATE_DATABASE}
590 PREFIX ${CMAKE_CURRENT_BINARY_DIR}
591 DOWNLOAD_COMMAND ""
592 UPDATE_COMMAND ""
593 PATCH_COMMAND ""
594 BUILD_COMMAND ""
595 SOURCE_DIR "${PSA_ROOT_DIR}/tools/scripts/target_cfg"
596 CMAKE_ARGS -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
597 -DOUT_DIR=${CMAKE_CURRENT_BINARY_DIR}
598 -DTARGET=${TARGET}
599 -DGENERATOR_FILE=${PSA_TARGET_CONFIG_HEADER_GENERATOR}
600 -DINCLUDE_DIR=${PSA_ROOT_DIR}/val/common
601 -DTARGET_CONFIGURATION_FILE=${TARGET_CONFIGURATION_FILE}
602 -DTGT_CONFIG_SOURCE_C=${TGT_CONFIG_SOURCE_C}
603 -DOUTPUT_HEADER=${OUTPUT_HEADER}
604 -DDATABASE_TABLE_NAME=${DATABASE_TABLE_NAME}
605 -DDATABASE_TABLE_SECTION_NAME=${DATABASE_TABLE_SECTION_NAME}
606 -DTARGET_HEADER_GEN_INCLUDE_PATHS=${TARGET_HEADER_GEN_INCLUDE_PATHS}
607 LIST_SEPARATOR |
608 TEST_COMMAND ""
609)
610
611# Add custom target to clean generated files of the external project
612add_custom_target(
613 ${PSA_TARGET_GENERATE_DATABASE_POST}
614 COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/src/${PSA_TARGET_GENERATE_DATABASE}-build/ -- clean
615)
616
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530617# Check for supported toolchain/s
618if(${TOOLCHAIN} IN_LIST PSA_TOOLCHAIN_SUPPORT)
jk-armbf532fd2021-05-07 13:58:22 +0530619 if (DEFINED CROSS_COMPILE)
jk-arm7e6145a2021-07-19 19:36:14 +0530620 if(NOT (${TOOLCHAIN} IN_LIST CROSS_COMPILE_TOOLCHAIN_SUPPORT))
621 message(FATAL_ERROR "[PSA] : Error: CROSS_COMPILE not supported for this toolchain, supported toolchain are : ${CROSS_COMPILE_TOOLCHAIN_SUPPORT}")
622 endif()
jk-armbf532fd2021-05-07 13:58:22 +0530623 endif()
jk-arm7e6145a2021-07-19 19:36:14 +0530624 include(${PSA_ROOT_DIR}/tools/cmake/compiler/${TOOLCHAIN}.cmake)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530625else()
jk-arm7e6145a2021-07-19 19:36:14 +0530626 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DTOOLCHAIN=${TOOLCHAIN}, supported toolchain are : ${PSA_TOOLCHAIN_SUPPORT}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530627endif()
628
629# Global macro to identify the PSA test suite cmake build
630add_definitions(-DPSA_CMAKE_BUILD)
631add_definitions(-D${SUITE})
632add_definitions(-DVERBOSE=${VERBOSE})
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530633add_definitions(-DPLATFORM_PSA_ISOLATION_LEVEL=${PLATFORM_PSA_ISOLATION_LEVEL})
Vinay Kumar Kotegowder52bbfc92020-07-03 17:23:59 +0530634add_definitions(-D${TARGET})
jotman016d7dd4e2020-11-10 17:32:28 +0800635if("${TFM_PROFILE}" STREQUAL "profile_small")
636 message(STATUS "[PSA] : Building SMALL profile")
637 add_definitions(-DTF_M_PROFILE_SMALL)
638elseif("${TFM_PROFILE}" STREQUAL "profile_medium")
639 message(STATUS "[PSA] : Building MEDIUM profile")
640 add_definitions(-DTF_M_PROFILE_MEDIUM)
641endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530642if(${SP_HEAP_MEM_SUPP} EQUAL 1)
643 add_definitions(-DSP_HEAP_MEM_SUPP)
644endif()
jotman0138cb53a2023-02-14 16:27:06 +0800645
Summer Qin937a1ed2022-07-13 10:29:26 +0800646if(${CC312_LEGACY_DRIVER_API_ENABLED})
647 add_definitions(-DCC312_LEGACY_DRIVER_API_ENABLED)
648endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530649
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530650# Build PAL NSPE LIB
Bruno De Smet593db412023-03-15 18:47:19 +0100651include(${PSA_ROOT_DIR}/platform/targets/common/nspe/pal_nspe.cmake)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530652include(${PSA_ROOT_DIR}/platform/targets/${TARGET}/target.cmake)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530653# Build VAL NSPE LIB
654#add_definitions(-DVAL_NSPE_BUILD)
655include(${PSA_ROOT_DIR}/val/val_nspe.cmake)
656# Build test
657include(${PSA_SUITE_DIR}/suite.cmake)
658if(${SUITE} STREQUAL "IPC")
659# Build SPE LIB
660include(${PSA_ROOT_DIR}/val/val_spe.cmake)
661endif()
662
663add_dependencies(${PSA_TARGET_GENERATE_DATABASE} ${PSA_TARGET_GENERATE_DATABASE_PRE})
664add_dependencies(${PSA_TARGET_GENERATE_DATABASE_POST} ${PSA_TARGET_GENERATE_DATABASE})
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530665add_dependencies(${PSA_TARGET_PAL_NSPE_LIB} ${PSA_TARGET_GENERATE_DATABASE_POST})
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530666add_dependencies(${PSA_TARGET_VAL_NSPE_LIB} ${PSA_TARGET_PAL_NSPE_LIB})
667add_dependencies(${PSA_TARGET_TEST_COMBINE_LIB} ${PSA_TARGET_VAL_NSPE_LIB})
668if(${SUITE} STREQUAL "IPC")
669add_dependencies(${PSA_TARGET_DRIVER_PARTITION_LIB} ${PSA_TARGET_TEST_COMBINE_LIB})
670add_dependencies(${PSA_TARGET_CLIENT_PARTITION_LIB} ${PSA_TARGET_DRIVER_PARTITION_LIB})
671add_dependencies(${PSA_TARGET_SERVER_PARTITION_LIB} ${PSA_TARGET_CLIENT_PARTITION_LIB})
672endif()
673
674# Include the files for make clean
675foreach(clean_item ${PSA_CLEAN_LIST})
676 set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${clean_item})
677endforeach()
678
679set_property(TARGET ${PSA_TARGET_VAL_NSPE_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/val)
680set_property(TARGET ${PSA_TARGET_PAL_NSPE_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/platform)
681set_property(TARGET ${PSA_TARGET_TEST_COMBINE_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${PSA_SUITE_OUT_DIR})
682if(${SUITE} STREQUAL "IPC")
683set_property(TARGET ${PSA_TARGET_DRIVER_PARTITION_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/partition)
684set_property(TARGET ${PSA_TARGET_CLIENT_PARTITION_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/partition)
685set_property(TARGET ${PSA_TARGET_SERVER_PARTITION_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/partition)
686endif()