blob: 87f813a368c59f304883675b9f0a3ccc342f7e43 [file] [log] [blame]
Imre Kis2cfb2b42021-12-15 19:15:42 +01001#-------------------------------------------------------------------------------
2# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8if (NOT DEFINED TGT)
9 message(FATAL_ERROR "mandatory parameter TGT is not defined.")
10endif()
11
12if (NOT DEFINED TRACE_PREFIX)
13 message(FATAL_ERROR "mandatory parameter TRACE_PREFIX is not defined.")
14endif()
15
16if (NOT DEFINED SP_HEAP_SIZE)
17 message(FATAL_ERROR "mandatory parameter SP_HEAP_SIZE is not defined.")
18endif()
19
20if (NOT DEFINED SP_STACK_SIZE)
21 message(FATAL_ERROR "mandatory parameter SP_STACK_SIZE is not defined.")
22endif()
23
24target_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.
33set(TRACE_LEVEL "TRACE_LEVEL_ERROR" CACHE STRING "Trace level")
34
35target_compile_definitions(${TGT} PRIVATE
36 TRACE_LEVEL=${TRACE_LEVEL}
37 TRACE_PREFIX="${TRACE_PREFIX}"
38 SP_HEAP_SIZE=${SP_HEAP_SIZE}
39)
40
41include(../../../external/newlib/newlib.cmake)
42
43target_link_libraries(${TGT} PRIVATE
44 stdlib::c
45)
46
47target_link_options(${TGT} PRIVATE
48 -Wl,--hash-style=sysv
49 -Wl,--as-needed
50 -Wl,--gc-sections
51)
52
53compiler_set_linker_script(TARGET ${TGT} FILE ${CMAKE_CURRENT_LIST_DIR}/sp.ld.S DEF ARM64=1 SP_STACK_SIZE=${SP_STACK_SIZE})