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