Imre Kis | 2cfb2b4 | 2021-12-15 19:15:42 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
| 2 | # Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
Gyorgy Szing | b8d6f26 | 2023-06-05 12:36:02 +0200 | [diff] [blame] | 8 | # Check mandatory variables. |
Jelle Sels | 4960c41 | 2023-02-01 09:43:24 +0100 | [diff] [blame^] | 9 | foreach(_var IN ITEMS TGT TRACE_PREFIX SP_HEAP_SIZE SP_STACK_SIZE SP_FFA_UUID_CANON) |
Gyorgy Szing | b8d6f26 | 2023-06-05 12:36:02 +0200 | [diff] [blame] | 10 | if (NOT DEFINED ${_var}) |
| 11 | message(FATAL_ERROR "Mandatory parameter '${_var}' missing.") |
| 12 | endif() |
| 13 | endforeach() |
Imre Kis | 2cfb2b4 | 2021-12-15 19:15:42 +0100 | [diff] [blame] | 14 | |
Gyorgy Szing | 3e3db70 | 2023-07-21 14:18:19 +0200 | [diff] [blame] | 15 | # Ensure elf output naming is symbolize.py compatible. |
| 16 | # If binary UUID is not defined, fall back to using the SP UUID value. |
| 17 | if (NOT SP_BIN_UUID_CANON) |
Jelle Sels | 4960c41 | 2023-02-01 09:43:24 +0100 | [diff] [blame^] | 18 | set(SP_BIN_UUID_CANON "${SP_FFA_UUID_CANON}") |
Gyorgy Szing | 3e3db70 | 2023-07-21 14:18:19 +0200 | [diff] [blame] | 19 | endif() |
| 20 | ts_add_uuid_to_exe_name(TGT "${TGT}" UUID "${SP_BIN_UUID_CANON}" ) |
Imre Kis | 2cfb2b4 | 2021-12-15 19:15:42 +0100 | [diff] [blame] | 21 | |
| 22 | target_sources(${TGT} PRIVATE |
| 23 | "${CMAKE_CURRENT_LIST_DIR}/entry.S" |
| 24 | "${CMAKE_CURRENT_LIST_DIR}/sp_assert.c" |
| 25 | "${CMAKE_CURRENT_LIST_DIR}/sp_entry.c" |
| 26 | "${CMAKE_CURRENT_LIST_DIR}/sp_trace.c" |
| 27 | ) |
| 28 | |
| 29 | # Default trace level configuration, can be overwritten by setting the same |
| 30 | # variable in the deployment specific file before including this file. |
| 31 | set(TRACE_LEVEL "TRACE_LEVEL_ERROR" CACHE STRING "Trace level") |
| 32 | |
| 33 | target_compile_definitions(${TGT} PRIVATE |
| 34 | TRACE_LEVEL=${TRACE_LEVEL} |
| 35 | TRACE_PREFIX="${TRACE_PREFIX}" |
| 36 | SP_HEAP_SIZE=${SP_HEAP_SIZE} |
| 37 | ) |
| 38 | |
Julian Hall | 8ad6043 | 2022-08-15 14:11:47 +0100 | [diff] [blame] | 39 | include(${TS_ROOT}/external/newlib/newlib.cmake) |
Imre Kis | 2cfb2b4 | 2021-12-15 19:15:42 +0100 | [diff] [blame] | 40 | |
| 41 | target_link_libraries(${TGT} PRIVATE |
| 42 | stdlib::c |
| 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 SP_STACK_SIZE=${SP_STACK_SIZE}) |