blob: f6a65cdd465cbe0b94208a79386e5cca128d47a7 [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"
14 "${CMAKE_CURRENT_LIST_DIR}/newlib_init.c"
15 "${CMAKE_CURRENT_LIST_DIR}/newlib_sp_assert.c"
16 "${CMAKE_CURRENT_LIST_DIR}/newlib_sp_heap.c"
17 "${CMAKE_CURRENT_LIST_DIR}/sp_entry.c"
Imre Kis2ccd8e82021-10-08 11:21:14 +020018 "${CMAKE_CURRENT_LIST_DIR}/sp_trace.c"
Imre Kise6d73412021-10-18 14:01:47 +020019)
Andrew Beggs97a00d42021-06-15 15:45:46 +000020
21target_include_directories(${TGT}
Imre Kis2ccd8e82021-10-08 11:21:14 +020022 PUBLIC
23 "${CMAKE_CURRENT_LIST_DIR}/include"
24 )
25
Imre Kise6d73412021-10-18 14:01:47 +020026# Default trace configuration, can be overwritten by setting the same variables
27# in the deployment specific file before including this file.
28set(TRACE_PREFIX "SP" CACHE STRING "Trace prefix")
29set(TRACE_LEVEL "TRACE_LEVEL_ERROR" CACHE STRING "Trace level")
Imre Kis2ccd8e82021-10-08 11:21:14 +020030
31target_compile_definitions(${TGT} PRIVATE
32 TRACE_LEVEL=${TRACE_LEVEL}
33 TRACE_PREFIX="${TRACE_PREFIX}"
34)
Imre Kise6d73412021-10-18 14:01:47 +020035
36include(../../../external/newlib/newlib.cmake)
37
38target_link_libraries(${TGT} PRIVATE
39 c
40 nosys
41)
42
43target_link_options(${TGT} PRIVATE
44 -Wl,--hash-style=sysv
45 -Wl,--as-needed
46 -Wl,--gc-sections
47)
48
49compiler_set_linker_script(TARGET ${TGT} FILE ${CMAKE_CURRENT_LIST_DIR}/sp.ld.S DEF ARM64=1)