blob: 86b1d193f137e1aafe48a6a42cd3932b1a4cf2c1 [file] [log] [blame]
Gyorgy Szing49091802020-11-24 00:33:09 +01001#-------------------------------------------------------------------------------
Imre Kiseeee9642021-12-17 13:59:46 +01002# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
Gyorgy Szing49091802020-11-24 00:33:09 +01003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8if (NOT DEFINED TGT)
9 message(FATAL_ERROR "mandatory parameter TGT is not defined.")
10endif()
11
12target_sources(${TGT} PRIVATE
Imre Kise6d73412021-10-18 14:01:47 +020013 "${CMAKE_CURRENT_LIST_DIR}/optee_sp_header.c"
Imre Kise6d73412021-10-18 14:01:47 +020014 "${CMAKE_CURRENT_LIST_DIR}/sp_entry.c"
Imre Kis2ccd8e82021-10-08 11:21:14 +020015 "${CMAKE_CURRENT_LIST_DIR}/sp_trace.c"
Imre Kise6d73412021-10-18 14:01:47 +020016)
Andrew Beggs97a00d42021-06-15 15:45:46 +000017
18target_include_directories(${TGT}
Imre Kis2ccd8e82021-10-08 11:21:14 +020019 PUBLIC
20 "${CMAKE_CURRENT_LIST_DIR}/include"
21 )
22
Imre Kise6d73412021-10-18 14:01:47 +020023# Default trace configuration, can be overwritten by setting the same variables
24# in the deployment specific file before including this file.
25set(TRACE_PREFIX "SP" CACHE STRING "Trace prefix")
26set(TRACE_LEVEL "TRACE_LEVEL_ERROR" CACHE STRING "Trace level")
Imre Kis2ccd8e82021-10-08 11:21:14 +020027
Imre Kiseeee9642021-12-17 13:59:46 +010028if (NOT DEFINED SP_HEAP_SIZE)
29 message(FATAL_ERROR "SP_HEAP_SIZE is not defined")
30endif()
31
Imre Kis2ccd8e82021-10-08 11:21:14 +020032target_compile_definitions(${TGT} PRIVATE
33 TRACE_LEVEL=${TRACE_LEVEL}
34 TRACE_PREFIX="${TRACE_PREFIX}"
Imre Kiseeee9642021-12-17 13:59:46 +010035 SP_HEAP_SIZE=${SP_HEAP_SIZE}
Imre Kis2ccd8e82021-10-08 11:21:14 +020036)
Imre Kise6d73412021-10-18 14:01:47 +020037
38include(../../../external/newlib/newlib.cmake)
39
40target_link_libraries(${TGT} PRIVATE
Gyorgy Szing693877e2021-12-12 02:51:10 +010041 stdlib::c
Imre Kise6d73412021-10-18 14:01:47 +020042)
43
44target_link_options(${TGT} PRIVATE
45 -Wl,--hash-style=sysv
46 -Wl,--as-needed
47 -Wl,--gc-sections
48)
49
50compiler_set_linker_script(TARGET ${TGT} FILE ${CMAKE_CURRENT_LIST_DIR}/sp.ld.S DEF ARM64=1)