blob: 1b7c418098c36ca474dd03b0f1ec1e16b25aa6c2 [file] [log] [blame]
Gyorgy Szing49091802020-11-24 00:33:09 +01001#-------------------------------------------------------------------------------
Andrew Beggs97a00d42021-06-15 15:45:46 +00002# Copyright (c) 2020-2021, 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
28target_compile_definitions(${TGT} PRIVATE
29 TRACE_LEVEL=${TRACE_LEVEL}
30 TRACE_PREFIX="${TRACE_PREFIX}"
31)
Imre Kise6d73412021-10-18 14:01:47 +020032
33include(../../../external/newlib/newlib.cmake)
34
35target_link_libraries(${TGT} PRIVATE
Gyorgy Szing693877e2021-12-12 02:51:10 +010036 stdlib::c
Imre Kise6d73412021-10-18 14:01:47 +020037)
38
39target_link_options(${TGT} PRIVATE
40 -Wl,--hash-style=sysv
41 -Wl,--as-needed
42 -Wl,--gc-sections
43)
44
45compiler_set_linker_script(TARGET ${TGT} FILE ${CMAKE_CURRENT_LIST_DIR}/sp.ld.S DEF ARM64=1)