blob: b1f84f31a55356458a04ec84b2c8d5173cd96943 [file] [log] [blame]
Per Åstrand79929ff2021-01-26 14:42:43 +01001#
Kristofer Jonsson93175812022-04-21 19:27:11 +02002# Copyright (c) 2021-2022 Arm Limited.
Per Åstrand79929ff2021-01-26 14:42:43 +01003#
4# SPDX-License-Identifier: Apache-2.0
5#
6# Licensed under the Apache License, Version 2.0 (the License); you may
7# not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# 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, WITHOUT
14# 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
19include(${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/helpers.cmake)
20
21#############################################################################
22# Configuration for secure world
23#############################################################################
24
25set(TRUSTZONE_BUILD TRUE)
26set(TRUSTZONE_SIDE secure)
27
28#############################################################################
29# TrustZone secure world
30#############################################################################
31
32ethosu_add_executable(trustzone_secure PRIVATE
33 SOURCES main_secure.cpp mpc_sie_drv.c
34 LIBRARIES ethosu_target_init)
35
36target_compile_definitions(trustzone_secure PUBLIC TRUSTZONE_BUILD)
37target_compile_definitions(trustzone_secure PUBLIC TRUSTZONE_SECURE)
38
39# Use the fast memory to support both 11.12.57 and 11.13.x release
40# of the FVP
Kristofer Jonsson93175812022-04-21 19:27:11 +020041target_compile_options(trustzone_secure PUBLIC
42 -UETHOSU_FAST_MEMORY_SIZE -DETHOSU_FAST_MEMORY_SIZE=0xa0000
43 -UETHOSU_ARENA -DETHOSU_ARENA=1
44 -UETHOSU_MODEL -DETHOSU_MODEL=1)
Per Åstrand79929ff2021-01-26 14:42:43 +010045
46target_compile_options(trustzone_secure PUBLIC -mcmse)
47
48# Add include directory for target application specifics
49target_include_directories(trustzone_secure PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../${ETHOSU_TARGET})
50
51#############################################################################
52# Additional linker configuration for trustzone
53#############################################################################
54
55# Output the secure gateway veneer library to be consumed by the build
56# process for the non-secure world
57target_link_options(trustzone_secure
58 PRIVATE --import_cmse_lib_out=${SECURE_GATEWAY_LIB})
59
60target_link_options(trustzone_secure
61 PRIVATE "--predefine=\"-I${CMAKE_CURRENT_SOURCE_DIR}/../${ETHOSU_TARGET}\"")
62
63#############################################################################
64# Helper target to extract secure binaries
65#############################################################################
66
67add_custom_target(secure_binary ALL COMMAND fromelf --bin
68 ${CMAKE_CURRENT_BINARY_DIR}/trustzone_secure.elf
69 -o ${CMAKE_CURRENT_BINARY_DIR}/s_bin
70 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/trustzone_secure)
71