Imre Kis | 2cfb2b4 | 2021-12-15 19:15:42 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Imre Kis | d47a145 | 2024-05-29 14:25:59 +0200 | [diff] [blame^] | 2 | # Copyright (c) 2020-2024, Arm Limited and Contributors. All rights reserved. |
Imre Kis | 2cfb2b4 | 2021-12-15 19:15:42 +0100 | [diff] [blame] | 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 | |
Imre Kis | d47a145 | 2024-05-29 14:25:59 +0200 | [diff] [blame^] | 39 | add_subdirectory(${TS_ROOT}/components/common/libc ${CMAKE_BINARY_DIR}/libc_build) |
| 40 | add_components(TARGET ${TGT} |
| 41 | BASE_DIR ${TS_ROOT} |
| 42 | COMPONENTS |
| 43 | "components/common/dlmalloc" |
| 44 | ) |
Imre Kis | 2cfb2b4 | 2021-12-15 19:15:42 +0100 | [diff] [blame] | 45 | |
| 46 | target_link_libraries(${TGT} PRIVATE |
| 47 | stdlib::c |
| 48 | ) |
| 49 | |
| 50 | target_link_options(${TGT} PRIVATE |
| 51 | -Wl,--hash-style=sysv |
| 52 | -Wl,--as-needed |
| 53 | -Wl,--gc-sections |
| 54 | ) |
| 55 | |
| 56 | compiler_set_linker_script(TARGET ${TGT} FILE ${CMAKE_CURRENT_LIST_DIR}/sp.ld.S DEF ARM64=1 SP_STACK_SIZE=${SP_STACK_SIZE}) |