blob: 1e4a98bb0d3e1973a573cda4753a6236dfe1584c [file] [log] [blame]
Per Åstrand79929ff2021-01-26 14:42:43 +01001#
2# Copyright (c) 2021 Arm Limited. All rights reserved.
3#
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
41target_compile_definitions(
42 trustzone_secure PUBLIC ETHOSU_FAST_MEMORY_SIZE=0xa0000)
43
44target_compile_options(trustzone_secure PUBLIC -mcmse)
45
46# Add include directory for target application specifics
47target_include_directories(trustzone_secure PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../${ETHOSU_TARGET})
48
49#############################################################################
50# Additional linker configuration for trustzone
51#############################################################################
52
53# Output the secure gateway veneer library to be consumed by the build
54# process for the non-secure world
55target_link_options(trustzone_secure
56 PRIVATE --import_cmse_lib_out=${SECURE_GATEWAY_LIB})
57
58target_link_options(trustzone_secure
59 PRIVATE "--predefine=\"-I${CMAKE_CURRENT_SOURCE_DIR}/../${ETHOSU_TARGET}\"")
60
61#############################################################################
62# Helper target to extract secure binaries
63#############################################################################
64
65add_custom_target(secure_binary ALL COMMAND fromelf --bin
66 ${CMAKE_CURRENT_BINARY_DIR}/trustzone_secure.elf
67 -o ${CMAKE_CURRENT_BINARY_DIR}/s_bin
68 DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/trustzone_secure)
69