blob: 63f6a41101068c1710cc27d0103803bd14d70715 [file] [log] [blame]
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +05301#/** @file
jothikumar mani18b98e02023-04-05 00:39:23 +08002# * Copyright (c) 2019-2023, Arm Limited or its affiliates. All rights reserved.
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +05303# * SPDX-License-Identifier : Apache-2.0
jothikumar mani36b2b862023-05-05 13:51:27 +05304# * Copyright 2023 NXP
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +05305# *
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
jothikumar mani4a274162023-07-18 00:31:22 +0800128 armv7a
jotman01bed7a152021-05-25 22:57:17 +0800129 armv8a
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530130)
131
132# list of VERBOSE options
133list(APPEND PSA_VERBOSE_OPTIONS 1 2 3 4 5)
134
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530135# list of PLATFORM_PSA_ISOLATION_LEVEL options
jotman016d7dd4e2020-11-10 17:32:28 +0800136if("${TFM_PROFILE}" STREQUAL "profile_medium")
137list(APPEND PLATFORM_PSA_ISOLATION_LEVEL_OPTIONS 1 2)
138else()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530139list(APPEND PLATFORM_PSA_ISOLATION_LEVEL_OPTIONS 1 2 3)
jotman016d7dd4e2020-11-10 17:32:28 +0800140endif()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530141
jk-arm01ee3ff2021-10-18 22:41:47 +0530142#list of INCLUDE_PANIC_TESTS options
143list(APPEND PSA_INCLUDE_PANIC_TESTS_OPTIONS 0 1)
144
jk-armbf532fd2021-05-07 13:58:22 +0530145# list of available spec version
146if("${SUITE}" STREQUAL "STORAGE" OR ${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE" OR ${SUITE} STREQUAL "PROTECTED_STORAGE")
147list(APPEND PSA_SPEC_VERSION
148 1.0-BETA2
149 1.0
150)
151elseif("${SUITE}" STREQUAL "CRYPTO")
152list(APPEND PSA_SPEC_VERSION
153 1.0-BETA1
154 1.0-BETA2
155 1.0-BETA3
156)
157elseif("${SUITE}" STREQUAL "INITIAL_ATTESTATION")
158list(APPEND PSA_SPEC_VERSION
159 1.0-BETA0
160 1.0.0
161 1.0.1
162 1.0.2
163)
jk-arm957cfea2021-06-18 15:52:12 +0530164elseif("${SUITE}" STREQUAL "IPC")
165list(APPEND PSA_SPEC_VERSION
166 1.0
167 1.1
168)
jk-arm957cfea2021-06-18 15:52:12 +0530169endif()
170
171#list of values available for connection based
172if(${SUITE} STREQUAL "IPC")
173list(APPEND PSA_STATELESS_ROT 0 1)
jk-armbf532fd2021-05-07 13:58:22 +0530174endif()
175
jk-arm01ee3ff2021-10-18 22:41:47 +0530176#list of TESTS_COVERAGE available options
177list(APPEND PSA_TESTS_COVERAGE_OPTIONS
178 "ALL"
179 "PASS"
180)
181
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530182message(STATUS "[PSA] : ----------Process input arguments- start-------------")
183
184# Check for TARGET command line argument
185_check_arguments("TARGET")
186# Check for SUTIE command line argument
187_check_arguments("SUITE")
188# Check for PSA_INCLUDE_PATHS command line argument
189_check_arguments("PSA_INCLUDE_PATHS")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530190
191string(TOLOWER ${SUITE} SUITE_LOWER)
192
193# Check for valid targets
194_get_sub_dir_list(PSA_TARGET_LIST ${PSA_ROOT_DIR}/platform/targets)
195if(NOT ${TARGET} IN_LIST PSA_TARGET_LIST)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100196 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DTARGET=${TARGET}, supported targets are : ${PSA_TARGET_LIST}")
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530197else()
198 message(STATUS "[PSA] : TARGET is set to ${TARGET}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530199endif()
200
201# Check for the presence of required test suite directories
202if((NOT IS_DIRECTORY ${PSA_ROOT_DIR}/dev_apis) OR (NOT IS_DIRECTORY ${PSA_ROOT_DIR}/ff))
203 message(STATUS "[PSA] : Error: Could not find architecture test suite directories in psa root path ${PSA_ROOT_DIR}")
204endif()
205
206if(FALSE)
207# Check for build directory specified
208if(NOT DEFINED BUILD)
209 set(BUILD ${CMAKE_CURRENT_BINARY_DIR}/BUILD CACHE INTERNAL "Defaulting build directory to ${BUILD}" FORCE)
210else()
211 set(BUILD ${CMAKE_CURRENT_BINARY_DIR}/${BUILD}/BUILD CACHE INTERNAL "Defaulting build directory to ${BUILD}" FORCE)
212endif()
213endif()
214
215# Check for valid suite cmake argument passed
216if(NOT ${SUITE} IN_LIST PSA_SUITES)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100217 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 +0530218else()
219 message(STATUS "[PSA] : SUITE is set to ${SUITE}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530220endif()
221
222# Project variables
223set(PSA_TARGET_PRE_BUILD psa_pre_build)
224set(PSA_TARGET_GENERATE_DATABASE_PRE psa_generate_database_prerequisite)
225set(PSA_TARGET_GENERATE_DATABASE psa_generate_database)
226set(PSA_TARGET_GENERATE_DATABASE_POST psa_generate_database_cleanup)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530227if(${SUITE} STREQUAL "INITIAL_ATTESTATION")
Gyorgy Szing42d62332022-02-08 17:50:04 +0000228 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 +0530229endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530230set(PSA_TARGET_PAL_NSPE_LIB pal_nspe)
231set(PSA_TARGET_VAL_NSPE_LIB val_nspe)
232set(PSA_TARGET_TEST_COMBINE_LIB test_combine)
jk-armbf532fd2021-05-07 13:58:22 +0530233set(PSA_TARGET_DRIVER_PARTITION_LIB tfm_psa_rot_partition_driver_partition)
234set(PSA_TARGET_CLIENT_PARTITION_LIB tfm_app_rot_partition_client_partition)
235set(PSA_TARGET_SERVER_PARTITION_LIB tfm_app_rot_partition_server_partition)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530236if(${SUITE} STREQUAL "IPC")
237 set(PSA_SUITE_DIR ${PSA_ROOT_DIR}/ff/${SUITE_LOWER})
238 set(PSA_SUITE_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/ff/${SUITE_LOWER})
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +0530239elseif((${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE") OR (${SUITE} STREQUAL "PROTECTED_STORAGE"))
240 set(PSA_SUITE_DIR ${PSA_ROOT_DIR}/dev_apis/storage)
241 set(PSA_SUITE_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/dev_apis/storage)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530242else()
243 set(PSA_SUITE_DIR ${PSA_ROOT_DIR}/dev_apis/${SUITE_LOWER})
244 set(PSA_SUITE_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/dev_apis/${SUITE_LOWER})
245endif()
246set(PSA_TARGET_CONFIG_HEADER_GENERATOR ${PSA_ROOT_DIR}/tools/scripts/target_cfg/targetConfigGen.py)
247set(PSA_TESTLIST_GENERATOR ${PSA_ROOT_DIR}/tools/scripts/gen_tests_list.py)
248set(TARGET_CONFIGURATION_FILE ${PSA_ROOT_DIR}/platform/targets/${TARGET}/target.cfg)
249set(TGT_CONFIG_SOURCE_C ${CMAKE_CURRENT_BINARY_DIR}/targetConfigGen.c)
250set(OUTPUT_HEADER target_database.h)
251set(DATABASE_TABLE_NAME target_database)
252set(DATABASE_TABLE_SECTION_NAME "NOSECTION")
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +0530253set(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 +0530254if(NOT DEFINED SPEC_VERSION)
255 if(${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE")
256 set(TESTSUITE_DB ${PSA_SUITE_DIR}/its_testsuite.db)
257 elseif((${SUITE} STREQUAL "PROTECTED_STORAGE") OR (${SUITE} STREQUAL "STORAGE"))
258 set(TESTSUITE_DB ${PSA_SUITE_DIR}/ps_testsuite.db)
jothikumar mani18b98e02023-04-05 00:39:23 +0800259 elseif(${SUITE} STREQUAL "CRYPTO")
260 if(DEFINED BESPOKE_SUITE_TESTS)
261 set(TESTSUITE_DB ${PSA_ROOT_DIR}/platform/targets/${TARGET}/${BESPOKE_SUITE_TESTS})
262 else()
263 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
264 endif()
jk-armbf532fd2021-05-07 13:58:22 +0530265 else()
266 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
267 endif()
jothikumar mani18b98e02023-04-05 00:39:23 +0800268 message(STATUS "[PSA] : Selected test database file : ${TESTSUITE_DB}")
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +0530269else()
jk-armbf532fd2021-05-07 13:58:22 +0530270 if(${SUITE} STREQUAL "INTERNAL_TRUSTED_STORAGE")
271 if(${SPEC_VERSION} STREQUAL "1.0-BETA2")
272 set(TESTSUITE_DB ${PSA_SUITE_DIR}/its_1.0-beta2_testsuite.db)
273 endif()
274 if(${SPEC_VERSION} STREQUAL "1.0")
275 set(TESTSUITE_DB ${PSA_SUITE_DIR}/its_1.0_testsuite.db)
276 endif()
277 elseif((${SUITE} STREQUAL "PROTECTED_STORAGE") OR (${SUITE} STREQUAL "STORAGE"))
278 if(${SPEC_VERSION} STREQUAL "1.0-BETA2")
279 set(TESTSUITE_DB ${PSA_SUITE_DIR}/ps_1.0-beta2_testsuite.db)
280 endif()
281 if(${SPEC_VERSION} STREQUAL "1.0")
282 set(TESTSUITE_DB ${PSA_SUITE_DIR}/ps_1.0_testsuite.db)
283 endif()
284 elseif(${SUITE} STREQUAL "CRYPTO")
285 if(${SPEC_VERSION} STREQUAL "1.0-BETA1")
286 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0-beta1_testsuite.db)
287 endif()
288 if(${SPEC_VERSION} STREQUAL "1.0-BETA2")
289 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0-beta2_testsuite.db)
290 endif()
291 if(${SPEC_VERSION} STREQUAL "1.0-BETA3")
292 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0-beta3_testsuite.db)
293 endif()
294 elseif(${SUITE} STREQUAL "INITIAL_ATTESTATION")
295 if(${SPEC_VERSION} STREQUAL "1.0-BETA0")
296 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0-beta0_testsuite.db)
297 endif()
298 if(${SPEC_VERSION} STREQUAL "1.0.0")
299 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0.0_testsuite.db)
300 endif()
301 if(${SPEC_VERSION} STREQUAL "1.0.1")
302 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0.1_testsuite.db)
303 endif()
304 if(${SPEC_VERSION} STREQUAL "1.0.2")
305 set(TESTSUITE_DB ${PSA_SUITE_DIR}/1.0.2_testsuite.db)
306 endif()
jk-arm957cfea2021-06-18 15:52:12 +0530307 elseif(${SUITE} STREQUAL "IPC")
308 if(${SPEC_VERSION} STREQUAL "1.1")
309 if(DEFINED STATELESS_ROT_TESTS)
310 if(${STATELESS_ROT_TESTS} EQUAL 1)
311 set(TESTSUITE_DB ${PSA_SUITE_DIR}/stateless_rot_testsuite.db)
312 else()
313 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
314 endif()
315 else()
316 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
317 endif()
318 else()
319 set(TESTSUITE_DB ${PSA_SUITE_DIR}/testsuite.db)
320 endif()
321 endif()
Vinay Kumar Kotegowder18fcd402020-04-27 17:38:41 +0530322endif()
323set(PSA_TESTLIST_FILE ${CMAKE_CURRENT_BINARY_DIR}/${SUITE_LOWER}_testlist.txt)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530324set(PSA_TEST_ENTRY_LIST_INC ${CMAKE_CURRENT_BINARY_DIR}/test_entry_list.inc)
325set(PSA_TEST_ENTRY_FUN_DECLARE_INC ${CMAKE_CURRENT_BINARY_DIR}/test_entry_fn_declare_list.inc)
326set(PSA_CLIENT_TEST_LIST_DELCARE_INC ${CMAKE_CURRENT_BINARY_DIR}/client_tests_list_declare.inc)
327set(PSA_CLIENT_TEST_LIST_INC ${CMAKE_CURRENT_BINARY_DIR}/client_tests_list.inc)
328set(PSA_SERVER_TEST_LIST_DECLARE_INC ${CMAKE_CURRENT_BINARY_DIR}/server_tests_list_declare.inc)
329set(PSA_SERVER_TEST_LIST ${CMAKE_CURRENT_BINARY_DIR}/server_tests_list.inc)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530330if(${SUITE} STREQUAL "INITIAL_ATTESTATION")
Gyorgy Szing42d62332022-02-08 17:50:04 +0000331 set(PSA_QCBOR_INCLUDE_PATH ${PSA_TARGET_QCBOR}/inc)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530332endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530333
334# Validity check for required files for a given suite
335if(NOT DEFINED PSA_${SUITE}_FILES)
336 message(FATAL_ERROR "[PSA] : List of file/s to verify against ${suite} is not defined")
337endif()
338foreach(file_item ${PSA_${SUITE}_FILES})
339 set(PSA_FILE_FOUND FALSE)
340 foreach(include_path ${PSA_INCLUDE_PATHS})
341 if((EXISTS ${include_path}/${file_item}) AND
342 (NOT PSA_FILE_FOUND))
343 set(PSA_FILE_FOUND TRUE)
344 break()
345 endif()
346 endforeach()
347 if(NOT PSA_FILE_FOUND)
348 message(FATAL_ERROR "[PSA] : Couldn't find ${file_item} in ${PSA_INCLUDE_PATHS}")
349 endif()
350endforeach()
351
352# Check for TOOLCHAIN command line argument
353if(NOT DEFINED TOOLCHAIN)
354 set(TOOLCHAIN "GNUARM" CACHE INTERNAL "Compiler used" FORCE)
355 message(STATUS "[PSA] : Defaulting compiler to ${TOOLCHAIN}")
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530356else()
357 message(STATUS "[PSA] : TOOLCHAIN is set to ${TOOLCHAIN}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530358endif()
359
Gowtham Siddarth1d6d4692019-09-16 11:47:29 +0530360if(${TOOLCHAIN} STREQUAL "ARMCLANG" OR ${TOOLCHAIN} STREQUAL "GNUARM")
361 if(NOT DEFINED CPU_ARCH)
362 message(FATAL_ERROR "[PSA] : Error: -DCPU_ARCH option missing")
363 else()
364 # Check for CPU architecture
365 if(NOT ${CPU_ARCH} IN_LIST PSA_CPU_ARCH_SUPPORT)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100366 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 +0530367 endif()
368 endif()
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530369 message(STATUS "[PSA] : CPU_ARCH is set to ${CPU_ARCH}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530370endif()
371
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530372# Check for VERBOSE
373if(NOT DEFINED VERBOSE)
374 set(VERBOSE 3 CACHE INTERNAL "Default VERBOSE value" FORCE)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530375 message(STATUS "[PSA] : Defaulting VERBOSE to ${VERBOSE}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530376else()
377 if(NOT ${VERBOSE} IN_LIST PSA_VERBOSE_OPTIONS)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100378 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DVERBOSE=${VERBOSE}, supported values are : ${PSA_VERBOSE_OPTIONS}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530379 endif()
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530380 message(STATUS "[PSA] : VERBOSE is set to ${VERBOSE}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530381endif()
382
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530383# Check for PLATFORM_PSA_ISOLATION_LEVEL
384if(NOT DEFINED PLATFORM_PSA_ISOLATION_LEVEL)
jotman016d7dd4e2020-11-10 17:32:28 +0800385 if("${TFM_PROFILE}" STREQUAL "profile_medium")
386 set(PLATFORM_PSA_ISOLATION_LEVEL 2 CACHE INTERNAL "Default PLATFORM_PSA_ISOLATION_LEVEL value" FORCE)
387 else()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530388 set(PLATFORM_PSA_ISOLATION_LEVEL 3 CACHE INTERNAL "Default PLATFORM_PSA_ISOLATION_LEVEL value" FORCE)
jotman016d7dd4e2020-11-10 17:32:28 +0800389 endif()
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530390 if(${SUITE} STREQUAL "IPC")
391 message(STATUS "[PSA] : Defaulting PLATFORM_PSA_ISOLATION_LEVEL to ${PLATFORM_PSA_ISOLATION_LEVEL}")
392 endif()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530393else()
394 if(NOT ${PLATFORM_PSA_ISOLATION_LEVEL} IN_LIST PLATFORM_PSA_ISOLATION_LEVEL_OPTIONS)
Øyvind Rønningstadabbb7272020-11-09 14:50:54 +0100395 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 +0530396 endif()
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530397 if(${SUITE} STREQUAL "IPC")
398 message(STATUS "[PSA] : PLATFORM_PSA_ISOLATION_LEVEL is set to ${PLATFORM_PSA_ISOLATION_LEVEL}")
399 endif()
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530400endif()
401
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530402if(NOT DEFINED INCLUDE_PANIC_TESTS)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530403 #By default panic tests are disabled
404 set(INCLUDE_PANIC_TESTS 0 CACHE INTERNAL "Default INCLUDE_PANIC_TESTS value" FORCE)
405 message(STATUS "[PSA] : Defaulting INCLUDE_PANIC_TESTS to ${INCLUDE_PANIC_TESTS}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530406else()
jk-arm01ee3ff2021-10-18 22:41:47 +0530407 if(NOT ${INCLUDE_PANIC_TESTS} IN_LIST PSA_INCLUDE_PANIC_TESTS_OPTIONS)
408 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DINCLUDE_PANIC_TESTS=${INCLUDE_PANIC_TESTS}, supported values are : ${PSA_INCLUDE_PANIC_TESTS_OPTIONS}")
409 endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530410 if(INCLUDE_PANIC_TESTS EQUAL 1)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530411 message(STATUS "[PSA] : "
412 "INCLUDE_PANIC_TESTS set to 1, therefore including PSA APIs panic tests into the regression,\n"
413 "\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 +0530414 endif()
415endif()
416
417if(NOT DEFINED WATCHDOG_AVAILABLE)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530418 #Assuming watchdog is available to program by test suite
419 set(WATCHDOG_AVAILABLE 1 CACHE INTERNAL "Default WATCHDOG_AVAILABLE value" FORCE)
420 message(STATUS "[PSA] : Defaulting WATCHDOG_AVAILABLE to ${WATCHDOG_AVAILABLE}")
421else()
422 message(STATUS "[PSA] : WATCHDOG_AVAILABLE is set to ${WATCHDOG_AVAILABLE}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530423endif()
424
425if((INCLUDE_PANIC_TESTS EQUAL 1) AND
426 (WATCHDOG_AVAILABLE EQUAL 0))
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530427 message(WARNING "[PSA]: "
428 "Note that to test PSA APIs panic conditions, test harness may require to access"
429 "the watchdog timer in oder to recover from panic and to be able to continue with"
430 "next test. Ignore this warning if system under test has capability to reset the"
431 "system when it encounters panic condition.")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530432endif()
433
434if(NOT DEFINED SP_HEAP_MEM_SUPP)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530435 #Are dynamic memory functions available to secure partition?
436 set(SP_HEAP_MEM_SUPP 1 CACHE INTERNAL "Default SP_HEAP_MEM_SUPP value" FORCE)
437 message(STATUS "[PSA] : Defaulting SP_HEAP_MEM_SUPP to ${SP_HEAP_MEM_SUPP}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530438endif()
439
Vinay Kumar Kotegowderac218992020-04-03 12:56:00 +0530440if(NOT DEFINED SUITE_TEST_RANGE)
441 set(SUITE_TEST_RANGE_MIN None)
442 set(SUITE_TEST_RANGE_MAX None)
443else()
444 list(LENGTH SUITE_TEST_RANGE SUITE_TEST_RANGE_LENGTH)
445 if(${SUITE_TEST_RANGE_LENGTH} GREATER "2")
446 message(FATAL_ERROR "[PSA] : -DSUITE_TEST_RANGE=<...> value error! accepts two "
447 " numbers in quotes separated with ';'")
448 endif()
449 if(${SUITE_TEST_RANGE_LENGTH} EQUAL "2")
450 list(GET SUITE_TEST_RANGE 0 SUITE_TEST_RANGE_MIN)
451 list(GET SUITE_TEST_RANGE 1 SUITE_TEST_RANGE_MAX)
452 message(STATUS "[PSA] : Testing (${SUITE_TEST_RANGE_MIN}, ${SUITE_TEST_RANGE_MAX}) of ${SUITE} suite")
453 endif()
454 if(${SUITE_TEST_RANGE_LENGTH} EQUAL "1")
455 set(SUITE_TEST_RANGE_MIN ${SUITE_TEST_RANGE})
456 set(SUITE_TEST_RANGE_MAX ${SUITE_TEST_RANGE})
457 message(STATUS "[PSA] : Testing ${SUITE_TEST_RANGE_MIN} of ${SUITE} suite")
458 endif()
459endif()
460
jk-armbf532fd2021-05-07 13:58:22 +0530461if(NOT DEFINED SPEC_VERSION)
462 message(STATUS "[PSA] : Default spec version")
463else()
464 if(NOT ${SPEC_VERSION} IN_LIST PSA_SPEC_VERSION)
465 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DSPEC_VERSION=${SPEC_VERSION}, supported values are : ${PSA_SPEC_VERSION} for ${SUITE}")
466 else()
467 message(STATUS "[PSA] : Testing ${SUITE} for spec version ${SPEC_VERSION}")
468 endif()
469endif()
470
jk-arm957cfea2021-06-18 15:52:12 +0530471if(DEFINED STATELESS_ROT_TESTS)
472 if(NOT ${STATELESS_ROT_TESTS} IN_LIST PSA_STATELESS_ROT)
473 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DSTATELESS_ROT_TESTS=${STATELESS_ROT_TESTS}, supported values are : ${PSA_STATELESS_ROT}")
474 elseif(${STATELESS_ROT_TESTS} EQUAL 1)
475 message(STATUS "[PSA] : Testing ${SUITE} for stateless rot")
476 elseif(${STATELESS_ROT_TESTS} EQUAL 0)
477 message(STATUS "[PSA] : Testing ${SUITE} for connection based")
478 endif()
479
480 if(NOT DEFINED SPEC_VERSION)
481 message(FATAL_ERROR "[PSA] : Error: SPEC_VERSION is require for STATELESS_ROT_TESTS.")
482 elseif(${SUITE} STREQUAL "IPC")
483 if(${SPEC_VERSION} STREQUAL "1.0")
484 message(FATAL_ERROR "[PSA] : Error: STATELESS_ROT_TESTS is only valid for SPEC_VERSION=1.1.")
485 elseif(${SPEC_VERSION} STREQUAL "1.1")
486 add_definitions(-DSPEC_VERSION=11)
487 if(${STATELESS_ROT_TESTS} EQUAL 1)
488 add_definitions(-DSTATELESS_ROT=1)
489 elseif(${STATELESS_ROT_TESTS} EQUAL 0)
490 add_definitions(-DSTATELESS_ROT=0)
491 endif()
492 endif()
493 else()
494 message(FATAL_ERROR "[PSA] : Error: STATELESS_ROT_TESTS is only applicable to IPC Test Suite.")
495 endif()
496else()
497 add_definitions(-DSTATELESS_ROT=0)
498 if(DEFINED SPEC_VERSION)
499 if(${SUITE} STREQUAL "IPC")
500 if(${SPEC_VERSION} STREQUAL "1.0")
501 add_definitions(-DSPEC_VERSION=10)
502 endif()
503 if(${SPEC_VERSION} STREQUAL "1.1")
504 add_definitions(-DSPEC_VERSION=11)
505 endif()
506 endif()
507 endif()
508endif()
509
jk-arm01ee3ff2021-10-18 22:41:47 +0530510if(NOT DEFINED TESTS_COVERAGE)
511 #By default all tests are included
512 set(TESTS_COVERAGE "ALL" CACHE INTERNAL "Default TESTS_COVERAGE value" FORCE)
513 message(STATUS "[PSA] : Defaulting TESTS_COVERAGE to ${TESTS_COVERAGE}")
514else()
515 if(NOT ${TESTS_COVERAGE} IN_LIST PSA_TESTS_COVERAGE_OPTIONS)
516 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DTESTS_COVERAGE=${TESTS_COVERAGE}, supported values are : ${PSA_TESTS_COVERAGE_OPTIONS}")
517 endif()
518 if(TESTS_COVERAGE STREQUAL ALL)
519 message(STATUS "[PSA] : "
520 "TESTS_COVERAGE set to ALL, therefore all tests are included.")
521 endif()
522 if(TESTS_COVERAGE STREQUAL PASS)
523 message(STATUS "[PSA] : "
524 "TESTS_COVERAGE set to PASS, therefore known failure tests are not included.")
525 add_definitions(-DTESTS_COVERAGE)
526 endif()
527endif()
528
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530529message(STATUS "[PSA] : ----------Process input arguments- complete-------------")
530
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530531
Gyorgy Szing42d62332022-02-08 17:50:04 +0000532if((${SUITE} STREQUAL "INITIAL_ATTESTATION") AND (NOT EXISTS ${PSA_TARGET_QCBOR}))
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530533# Clone QCBOR and move to specified tag
534execute_process(COMMAND ${GIT_EXECUTABLE} clone ${PSA_QCBOR_GIT_REPO_LINK} ${PSA_TARGET_QCBOR}
Gyorgy Szing42d62332022-02-08 17:50:04 +0000535 RESULT_VARIABLE qcbor_clone_result
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530536 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
Gyorgy Szing42d62332022-02-08 17:50:04 +0000537if(qcbor_clone_result)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530538 message(FATAL_ERROR "git clone failed for ${PSA_QCBOR_GIT_REPO_LINK}")
539endif()
540
Gyorgy Szing42d62332022-02-08 17:50:04 +0000541if(NOT qcbor_clone_result)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530542execute_process(COMMAND ${GIT_EXECUTABLE} checkout -q "${PSA_QCBOR_GIT_REPO_TAG}"
Gyorgy Szing42d62332022-02-08 17:50:04 +0000543 RESULT_VARIABLE qcbor_checkout_result
544 WORKING_DIRECTORY ${PSA_TARGET_QCBOR})
545if(qcbor_checkout_result)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530546 message(FATAL_ERROR "git checkout failed for Repo : ${PSA_QCBOR_GIT_REPO_LINK}, Tag : ${PSA_QCBOR_GIT_REPO_TAG}")
547endif()
548endif()
549endif()
gowtham siddarth12833042020-02-10 22:11:11 +0530550
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530551# Create PSA clean list
552list(APPEND PSA_CLEAN_LIST
553 ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_HEADER}
554 ${PSA_TESTLIST_FILE}
555 ${PSA_TEST_ENTRY_LIST_INC}
556 ${PSA_TEST_ENTRY_FUN_DECLARE_INC}
557 ${PSA_CLIENT_TEST_LIST_DELCARE_INC}
558 ${PSA_CLIENT_TEST_LIST_INC}
559 ${PSA_SERVER_TEST_LIST_DECLARE_INC}
560 ${PSA_SERVER_TEST_LIST}
561)
562
563# Process testsuite.db
564message(STATUS "[PSA] : Creating testlist.txt 'available at ${PSA_TESTLIST_FILE}'")
565execute_process(COMMAND ${PYTHON_EXECUTABLE} ${PSA_TESTLIST_GENERATOR}
566 ${SUITE_LOWER}
567 ${TESTSUITE_DB}
568 ${INCLUDE_PANIC_TESTS}
jk-arm01ee3ff2021-10-18 22:41:47 +0530569 ${TESTS_COVERAGE}
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530570 ${PSA_TESTLIST_FILE}
571 ${PSA_TEST_ENTRY_LIST_INC}
572 ${PSA_TEST_ENTRY_FUN_DECLARE_INC}
573 ${PSA_CLIENT_TEST_LIST_DELCARE_INC}
574 ${PSA_CLIENT_TEST_LIST_INC}
575 ${PSA_SERVER_TEST_LIST_DECLARE_INC}
Vinay Kumar Kotegowderac218992020-04-03 12:56:00 +0530576 ${PSA_SERVER_TEST_LIST}
577 ${SUITE_TEST_RANGE_MIN}
578 ${SUITE_TEST_RANGE_MAX})
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530579
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530580# Creating CMake list variable from file
581file(READ ${PSA_TESTLIST_FILE} PSA_TEST_LIST)
Vinay Kumar Kotegowderac218992020-04-03 12:56:00 +0530582if(NOT PSA_TEST_LIST)
583 message(FATAL_ERROR "[PSA] : Invalid test number!")
584endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530585string(REGEX REPLACE "\n" ";" PSA_TEST_LIST "${PSA_TEST_LIST}")
586
587add_custom_target(
588 ${PSA_TARGET_GENERATE_DATABASE_PRE}
589 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/platform
590 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/val
591 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/partition
592 COMMAND ${CMAKE_COMMAND} -E make_directory ${PSA_SUITE_OUT_DIR}
593)
594
595# Generate target files from User provided data base
596include(ExternalProject)
597ExternalProject_Add(
598 ${PSA_TARGET_GENERATE_DATABASE}
599 PREFIX ${CMAKE_CURRENT_BINARY_DIR}
600 DOWNLOAD_COMMAND ""
601 UPDATE_COMMAND ""
602 PATCH_COMMAND ""
jothikumar manied3f1c02023-04-28 16:17:25 +0800603 BUILD_ALWAYS TRUE
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530604 SOURCE_DIR "${PSA_ROOT_DIR}/tools/scripts/target_cfg"
605 CMAKE_ARGS -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
606 -DOUT_DIR=${CMAKE_CURRENT_BINARY_DIR}
607 -DTARGET=${TARGET}
608 -DGENERATOR_FILE=${PSA_TARGET_CONFIG_HEADER_GENERATOR}
609 -DINCLUDE_DIR=${PSA_ROOT_DIR}/val/common
610 -DTARGET_CONFIGURATION_FILE=${TARGET_CONFIGURATION_FILE}
611 -DTGT_CONFIG_SOURCE_C=${TGT_CONFIG_SOURCE_C}
612 -DOUTPUT_HEADER=${OUTPUT_HEADER}
613 -DDATABASE_TABLE_NAME=${DATABASE_TABLE_NAME}
614 -DDATABASE_TABLE_SECTION_NAME=${DATABASE_TABLE_SECTION_NAME}
615 -DTARGET_HEADER_GEN_INCLUDE_PATHS=${TARGET_HEADER_GEN_INCLUDE_PATHS}
616 LIST_SEPARATOR |
617 TEST_COMMAND ""
618)
619
620# Add custom target to clean generated files of the external project
621add_custom_target(
622 ${PSA_TARGET_GENERATE_DATABASE_POST}
623 COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/src/${PSA_TARGET_GENERATE_DATABASE}-build/ -- clean
624)
625
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530626# Check for supported toolchain/s
627if(${TOOLCHAIN} IN_LIST PSA_TOOLCHAIN_SUPPORT)
jk-armbf532fd2021-05-07 13:58:22 +0530628 if (DEFINED CROSS_COMPILE)
jk-arm7e6145a2021-07-19 19:36:14 +0530629 if(NOT (${TOOLCHAIN} IN_LIST CROSS_COMPILE_TOOLCHAIN_SUPPORT))
630 message(FATAL_ERROR "[PSA] : Error: CROSS_COMPILE not supported for this toolchain, supported toolchain are : ${CROSS_COMPILE_TOOLCHAIN_SUPPORT}")
631 endif()
jk-armbf532fd2021-05-07 13:58:22 +0530632 endif()
jk-arm7e6145a2021-07-19 19:36:14 +0530633 include(${PSA_ROOT_DIR}/tools/cmake/compiler/${TOOLCHAIN}.cmake)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530634else()
jk-arm7e6145a2021-07-19 19:36:14 +0530635 message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DTOOLCHAIN=${TOOLCHAIN}, supported toolchain are : ${PSA_TOOLCHAIN_SUPPORT}")
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530636endif()
637
638# Global macro to identify the PSA test suite cmake build
639add_definitions(-DPSA_CMAKE_BUILD)
640add_definitions(-D${SUITE})
641add_definitions(-DVERBOSE=${VERBOSE})
Jaykumar Pitambarbhai Patelccf5bf22019-12-06 11:58:32 +0530642add_definitions(-DPLATFORM_PSA_ISOLATION_LEVEL=${PLATFORM_PSA_ISOLATION_LEVEL})
Vinay Kumar Kotegowder52bbfc92020-07-03 17:23:59 +0530643add_definitions(-D${TARGET})
jotman016d7dd4e2020-11-10 17:32:28 +0800644if("${TFM_PROFILE}" STREQUAL "profile_small")
645 message(STATUS "[PSA] : Building SMALL profile")
646 add_definitions(-DTF_M_PROFILE_SMALL)
647elseif("${TFM_PROFILE}" STREQUAL "profile_medium")
648 message(STATUS "[PSA] : Building MEDIUM profile")
649 add_definitions(-DTF_M_PROFILE_MEDIUM)
650endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530651if(${SP_HEAP_MEM_SUPP} EQUAL 1)
652 add_definitions(-DSP_HEAP_MEM_SUPP)
653endif()
jotman0138cb53a2023-02-14 16:27:06 +0800654
Summer Qin937a1ed2022-07-13 10:29:26 +0800655if(${CC312_LEGACY_DRIVER_API_ENABLED})
656 add_definitions(-DCC312_LEGACY_DRIVER_API_ENABLED)
657endif()
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530658
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530659# Build PAL NSPE LIB
Bruno De Smet593db412023-03-15 18:47:19 +0100660include(${PSA_ROOT_DIR}/platform/targets/common/nspe/pal_nspe.cmake)
Jaykumar Pitambarbhai Patel6c3b8082020-02-26 19:51:37 +0530661include(${PSA_ROOT_DIR}/platform/targets/${TARGET}/target.cmake)
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530662# Build VAL NSPE LIB
663#add_definitions(-DVAL_NSPE_BUILD)
664include(${PSA_ROOT_DIR}/val/val_nspe.cmake)
665# Build test
666include(${PSA_SUITE_DIR}/suite.cmake)
667if(${SUITE} STREQUAL "IPC")
668# Build SPE LIB
669include(${PSA_ROOT_DIR}/val/val_spe.cmake)
670endif()
671
672add_dependencies(${PSA_TARGET_GENERATE_DATABASE} ${PSA_TARGET_GENERATE_DATABASE_PRE})
673add_dependencies(${PSA_TARGET_GENERATE_DATABASE_POST} ${PSA_TARGET_GENERATE_DATABASE})
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530674add_dependencies(${PSA_TARGET_PAL_NSPE_LIB} ${PSA_TARGET_GENERATE_DATABASE_POST})
Vinay Kumar Kotegowder9982f902019-07-15 09:13:54 +0530675add_dependencies(${PSA_TARGET_VAL_NSPE_LIB} ${PSA_TARGET_PAL_NSPE_LIB})
676add_dependencies(${PSA_TARGET_TEST_COMBINE_LIB} ${PSA_TARGET_VAL_NSPE_LIB})
677if(${SUITE} STREQUAL "IPC")
678add_dependencies(${PSA_TARGET_DRIVER_PARTITION_LIB} ${PSA_TARGET_TEST_COMBINE_LIB})
679add_dependencies(${PSA_TARGET_CLIENT_PARTITION_LIB} ${PSA_TARGET_DRIVER_PARTITION_LIB})
680add_dependencies(${PSA_TARGET_SERVER_PARTITION_LIB} ${PSA_TARGET_CLIENT_PARTITION_LIB})
681endif()
682
683# Include the files for make clean
684foreach(clean_item ${PSA_CLEAN_LIST})
685 set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${clean_item})
686endforeach()
687
688set_property(TARGET ${PSA_TARGET_VAL_NSPE_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/val)
689set_property(TARGET ${PSA_TARGET_PAL_NSPE_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/platform)
690set_property(TARGET ${PSA_TARGET_TEST_COMBINE_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${PSA_SUITE_OUT_DIR})
691if(${SUITE} STREQUAL "IPC")
692set_property(TARGET ${PSA_TARGET_DRIVER_PARTITION_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/partition)
693set_property(TARGET ${PSA_TARGET_CLIENT_PARTITION_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/partition)
694set_property(TARGET ${PSA_TARGET_SERVER_PARTITION_LIB} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/partition)
695endif()