blob: e77dbf9e428dc61edc92b98d3d98da1dec31d3ab [file] [log] [blame]
Jelle Sels03756662021-05-20 10:41:57 +02001#-------------------------------------------------------------------------------
2# Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7#-------------------------------------------------------------------------------
8# The CMakeLists.txt for building the spm-test sp deployment for opteesp
9#
10# Used for building the SPs used in the spm test. The SP can be build twice
11# , to be able to test inter SPs communication. This is done by passing the
12# -DSP_NUMBER=1 parameter.
13#-------------------------------------------------------------------------------
14target_include_directories(spm-test${SP_NUMBER} PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}")
15
16include(${TS_ROOT}/tools/cmake/common/TargetCompileDefinitions.cmake)
17set_target_uuids(
18 SP_UUID ${SP_UUID_CANON}
19 SP_NAME "spm-test${SP_NUMBER}"
20)
21set(SP_HEAP_SIZE "32 * 1024" CACHE STRING "SP heap size in bytes")
22set(TRACE_PREFIX "SPM-TEST${SP_NUMBER}" CACHE STRING "Trace prefix")
23
24#-------------------------------------------------------------------------------
25# Extend with components that are common across all deployments of
26# spm-test
27#
28#-------------------------------------------------------------------------------
29target_include_directories(spm-test${SP_NUMBER} PRIVATE
30 ${TS_ROOT}
31 ${TS_ROOT}/components
32)
33
34#-------------------------------------------------------------------------------
35# Set target platform to provide drivers needed by the deployment
36#
37#-------------------------------------------------------------------------------
38add_platform(TARGET spm-test${SP_NUMBER})
39
40#################################################################
41
42target_compile_definitions(spm-test${SP_NUMBER} PRIVATE
43 ARM64=1
44)
45
46target_include_directories(spm-test${SP_NUMBER} PRIVATE
47 ${TS_ROOT}/components/service/spm_test
48)
49
Gyorgy Szing34aaf212022-10-20 07:26:23 +020050if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
51 target_compile_options(spm-test${SP_NUMBER} PRIVATE
52 -std=c99
53 )
54endif()
55
Jelle Sels03756662021-05-20 10:41:57 +020056#-------------------------------------------------------------------------------
57# Deployment specific source files
58#-------------------------------------------------------------------------------
59target_sources(spm-test${SP_NUMBER} PRIVATE
60 ${TS_ROOT}/components/service/spm_test/sp.c
61)
Jelle Sels03756662021-05-20 10:41:57 +020062
63compiler_generate_stripped_elf(TARGET spm-test${SP_NUMBER} NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF)
64
65######################################## install
66if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
67 set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE)
68endif()
69
Jelle Sels03756662021-05-20 10:41:57 +020070install(TARGETS spm-test${SP_NUMBER}
71 PUBLIC_HEADER DESTINATION ${TS_ENV}/include
72 RUNTIME DESTINATION ${TS_ENV}/bin
73 )
74install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
75
76
77include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake)
78export_sp(
79 SP_UUID_CANON ${SP_UUID_CANON}
Gyorgy Szing3e3db702023-07-21 14:18:19 +020080 SP_BIN_UUID_CANON ${SP_BIN_UUID_CANON}
Jelle Sels03756662021-05-20 10:41:57 +020081 SP_UUID_LE ${SP_UUID_LE}
82 SP_NAME "spm-test${SP_NUMBER}"
83 MK_IN ${TS_ROOT}/environments/opteesp/sp.mk.in
84 DTS_IN ${TS_ROOT}/deployments/spm-test${SP_NUMBER}/opteesp/default_spm_test${SP_NUMBER}.dts.in
85 JSON_IN ${TS_ROOT}/environments/opteesp/sp_pkg.json.in
86)