blob: 72eef78859b80dbd64ec25ee71738c92b3388b1e [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 Kisef5c2642021-12-17 14:07:35 +010014 "${CMAKE_CURRENT_LIST_DIR}/sp_assert.c"
Imre Kise6d73412021-10-18 14:01:47 +020015 "${CMAKE_CURRENT_LIST_DIR}/sp_entry.c"
Imre Kis2ccd8e82021-10-08 11:21:14 +020016 "${CMAKE_CURRENT_LIST_DIR}/sp_trace.c"
Imre Kise6d73412021-10-18 14:01:47 +020017)
Andrew Beggs97a00d42021-06-15 15:45:46 +000018
19target_include_directories(${TGT}
Imre Kis2ccd8e82021-10-08 11:21:14 +020020 PUBLIC
21 "${CMAKE_CURRENT_LIST_DIR}/include"
22 )
23
Imre Kise6d73412021-10-18 14:01:47 +020024# Default trace configuration, can be overwritten by setting the same variables
25# in the deployment specific file before including this file.
26set(TRACE_PREFIX "SP" CACHE STRING "Trace prefix")
27set(TRACE_LEVEL "TRACE_LEVEL_ERROR" CACHE STRING "Trace level")
Imre Kis2ccd8e82021-10-08 11:21:14 +020028
Imre Kiseeee9642021-12-17 13:59:46 +010029if (NOT DEFINED SP_HEAP_SIZE)
30 message(FATAL_ERROR "SP_HEAP_SIZE is not defined")
31endif()
32
Imre Kis2ccd8e82021-10-08 11:21:14 +020033target_compile_definitions(${TGT} PRIVATE
34 TRACE_LEVEL=${TRACE_LEVEL}
35 TRACE_PREFIX="${TRACE_PREFIX}"
Imre Kiseeee9642021-12-17 13:59:46 +010036 SP_HEAP_SIZE=${SP_HEAP_SIZE}
Imre Kis2ccd8e82021-10-08 11:21:14 +020037)
Imre Kise6d73412021-10-18 14:01:47 +020038
39include(../../../external/newlib/newlib.cmake)
40
41target_link_libraries(${TGT} PRIVATE
Gyorgy Szing693877e2021-12-12 02:51:10 +010042 stdlib::c
Imre Kise6d73412021-10-18 14:01:47 +020043)
44
45target_link_options(${TGT} PRIVATE
46 -Wl,--hash-style=sysv
47 -Wl,--as-needed
48 -Wl,--gc-sections
49)
50
51compiler_set_linker_script(TARGET ${TGT} FILE ${CMAKE_CURRENT_LIST_DIR}/sp.ld.S DEF ARM64=1)