Gyorgy Szing | 4909180 | 2020-11-24 00:33:09 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Andrew Beggs | 97a00d4 | 2021-06-15 15:45:46 +0000 | [diff] [blame] | 2 | # Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved. |
Gyorgy Szing | 4909180 | 2020-11-24 00:33:09 +0100 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
| 8 | if (NOT DEFINED TGT) |
| 9 | message(FATAL_ERROR "mandatory parameter TGT is not defined.") |
| 10 | endif() |
| 11 | |
| 12 | target_sources(${TGT} PRIVATE |
Imre Kis | e6d7341 | 2021-10-18 14:01:47 +0200 | [diff] [blame] | 13 | "${CMAKE_CURRENT_LIST_DIR}/optee_sp_header.c" |
Imre Kis | e6d7341 | 2021-10-18 14:01:47 +0200 | [diff] [blame] | 14 | "${CMAKE_CURRENT_LIST_DIR}/sp_entry.c" |
Imre Kis | 2ccd8e8 | 2021-10-08 11:21:14 +0200 | [diff] [blame] | 15 | "${CMAKE_CURRENT_LIST_DIR}/sp_trace.c" |
Imre Kis | e6d7341 | 2021-10-18 14:01:47 +0200 | [diff] [blame] | 16 | ) |
Andrew Beggs | 97a00d4 | 2021-06-15 15:45:46 +0000 | [diff] [blame] | 17 | |
| 18 | target_include_directories(${TGT} |
Imre Kis | 2ccd8e8 | 2021-10-08 11:21:14 +0200 | [diff] [blame] | 19 | PUBLIC |
| 20 | "${CMAKE_CURRENT_LIST_DIR}/include" |
| 21 | ) |
| 22 | |
Imre Kis | e6d7341 | 2021-10-18 14:01:47 +0200 | [diff] [blame] | 23 | # Default trace configuration, can be overwritten by setting the same variables |
| 24 | # in the deployment specific file before including this file. |
| 25 | set(TRACE_PREFIX "SP" CACHE STRING "Trace prefix") |
| 26 | set(TRACE_LEVEL "TRACE_LEVEL_ERROR" CACHE STRING "Trace level") |
Imre Kis | 2ccd8e8 | 2021-10-08 11:21:14 +0200 | [diff] [blame] | 27 | |
| 28 | target_compile_definitions(${TGT} PRIVATE |
| 29 | TRACE_LEVEL=${TRACE_LEVEL} |
| 30 | TRACE_PREFIX="${TRACE_PREFIX}" |
| 31 | ) |
Imre Kis | e6d7341 | 2021-10-18 14:01:47 +0200 | [diff] [blame] | 32 | |
| 33 | include(../../../external/newlib/newlib.cmake) |
| 34 | |
| 35 | target_link_libraries(${TGT} PRIVATE |
Gyorgy Szing | 693877e | 2021-12-12 02:51:10 +0100 | [diff] [blame] | 36 | stdlib::c |
Imre Kis | e6d7341 | 2021-10-18 14:01:47 +0200 | [diff] [blame] | 37 | ) |
| 38 | |
| 39 | target_link_options(${TGT} PRIVATE |
| 40 | -Wl,--hash-style=sysv |
| 41 | -Wl,--as-needed |
| 42 | -Wl,--gc-sections |
| 43 | ) |
| 44 | |
| 45 | compiler_set_linker_script(TARGET ${TGT} FILE ${CMAKE_CURRENT_LIST_DIR}/sp.ld.S DEF ARM64=1) |