blob: 8c37460c10ed4632b7e7653620fca54c1f8b9b22 [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.
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +05303# * 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# Set the minimum required version of CMake for the project
19cmake_minimum_required(VERSION 3.10)
20
21# cmake_policy
22cmake_policy(SET CMP0057 NEW)
23
24# Find python interpreter version 3 or greater
25find_package(PythonInterp 3 REQUIRED)
26# Find Git package
27find_package(Git REQUIRED)
28
29get_filename_component(PSA_ROOT_DIR . ABSOLUTE)
30
Lingkai Dong9d4e7df2021-01-13 16:57:54 +000031include(${PSA_ROOT_DIR}/tools/cmake/common/Utils.cmake)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053032include(${PSA_ROOT_DIR}/tools/cmake/common/CMakeSettings.cmake)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +053033include(${PSA_ROOT_DIR}/tools/cmake/common/CMakeExternal.cmake)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053034
jotman016d7dd4e2020-11-10 17:32:28 +080035if(NOT DEFINED TFM_PROFILE)
36 message(STATUS "[PSA] : Building Default profile")
37list(APPEND PSA_SUITES
38 "IPC"
39 "CRYPTO"
40 "INTERNAL_TRUSTED_STORAGE"
41 "PROTECTED_STORAGE"
42 "STORAGE"
43 "INITIAL_ATTESTATION"
44)
45else()
46
47if("${TFM_PROFILE}" STREQUAL "profile_small")
48# list of supported suites
49list(APPEND PSA_SUITES
50 "CRYPTO"
51 "INTERNAL_TRUSTED_STORAGE"
52 "INITIAL_ATTESTATION"
53)
54else()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053055# list of supported suites
56list(APPEND PSA_SUITES
57 "IPC"
58 "CRYPTO"
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053059 "INTERNAL_TRUSTED_STORAGE"
jotman016d7dd4e2020-11-10 17:32:28 +080060 "PROTECTED_STORAGE"
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +053061 "STORAGE"
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053062 "INITIAL_ATTESTATION"
63)
jotman016d7dd4e2020-11-10 17:32:28 +080064endif()
65endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053066# list of ipc files required
67list(APPEND PSA_IPC_FILES
68 "psa/client.h"
69 "psa/service.h"
Jaykumar Pitambarbhai Patel1c2b0282019-11-06 11:29:13 +053070 "psa/lifecycle.h"
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053071 "psa_manifest/sid.h"
72 "psa_manifest/pid.h"
Jaykumar Pitambarbhai Patel1c2b0282019-11-06 11:29:13 +053073 "psa_manifest/driver_partition_psa.h"
74 "psa_manifest/client_partition_psa.h"
75 "psa_manifest/server_partition_psa.h"
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053076)
77
78# list of crypto files required
79list(APPEND PSA_CRYPTO_FILES
80 "psa/crypto.h"
81)
82
83# list of protected_storage files required
84list(APPEND PSA_PROTECTED_STORAGE_FILES
85 "psa/protected_storage.h"
86)
87
88# list of internal_trusted_storage files required
89list(APPEND PSA_INTERNAL_TRUSTED_STORAGE_FILES
90 "psa/internal_trusted_storage.h"
91)
92
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +053093# list of storage files required
94list(APPEND PSA_STORAGE_FILES
95 ${PSA_INTERNAL_TRUSTED_STORAGE_FILES}
96 ${PSA_PROTECTED_STORAGE_FILES}
97)
98
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +053099# list of initial_attestation files required
100list(APPEND PSA_INITIAL_ATTESTATION_FILES
101 "psa/initial_attestation.h"
102 "psa/crypto.h"
103)
104
105# list of supported toolchains
106list(APPEND PSA_TOOLCHAIN_SUPPORT
107 GNUARM
108 ARMCLANG
109 HOST_GCC
jk-arm7e6145a2021-07-19 19:36:14 +0530110 GCC_LINUX
111 INHERIT
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530112)
113
Øyvind Rønningstadc50804e2021-03-12 12:43:25 +0100114# list of supported CROSS_COMPILE toolchains
115list(APPEND CROSS_COMPILE_TOOLCHAIN_SUPPORT
116 GNUARM
jk-arm7e6145a2021-07-19 19:36:14 +0530117 ARMCLANG
118 INHERIT
Øyvind Rønningstadc50804e2021-03-12 12:43:25 +0100119)
120
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530121# list of suported CPU arch
122list(APPEND PSA_CPU_ARCH_SUPPORT
123 armv8m_ml
124 armv8m_bl
125 armv7m
jotman01bed7a152021-05-25 22:57:17 +0800126 armv8a
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530127)
128
129# list of VERBOSE options
130list(APPEND PSA_VERBOSE_OPTIONS 1 2 3 4 5)
131
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530132# list of PLATFORM_PSA_ISOLATION_LEVEL options
jotman016d7dd4e2020-11-10 17:32:28 +0800133if("${TFM_PROFILE}" STREQUAL "profile_medium")
134list(APPEND PLATFORM_PSA_ISOLATION_LEVEL_OPTIONS 1 2)
135else()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530136list(APPEND PLATFORM_PSA_ISOLATION_LEVEL_OPTIONS 1 2 3)
jotman016d7dd4e2020-11-10 17:32:28 +0800137endif()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530138
jk-arm01ee3ff2021-10-18 22:41:47 +0530139#list of INCLUDE_PANIC_TESTS options
140list(APPEND PSA_INCLUDE_PANIC_TESTS_OPTIONS 0 1)
141
jk-armbf532fd2021-05-07 13:58:22 +0530142# list of available spec version
143if("${SUITE}" STREQUAL "STORAGE" OR ${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE" OR ${SUITE} STREQUAL "PROTECTED_STORAGE")
144list(APPEND PSA_SPEC_VERSION
145 1.0-BETA2
146 1.0
147)
148elseif("${SUITE}" STREQUAL "CRYPTO")
149list(APPEND PSA_SPEC_VERSION
150 1.0-BETA1
151 1.0-BETA2
152 1.0-BETA3
153)
154elseif("${SUITE}" STREQUAL "INITIAL_ATTESTATION")
155list(APPEND PSA_SPEC_VERSION
156 1.0-BETA0
157 1.0.0
158 1.0.1
159 1.0.2
160)
jk-arm957cfea2021-06-18 15:52:12 +0530161elseif("${SUITE}" STREQUAL "IPC")
162list(APPEND PSA_SPEC_VERSION
163 1.0
164 1.1
165)
jk-arm957cfea2021-06-18 15:52:12 +0530166endif()
167
168#list of values available for connection based
169if(${SUITE} STREQUAL "IPC")
170list(APPEND PSA_STATELESS_ROT 0 1)
jk-armbf532fd2021-05-07 13:58:22 +0530171endif()
172
jk-arm01ee3ff2021-10-18 22:41:47 +0530173#list of TESTS_COVERAGE available options
174list(APPEND PSA_TESTS_COVERAGE_OPTIONS
175 "ALL"
176 "PASS"
177)
178
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530179message(STATUS "[PSA] : ----------Process input arguments- start-------------")
180
181# Check for TARGET command line argument
182_check_arguments("TARGET")
183# Check for SUTIE command line argument
184_check_arguments("SUITE")
185# Check for PSA_INCLUDE_PATHS command line argument
186_check_arguments("PSA_INCLUDE_PATHS")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530187
188string(TOLOWER ${SUITE} SUITE_LOWER)
189
190# Check for valid targets
191_get_sub_dir_list(PSA_TARGET_LIST ${PSA_ROOT_DIR}/platform/targets)
192if(NOT ${TARGET} IN_LIST PSA_TARGET_LIST)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100193 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DTARGET=${TARGET}, supported targets are : ${PSA_TARGET_LIST}")
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530194else()
195 message(STATUS "[PSA] : TARGET is set to ${TARGET}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530196endif()
197
198# Check for the presence of required test suite directories
199if((NOT IS_DIRECTORY ${PSA_ROOT_DIR}/dev_apis) OR (NOT IS_DIRECTORY ${PSA_ROOT_DIR}/ff))
200 message(STATUS "[PSA] : Error: Could not find architecture test suite directories in psa root path ${PSA_ROOT_DIR}")
201endif()
202
203if(FALSE)
204# Check for build directory specified
205if(NOT DEFINED BUILD)
206 set(BUILD ${CMAKE_CURRENT_BINARY_DIR}/BUILD CACHE INTERNAL "Defaulting build directory to ${BUILD}" FORCE)
207else()
208 set(BUILD ${CMAKE_CURRENT_BINARY_DIR}/${BUILD}/BUILD CACHE INTERNAL "Defaulting build directory to ${BUILD}" FORCE)
209endif()
210endif()
211
212# Check for valid suite cmake argument passed
213if(NOT ${SUITE} IN_LIST PSA_SUITES)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100214 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 +0530215else()
216 message(STATUS "[PSA] : SUITE is set to ${SUITE}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530217endif()
218
219# Project variables
220set(PSA_TARGET_PRE_BUILD psa_pre_build)
221set(PSA_TARGET_GENERATE_DATABASE_PRE psa_generate_database_prerequisite)
222set(PSA_TARGET_GENERATE_DATABASE psa_generate_database)
223set(PSA_TARGET_GENERATE_DATABASE_POST psa_generate_database_cleanup)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530224if(${SUITE} STREQUAL "INITIAL_ATTESTATION")
Gyorgy Szing42d62332022-02-08 17:50:04 +0000225 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 +0530226endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530227set(PSA_TARGET_PAL_NSPE_LIB pal_nspe)
228set(PSA_TARGET_VAL_NSPE_LIB val_nspe)
229set(PSA_TARGET_TEST_COMBINE_LIB test_combine)
jk-armbf532fd2021-05-07 13:58:22 +0530230set(PSA_TARGET_DRIVER_PARTITION_LIB tfm_psa_rot_partition_driver_partition)
231set(PSA_TARGET_CLIENT_PARTITION_LIB tfm_app_rot_partition_client_partition)
232set(PSA_TARGET_SERVER_PARTITION_LIB tfm_app_rot_partition_server_partition)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530233if(${SUITE} STREQUAL "IPC")
234 set(PSA_SUITE_DIR ${PSA_ROOT_DIR}/ff/${SUITE_LOWER})
235 set(PSA_SUITE_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/ff/${SUITE_LOWER})
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +0530236elseif((${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE") OR (${SUITE} STREQUAL "PROTECTED_STORAGE"))
237 set(PSA_SUITE_DIR ${PSA_ROOT_DIR}/dev_apis/storage)
238 set(PSA_SUITE_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/dev_apis/storage)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530239else()
240 set(PSA_SUITE_DIR ${PSA_ROOT_DIR}/dev_apis/${SUITE_LOWER})
241 set(PSA_SUITE_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/dev_apis/${SUITE_LOWER})
242endif()
243set(PSA_TARGET_CONFIG_HEADER_GENERATOR ${PSA_ROOT_DIR}/tools/scripts/target_cfg/targetConfigGen.py)
244set(PSA_TESTLIST_GENERATOR ${PSA_ROOT_DIR}/tools/scripts/gen_tests_list.py)
245set(TARGET_CONFIGURATION_FILE ${PSA_ROOT_DIR}/platform/targets/${TARGET}/target.cfg)
246set(TGT_CONFIG_SOURCE_C ${CMAKE_CURRENT_BINARY_DIR}/targetConfigGen.c)
247set(OUTPUT_HEADER target_database.h)
248set(DATABASE_TABLE_NAME target_database)
249set(DATABASE_TABLE_SECTION_NAME "NOSECTION")
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +0530250set(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 +0530251if(NOT DEFINED SPEC_VERSION)
252 if(${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE")
253 set(TESTSUITE_DB ${PSA_SUITE_DIR}/its_testsuite.db)
254 elseif((${SUITE} STREQUAL "PROTECTED_STORAGE") OR (${SUITE} STREQUAL "STORAGE"))
255 set(TESTSUITE_DB ${PSA_SUITE_DIR}/ps_testsuite.db)
256 else()
257 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
258 endif()
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +0530259else()
jk-armbf532fd2021-05-07 13:58:22 +0530260 if(${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE")
261 if(${SPEC_VERSION} STREQUAL "1.0-BETA2")
262 set(TESTSUITE_DB ${PSA_SUITE_DIR}/its_1.0-beta2_testsuite.db)
263 endif()
264 if(${SPEC_VERSION} STREQUAL "1.0")
265 set(TESTSUITE_DB ${PSA_SUITE_DIR}/its_1.0_testsuite.db)
266 endif()
267 elseif((${SUITE} STREQUAL "PROTECTED_STORAGE") OR (${SUITE} STREQUAL "STORAGE"))
268 if(${SPEC_VERSION} STREQUAL "1.0-BETA2")
269 set(TESTSUITE_DB ${PSA_SUITE_DIR}/ps_1.0-beta2_testsuite.db)
270 endif()
271 if(${SPEC_VERSION} STREQUAL "1.0")
272 set(TESTSUITE_DB ${PSA_SUITE_DIR}/ps_1.0_testsuite.db)
273 endif()
274 elseif(${SUITE} STREQUAL "CRYPTO")
275 if(${SPEC_VERSION} STREQUAL "1.0-BETA1")
276 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0-beta1_testsuite.db)
277 endif()
278 if(${SPEC_VERSION} STREQUAL "1.0-BETA2")
279 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0-beta2_testsuite.db)
280 endif()
281 if(${SPEC_VERSION} STREQUAL "1.0-BETA3")
282 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0-beta3_testsuite.db)
283 endif()
284 elseif(${SUITE} STREQUAL "INITIAL_ATTESTATION")
285 if(${SPEC_VERSION} STREQUAL "1.0-BETA0")
286 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0-beta0_testsuite.db)
287 endif()
288 if(${SPEC_VERSION} STREQUAL "1.0.0")
289 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0.0_testsuite.db)
290 endif()
291 if(${SPEC_VERSION} STREQUAL "1.0.1")
292 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0.1_testsuite.db)
293 endif()
294 if(${SPEC_VERSION} STREQUAL "1.0.2")
295 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0.2_testsuite.db)
296 endif()
jk-arm957cfea2021-06-18 15:52:12 +0530297 elseif(${SUITE} STREQUAL "IPC")
298 if(${SPEC_VERSION} STREQUAL "1.1")
299 if(DEFINED STATELESS_ROT_TESTS)
300 if(${STATELESS_ROT_TESTS} EQUAL 1)
301 set(TESTSUITE_DB ${PSA_SUITE_DIR}/stateless_rot_testsuite.db)
302 else()
303 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
304 endif()
305 else()
306 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
307 endif()
308 else()
309 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
310 endif()
311 endif()
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +0530312endif()
313set(PSA_TESTLIST_FILE ${CMAKE_CURRENT_BINARY_DIR}/${SUITE_LOWER}_testlist.txt)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530314set(PSA_TEST_ENTRY_LIST_INC ${CMAKE_CURRENT_BINARY_DIR}/test_entry_list.inc)
315set(PSA_TEST_ENTRY_FUN_DECLARE_INC ${CMAKE_CURRENT_BINARY_DIR}/test_entry_fn_declare_list.inc)
316set(PSA_CLIENT_TEST_LIST_DELCARE_INC ${CMAKE_CURRENT_BINARY_DIR}/client_tests_list_declare.inc)
317set(PSA_CLIENT_TEST_LIST_INC ${CMAKE_CURRENT_BINARY_DIR}/client_tests_list.inc)
318set(PSA_SERVER_TEST_LIST_DECLARE_INC ${CMAKE_CURRENT_BINARY_DIR}/server_tests_list_declare.inc)
319set(PSA_SERVER_TEST_LIST ${CMAKE_CURRENT_BINARY_DIR}/server_tests_list.inc)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530320if(${SUITE} STREQUAL "INITIAL_ATTESTATION")
Gyorgy Szing42d62332022-02-08 17:50:04 +0000321 set(PSA_QCBOR_INCLUDE_PATH ${PSA_TARGET_QCBOR}/inc)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530322endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530323
324# Validity check for required files for a given suite
325if(NOT DEFINED PSA_${SUITE}_FILES)
326 message(FATAL_ERROR "[PSA] : List of file/s to verify against ${suite} is not defined")
327endif()
328foreach(file_item ${PSA_${SUITE}_FILES})
329 set(PSA_FILE_FOUND FALSE)
330 foreach(include_path ${PSA_INCLUDE_PATHS})
331 if((EXISTS ${include_path}/${file_item}) AND
332 (NOT PSA_FILE_FOUND))
333 set(PSA_FILE_FOUND TRUE)
334 break()
335 endif()
336 endforeach()
337 if(NOT PSA_FILE_FOUND)
338 message(FATAL_ERROR "[PSA] : Couldn't find ${file_item} in ${PSA_INCLUDE_PATHS}")
339 endif()
340endforeach()
341
342# Check for TOOLCHAIN command line argument
343if(NOT DEFINED TOOLCHAIN)
344 set(TOOLCHAIN "GNUARM" CACHE INTERNAL "Compiler used" FORCE)
345 message(STATUS "[PSA] : Defaulting compiler to ${TOOLCHAIN}")
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530346else()
347 message(STATUS "[PSA] : TOOLCHAIN is set to ${TOOLCHAIN}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530348endif()
349
Gowtham Siddarth1d6d4692019-09-16 11:47:29 +0530350if(${TOOLCHAIN} STREQUAL "ARMCLANG" OR ${TOOLCHAIN} STREQUAL "GNUARM")
351 if(NOT DEFINED CPU_ARCH)
352 message(FATAL_ERROR "[PSA] : Error: -DCPU_ARCH option missing")
353 else()
354 # Check for CPU architecture
355 if(NOT ${CPU_ARCH} IN_LIST PSA_CPU_ARCH_SUPPORT)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100356 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 +0530357 endif()
358 endif()
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530359 message(STATUS "[PSA] : CPU_ARCH is set to ${CPU_ARCH}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530360endif()
361
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530362# Check for VERBOSE
363if(NOT DEFINED VERBOSE)
364 set(VERBOSE 3 CACHE INTERNAL "Default VERBOSE value" FORCE)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530365 message(STATUS "[PSA] : Defaulting VERBOSE to ${VERBOSE}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530366else()
367 if(NOT ${VERBOSE} IN_LIST PSA_VERBOSE_OPTIONS)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100368 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DVERBOSE=${VERBOSE}, supported values are : ${PSA_VERBOSE_OPTIONS}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530369 endif()
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530370 message(STATUS "[PSA] : VERBOSE is set to ${VERBOSE}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530371endif()
372
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530373# Check for PLATFORM_PSA_ISOLATION_LEVEL
374if(NOT DEFINED PLATFORM_PSA_ISOLATION_LEVEL)
jotman016d7dd4e2020-11-10 17:32:28 +0800375 if("${TFM_PROFILE}" STREQUAL "profile_medium")
376 set(PLATFORM_PSA_ISOLATION_LEVEL 2 CACHE INTERNAL "Default PLATFORM_PSA_ISOLATION_LEVEL value" FORCE)
377 else()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530378 set(PLATFORM_PSA_ISOLATION_LEVEL 3 CACHE INTERNAL "Default PLATFORM_PSA_ISOLATION_LEVEL value" FORCE)
jotman016d7dd4e2020-11-10 17:32:28 +0800379 endif()
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530380 if(${SUITE} STREQUAL "IPC")
381 message(STATUS "[PSA] : Defaulting PLATFORM_PSA_ISOLATION_LEVEL to ${PLATFORM_PSA_ISOLATION_LEVEL}")
382 endif()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530383else()
384 if(NOT ${PLATFORM_PSA_ISOLATION_LEVEL} IN_LIST PLATFORM_PSA_ISOLATION_LEVEL_OPTIONS)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100385 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 +0530386 endif()
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530387 if(${SUITE} STREQUAL "IPC")
388 message(STATUS "[PSA] : PLATFORM_PSA_ISOLATION_LEVEL is set to ${PLATFORM_PSA_ISOLATION_LEVEL}")
389 endif()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530390endif()
391
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530392if(NOT DEFINED INCLUDE_PANIC_TESTS)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530393 #By default panic tests are disabled
394 set(INCLUDE_PANIC_TESTS 0 CACHE INTERNAL "Default INCLUDE_PANIC_TESTS value" FORCE)
395 message(STATUS "[PSA] : Defaulting INCLUDE_PANIC_TESTS to ${INCLUDE_PANIC_TESTS}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530396else()
jk-arm01ee3ff2021-10-18 22:41:47 +0530397 if(NOT ${INCLUDE_PANIC_TESTS} IN_LIST PSA_INCLUDE_PANIC_TESTS_OPTIONS)
398 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DINCLUDE_PANIC_TESTS=${INCLUDE_PANIC_TESTS}, supported values are : ${PSA_INCLUDE_PANIC_TESTS_OPTIONS}")
399 endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530400 if(INCLUDE_PANIC_TESTS EQUAL 1)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530401 message(STATUS "[PSA] : "
402 "INCLUDE_PANIC_TESTS set to 1, therefore including PSA APIs panic tests into the regression,\n"
403 "\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 +0530404 endif()
405endif()
406
407if(NOT DEFINED WATCHDOG_AVAILABLE)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530408 #Assuming watchdog is available to program by test suite
409 set(WATCHDOG_AVAILABLE 1 CACHE INTERNAL "Default WATCHDOG_AVAILABLE value" FORCE)
410 message(STATUS "[PSA] : Defaulting WATCHDOG_AVAILABLE to ${WATCHDOG_AVAILABLE}")
411else()
412 message(STATUS "[PSA] : WATCHDOG_AVAILABLE is set to ${WATCHDOG_AVAILABLE}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530413endif()
414
415if((INCLUDE_PANIC_TESTS EQUAL 1) AND
416 (WATCHDOG_AVAILABLE EQUAL 0))
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530417 message(WARNING "[PSA]: "
418 "Note that to test PSA APIs panic conditions, test harness may require to access"
419 "the watchdog timer in oder to recover from panic and to be able to continue with"
420 "next test. Ignore this warning if system under test has capability to reset the"
421 "system when it encounters panic condition.")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530422endif()
423
424if(NOT DEFINED SP_HEAP_MEM_SUPP)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530425 #Are dynamic memory functions available to secure partition?
426 set(SP_HEAP_MEM_SUPP 1 CACHE INTERNAL "Default SP_HEAP_MEM_SUPP value" FORCE)
427 message(STATUS "[PSA] : Defaulting SP_HEAP_MEM_SUPP to ${SP_HEAP_MEM_SUPP}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530428endif()
429
Vinay Kumar Kotegowderac218992020-04-03 12:56:00 +0530430if(NOT DEFINED SUITE_TEST_RANGE)
431 set(SUITE_TEST_RANGE_MIN None)
432 set(SUITE_TEST_RANGE_MAX None)
433else()
434 list(LENGTH SUITE_TEST_RANGE SUITE_TEST_RANGE_LENGTH)
435 if(${SUITE_TEST_RANGE_LENGTH} GREATER "2")
436 message(FATAL_ERROR "[PSA] : -DSUITE_TEST_RANGE=<...> value error! accepts two "
437 " numbers in quotes separated with ';'")
438 endif()
439 if(${SUITE_TEST_RANGE_LENGTH} EQUAL "2")
440 list(GET SUITE_TEST_RANGE 0 SUITE_TEST_RANGE_MIN)
441 list(GET SUITE_TEST_RANGE 1 SUITE_TEST_RANGE_MAX)
442 message(STATUS "[PSA] : Testing (${SUITE_TEST_RANGE_MIN}, ${SUITE_TEST_RANGE_MAX}) of ${SUITE} suite")
443 endif()
444 if(${SUITE_TEST_RANGE_LENGTH} EQUAL "1")
445 set(SUITE_TEST_RANGE_MIN ${SUITE_TEST_RANGE})
446 set(SUITE_TEST_RANGE_MAX ${SUITE_TEST_RANGE})
447 message(STATUS "[PSA] : Testing ${SUITE_TEST_RANGE_MIN} of ${SUITE} suite")
448 endif()
449endif()
450
jk-armbf532fd2021-05-07 13:58:22 +0530451if(NOT DEFINED SPEC_VERSION)
452 message(STATUS "[PSA] : Default spec version")
453else()
454 if(NOT ${SPEC_VERSION} IN_LIST PSA_SPEC_VERSION)
455 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DSPEC_VERSION=${SPEC_VERSION}, supported values are : ${PSA_SPEC_VERSION} for ${SUITE}")
456 else()
457 message(STATUS "[PSA] : Testing ${SUITE} for spec version ${SPEC_VERSION}")
458 endif()
459endif()
460
jk-arm957cfea2021-06-18 15:52:12 +0530461if(DEFINED STATELESS_ROT_TESTS)
462 if(NOT ${STATELESS_ROT_TESTS} IN_LIST PSA_STATELESS_ROT)
463 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DSTATELESS_ROT_TESTS=${STATELESS_ROT_TESTS}, supported values are : ${PSA_STATELESS_ROT}")
464 elseif(${STATELESS_ROT_TESTS} EQUAL 1)
465 message(STATUS "[PSA] : Testing ${SUITE} for stateless rot")
466 elseif(${STATELESS_ROT_TESTS} EQUAL 0)
467 message(STATUS "[PSA] : Testing ${SUITE} for connection based")
468 endif()
469
470 if(NOT DEFINED SPEC_VERSION)
471 message(FATAL_ERROR "[PSA] : Error: SPEC_VERSION is require for STATELESS_ROT_TESTS.")
472 elseif(${SUITE} STREQUAL "IPC")
473 if(${SPEC_VERSION} STREQUAL "1.0")
474 message(FATAL_ERROR "[PSA] : Error: STATELESS_ROT_TESTS is only valid for SPEC_VERSION=1.1.")
475 elseif(${SPEC_VERSION} STREQUAL "1.1")
476 add_definitions(-DSPEC_VERSION=11)
477 if(${STATELESS_ROT_TESTS} EQUAL 1)
478 add_definitions(-DSTATELESS_ROT=1)
479 elseif(${STATELESS_ROT_TESTS} EQUAL 0)
480 add_definitions(-DSTATELESS_ROT=0)
481 endif()
482 endif()
483 else()
484 message(FATAL_ERROR "[PSA] : Error: STATELESS_ROT_TESTS is only applicable to IPC Test Suite.")
485 endif()
486else()
487 add_definitions(-DSTATELESS_ROT=0)
488 if(DEFINED SPEC_VERSION)
489 if(${SUITE} STREQUAL "IPC")
490 if(${SPEC_VERSION} STREQUAL "1.0")
491 add_definitions(-DSPEC_VERSION=10)
492 endif()
493 if(${SPEC_VERSION} STREQUAL "1.1")
494 add_definitions(-DSPEC_VERSION=11)
495 endif()
496 endif()
497 endif()
498endif()
499
jk-arm01ee3ff2021-10-18 22:41:47 +0530500if(NOT DEFINED TESTS_COVERAGE)
501 #By default all tests are included
502 set(TESTS_COVERAGE "ALL" CACHE INTERNAL "Default TESTS_COVERAGE value" FORCE)
503 message(STATUS "[PSA] : Defaulting TESTS_COVERAGE to ${TESTS_COVERAGE}")
504else()
505 if(NOT ${TESTS_COVERAGE} IN_LIST PSA_TESTS_COVERAGE_OPTIONS)
506 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DTESTS_COVERAGE=${TESTS_COVERAGE}, supported values are : ${PSA_TESTS_COVERAGE_OPTIONS}")
507 endif()
508 if(TESTS_COVERAGE STREQUAL ALL)
509 message(STATUS "[PSA] : "
510 "TESTS_COVERAGE set to ALL, therefore all tests are included.")
511 endif()
512 if(TESTS_COVERAGE STREQUAL PASS)
513 message(STATUS "[PSA] : "
514 "TESTS_COVERAGE set to PASS, therefore known failure tests are not included.")
515 add_definitions(-DTESTS_COVERAGE)
516 endif()
517endif()
518
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530519message(STATUS "[PSA] : ----------Process input arguments- complete-------------")
520
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530521
Gyorgy Szing42d62332022-02-08 17:50:04 +0000522if((${SUITE} STREQUAL "INITIAL_ATTESTATION") AND (NOT EXISTS ${PSA_TARGET_QCBOR}))
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530523# Clone QCBOR and move to specified tag
524execute_process(COMMAND ${GIT_EXECUTABLE} clone ${PSA_QCBOR_GIT_REPO_LINK} ${PSA_TARGET_QCBOR}
Gyorgy Szing42d62332022-02-08 17:50:04 +0000525 RESULT_VARIABLE qcbor_clone_result
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530526 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
Gyorgy Szing42d62332022-02-08 17:50:04 +0000527if(qcbor_clone_result)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530528 message(FATAL_ERROR "git clone failed for ${PSA_QCBOR_GIT_REPO_LINK}")
529endif()
530
Gyorgy Szing42d62332022-02-08 17:50:04 +0000531if(NOT qcbor_clone_result)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530532execute_process(COMMAND ${GIT_EXECUTABLE} checkout -q "${PSA_QCBOR_GIT_REPO_TAG}"
Gyorgy Szing42d62332022-02-08 17:50:04 +0000533 RESULT_VARIABLE qcbor_checkout_result
534 WORKING_DIRECTORY ${PSA_TARGET_QCBOR})
535if(qcbor_checkout_result)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530536 message(FATAL_ERROR "git checkout failed for Repo : ${PSA_QCBOR_GIT_REPO_LINK}, Tag : ${PSA_QCBOR_GIT_REPO_TAG}")
537endif()
538endif()
539endif()
gowtham siddarth12833042020-02-10 22:11:11 +0530540
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530541# Create PSA clean list
542list(APPEND PSA_CLEAN_LIST
543 ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_HEADER}
544 ${PSA_TESTLIST_FILE}
545 ${PSA_TEST_ENTRY_LIST_INC}
546 ${PSA_TEST_ENTRY_FUN_DECLARE_INC}
547 ${PSA_CLIENT_TEST_LIST_DELCARE_INC}
548 ${PSA_CLIENT_TEST_LIST_INC}
549 ${PSA_SERVER_TEST_LIST_DECLARE_INC}
550 ${PSA_SERVER_TEST_LIST}
551)
552
553# Process testsuite.db
554message(STATUS "[PSA] : Creating testlist.txt 'available at ${PSA_TESTLIST_FILE}'")
555execute_process(COMMAND ${PYTHON_EXECUTABLE} ${PSA_TESTLIST_GENERATOR}
556 ${SUITE_LOWER}
557 ${TESTSUITE_DB}
558 ${INCLUDE_PANIC_TESTS}
jk-arm01ee3ff2021-10-18 22:41:47 +0530559 ${TESTS_COVERAGE}
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530560 ${PSA_TESTLIST_FILE}
561 ${PSA_TEST_ENTRY_LIST_INC}
562 ${PSA_TEST_ENTRY_FUN_DECLARE_INC}
563 ${PSA_CLIENT_TEST_LIST_DELCARE_INC}
564 ${PSA_CLIENT_TEST_LIST_INC}
565 ${PSA_SERVER_TEST_LIST_DECLARE_INC}
Vinay Kumar Kotegowderac218992020-04-03 12:56:00 +0530566 ${PSA_SERVER_TEST_LIST}
567 ${SUITE_TEST_RANGE_MIN}
568 ${SUITE_TEST_RANGE_MAX})
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530569
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530570# Creating CMake list variable from file
571file(READ ${PSA_TESTLIST_FILE} PSA_TEST_LIST)
Vinay Kumar Kotegowderac218992020-04-03 12:56:00 +0530572if(NOT PSA_TEST_LIST)
573 message(FATAL_ERROR "[PSA] : Invalid test number!")
574endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530575string(REGEX REPLACE "\n" ";" PSA_TEST_LIST "${PSA_TEST_LIST}")
576
577add_custom_target(
578 ${PSA_TARGET_GENERATE_DATABASE_PRE}
579 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/platform
580 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/val
581 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/partition
582 COMMAND ${CMAKE_COMMAND} -E make_directory ${PSA_SUITE_OUT_DIR}
583)
584
585# Generate target files from User provided data base
586include(ExternalProject)
587ExternalProject_Add(
588 ${PSA_TARGET_GENERATE_DATABASE}
589 PREFIX ${CMAKE_CURRENT_BINARY_DIR}
590 DOWNLOAD_COMMAND ""
591 UPDATE_COMMAND ""
592 PATCH_COMMAND ""
jothikumar manied3f1c02023-04-28 16:17:25 +0800593 BUILD_ALWAYS TRUE
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530594 SOURCE_DIR "${PSA_ROOT_DIR}/tools/scripts/target_cfg"
595 CMAKE_ARGS -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
596 -DOUT_DIR=${CMAKE_CURRENT_BINARY_DIR}
597 -DTARGET=${TARGET}
598 -DGENERATOR_FILE=${PSA_TARGET_CONFIG_HEADER_GENERATOR}
599 -DINCLUDE_DIR=${PSA_ROOT_DIR}/val/common
600 -DTARGET_CONFIGURATION_FILE=${TARGET_CONFIGURATION_FILE}
601 -DTGT_CONFIG_SOURCE_C=${TGT_CONFIG_SOURCE_C}
602 -DOUTPUT_HEADER=${OUTPUT_HEADER}
603 -DDATABASE_TABLE_NAME=${DATABASE_TABLE_NAME}
604 -DDATABASE_TABLE_SECTION_NAME=${DATABASE_TABLE_SECTION_NAME}
605 -DTARGET_HEADER_GEN_INCLUDE_PATHS=${TARGET_HEADER_GEN_INCLUDE_PATHS}
606 LIST_SEPARATOR |
607 TEST_COMMAND ""
608)
609
610# Add custom target to clean generated files of the external project
611add_custom_target(
612 ${PSA_TARGET_GENERATE_DATABASE_POST}
613 COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/src/${PSA_TARGET_GENERATE_DATABASE}-build/ -- clean
614)
615
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530616# Check for supported toolchain/s
617if(${TOOLCHAIN} IN_LIST PSA_TOOLCHAIN_SUPPORT)
jk-armbf532fd2021-05-07 13:58:22 +0530618 if (DEFINED CROSS_COMPILE)
jk-arm7e6145a2021-07-19 19:36:14 +0530619 if(NOT (${TOOLCHAIN} IN_LIST CROSS_COMPILE_TOOLCHAIN_SUPPORT))
620 message(FATAL_ERROR "[PSA] : Error: CROSS_COMPILE not supported for this toolchain, supported toolchain are : ${CROSS_COMPILE_TOOLCHAIN_SUPPORT}")
621 endif()
jk-armbf532fd2021-05-07 13:58:22 +0530622 endif()
jk-arm7e6145a2021-07-19 19:36:14 +0530623 include(${PSA_ROOT_DIR}/tools/cmake/compiler/${TOOLCHAIN}.cmake)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530624else()
jk-arm7e6145a2021-07-19 19:36:14 +0530625 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DTOOLCHAIN=${TOOLCHAIN}, supported toolchain are : ${PSA_TOOLCHAIN_SUPPORT}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530626endif()
627
628# Global macro to identify the PSA test suite cmake build
629add_definitions(-DPSA_CMAKE_BUILD)
630add_definitions(-D${SUITE})
631add_definitions(-DVERBOSE=${VERBOSE})
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530632add_definitions(-DPLATFORM_PSA_ISOLATION_LEVEL=${PLATFORM_PSA_ISOLATION_LEVEL})
Vinay Kumar Kotegowder52bbfc92020-07-03 17:23:59 +0530633add_definitions(-D${TARGET})
jotman016d7dd4e2020-11-10 17:32:28 +0800634if("${TFM_PROFILE}" STREQUAL "profile_small")
635 message(STATUS "[PSA] : Building SMALL profile")
636 add_definitions(-DTF_M_PROFILE_SMALL)
637elseif("${TFM_PROFILE}" STREQUAL "profile_medium")
638 message(STATUS "[PSA] : Building MEDIUM profile")
639 add_definitions(-DTF_M_PROFILE_MEDIUM)
640endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530641if(${SP_HEAP_MEM_SUPP} EQUAL 1)
642 add_definitions(-DSP_HEAP_MEM_SUPP)
643endif()
jotman0138cb53a2023-02-14 16:27:06 +0800644
Summer Qin937a1ed2022-07-13 10:29:26 +0800645if(${CC312_LEGACY_DRIVER_API_ENABLED})
646 add_definitions(-DCC312_LEGACY_DRIVER_API_ENABLED)
647endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530648
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530649# Build PAL NSPE LIB
650include(${PSA_ROOT_DIR}/platform/targets/${TARGET}/target.cmake)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530651# Build VAL NSPE LIB
652#add_definitions(-DVAL_NSPE_BUILD)
653include(${PSA_ROOT_DIR}/val/val_nspe.cmake)
654# Build test
655include(${PSA_SUITE_DIR}/suite.cmake)
656if(${SUITE} STREQUAL "IPC")
657# Build SPE LIB
658include(${PSA_ROOT_DIR}/val/val_spe.cmake)
659endif()
660
661add_dependencies(${PSA_TARGET_GENERATE_DATABASE} ${PSA_TARGET_GENERATE_DATABASE_PRE})
662add_dependencies(${PSA_TARGET_GENERATE_DATABASE_POST} ${PSA_TARGET_GENERATE_DATABASE})
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530663add_dependencies(${PSA_TARGET_PAL_NSPE_LIB} ${PSA_TARGET_GENERATE_DATABASE_POST})
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530664add_dependencies(${PSA_TARGET_VAL_NSPE_LIB} ${PSA_TARGET_PAL_NSPE_LIB})
665add_dependencies(${PSA_TARGET_TEST_COMBINE_LIB} ${PSA_TARGET_VAL_NSPE_LIB})
666if(${SUITE} STREQUAL "IPC")
667add_dependencies(${PSA_TARGET_DRIVER_PARTITION_LIB} ${PSA_TARGET_TEST_COMBINE_LIB})
668add_dependencies(${PSA_TARGET_CLIENT_PARTITION_LIB} ${PSA_TARGET_DRIVER_PARTITION_LIB})
669add_dependencies(${PSA_TARGET_SERVER_PARTITION_LIB} ${PSA_TARGET_CLIENT_PARTITION_LIB})
670endif()
671
672# Include the files for make clean
673foreach(clean_item ${PSA_CLEAN_LIST})
674 set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${clean_item})
675endforeach()
676
677set_property(TARGET ${PSA_TARGET_VAL_NSPE_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/val)
678set_property(TARGET ${PSA_TARGET_PAL_NSPE_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/platform)
679set_property(TARGET ${PSA_TARGET_TEST_COMBINE_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${PSA_SUITE_OUT_DIR})
680if(${SUITE} STREQUAL "IPC")
681set_property(TARGET ${PSA_TARGET_DRIVER_PARTITION_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/partition)
682set_property(TARGET ${PSA_TARGET_CLIENT_PARTITION_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/partition)
683set_property(TARGET ${PSA_TARGET_SERVER_PARTITION_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/partition)
684endif()