blob: ec0cf34658ab611a3a8b91fc5b1ff7530533b318 [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
Gyorgy Szingb8d6f262023-06-05 12:36:02 +02008# Check mandatory variables.
9foreach(_var IN ITEMS TGT)
10 if (NOT DEFINED ${_var})
11 message(FATAL_ERROR "Mandatory parameter '${_var}' missing.")
12 endif()
13endforeach()
14
15ts_add_uuid_to_exe_name(TGT "${TGT}" UUID "${SP_UUID_CANON}" )
Gyorgy Szing49091802020-11-24 00:33:09 +010016
17target_sources(${TGT} PRIVATE
Imre Kise6d73412021-10-18 14:01:47 +020018 "${CMAKE_CURRENT_LIST_DIR}/optee_sp_header.c"
Imre Kisef5c2642021-12-17 14:07:35 +010019 "${CMAKE_CURRENT_LIST_DIR}/sp_assert.c"
Imre Kise6d73412021-10-18 14:01:47 +020020 "${CMAKE_CURRENT_LIST_DIR}/sp_entry.c"
Imre Kis2ccd8e82021-10-08 11:21:14 +020021 "${CMAKE_CURRENT_LIST_DIR}/sp_trace.c"
Imre Kise6d73412021-10-18 14:01:47 +020022)
Andrew Beggs97a00d42021-06-15 15:45:46 +000023
24target_include_directories(${TGT}
Imre Kis2ccd8e82021-10-08 11:21:14 +020025 PUBLIC
26 "${CMAKE_CURRENT_LIST_DIR}/include"
27 )
28
Imre Kise6d73412021-10-18 14:01:47 +020029# Default trace configuration, can be overwritten by setting the same variables
30# in the deployment specific file before including this file.
31set(TRACE_PREFIX "SP" CACHE STRING "Trace prefix")
32set(TRACE_LEVEL "TRACE_LEVEL_ERROR" CACHE STRING "Trace level")
Imre Kis2ccd8e82021-10-08 11:21:14 +020033
Imre Kiseeee9642021-12-17 13:59:46 +010034if (NOT DEFINED SP_HEAP_SIZE)
35 message(FATAL_ERROR "SP_HEAP_SIZE is not defined")
36endif()
37
Imre Kis2ccd8e82021-10-08 11:21:14 +020038target_compile_definitions(${TGT} PRIVATE
39 TRACE_LEVEL=${TRACE_LEVEL}
40 TRACE_PREFIX="${TRACE_PREFIX}"
Imre Kiseeee9642021-12-17 13:59:46 +010041 SP_HEAP_SIZE=${SP_HEAP_SIZE}
Imre Kis2ccd8e82021-10-08 11:21:14 +020042)
Imre Kise6d73412021-10-18 14:01:47 +020043
Julian Hall8ad60432022-08-15 14:11:47 +010044include(${TS_ROOT}/external/newlib/newlib.cmake)
Imre Kise6d73412021-10-18 14:01:47 +020045
46target_link_libraries(${TGT} PRIVATE
Gyorgy Szing693877e2021-12-12 02:51:10 +010047 stdlib::c
Imre Kise6d73412021-10-18 14:01:47 +020048)
49
50target_link_options(${TGT} PRIVATE
51 -Wl,--hash-style=sysv
52 -Wl,--as-needed
53 -Wl,--gc-sections
54)
55
56compiler_set_linker_script(TARGET ${TGT} FILE ${CMAKE_CURRENT_LIST_DIR}/sp.ld.S DEF ARM64=1)