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 | |
| 8 | if (NOT DEFINED TGT) |
| 9 | message(FATAL_ERROR "mandatory parameter TGT is not defined.") |
| 10 | endif() |
| 11 | |
| 12 | if (NOT DEFINED TRACE_PREFIX) |
| 13 | message(FATAL_ERROR "mandatory parameter TRACE_PREFIX is not defined.") |
| 14 | endif() |
| 15 | |
| 16 | if (NOT DEFINED SP_HEAP_SIZE) |
| 17 | message(FATAL_ERROR "mandatory parameter SP_HEAP_SIZE is not defined.") |
| 18 | endif() |
| 19 | |
| 20 | if (NOT DEFINED SP_STACK_SIZE) |
| 21 | message(FATAL_ERROR "mandatory parameter SP_STACK_SIZE is not defined.") |
| 22 | endif() |
| 23 | |
| 24 | target_sources(${TGT} PRIVATE |
| 25 | "${CMAKE_CURRENT_LIST_DIR}/entry.S" |
| 26 | "${CMAKE_CURRENT_LIST_DIR}/sp_assert.c" |
| 27 | "${CMAKE_CURRENT_LIST_DIR}/sp_entry.c" |
| 28 | "${CMAKE_CURRENT_LIST_DIR}/sp_trace.c" |
| 29 | ) |
| 30 | |
| 31 | # Default trace level configuration, can be overwritten by setting the same |
| 32 | # variable in the deployment specific file before including this file. |
| 33 | set(TRACE_LEVEL "TRACE_LEVEL_ERROR" CACHE STRING "Trace level") |
| 34 | |
| 35 | target_compile_definitions(${TGT} PRIVATE |
| 36 | TRACE_LEVEL=${TRACE_LEVEL} |
| 37 | TRACE_PREFIX="${TRACE_PREFIX}" |
| 38 | SP_HEAP_SIZE=${SP_HEAP_SIZE} |
| 39 | ) |
| 40 | |
| 41 | include(../../../external/newlib/newlib.cmake) |
| 42 | |
| 43 | target_link_libraries(${TGT} PRIVATE |
| 44 | stdlib::c |
| 45 | ) |
| 46 | |
| 47 | target_link_options(${TGT} PRIVATE |
| 48 | -Wl,--hash-style=sysv |
| 49 | -Wl,--as-needed |
| 50 | -Wl,--gc-sections |
| 51 | ) |
| 52 | |
| 53 | compiler_set_linker_script(TARGET ${TGT} FILE ${CMAKE_CURRENT_LIST_DIR}/sp.ld.S DEF ARM64=1 SP_STACK_SIZE=${SP_STACK_SIZE}) |