1#
2# Arm SCP/MCP Software
3# Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
4#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7
8#
9# Create the firmware target.
10#
11
12add_executable(sgm775-bl2)
13
14target_include_directories(
15    sgm775-bl2 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../include"
16                      "${CMAKE_CURRENT_SOURCE_DIR}")
17
18# cmake-lint: disable=E1122
19
20target_sources(
21    sgm775-bl2
22    PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/config_clock.c"
23            "${CMAKE_CURRENT_SOURCE_DIR}/config_css_clock.c"
24            "${CMAKE_CURRENT_SOURCE_DIR}/config_dvfs.c"
25            "${CMAKE_CURRENT_SOURCE_DIR}/config_mhu.c"
26            "${CMAKE_CURRENT_SOURCE_DIR}/config_mock_psu.c"
27            "${CMAKE_CURRENT_SOURCE_DIR}/config_pik_clock.c"
28            "${CMAKE_CURRENT_SOURCE_DIR}/config_pl011.c"
29            "${CMAKE_CURRENT_SOURCE_DIR}/config_power_domain.c"
30            "${CMAKE_CURRENT_SOURCE_DIR}/config_ppu_v0.c"
31            "${CMAKE_CURRENT_SOURCE_DIR}/config_ppu_v1.c"
32            "${CMAKE_CURRENT_SOURCE_DIR}/config_psu.c"
33            "${CMAKE_CURRENT_SOURCE_DIR}/config_resource_perms.c"
34            "${CMAKE_CURRENT_SOURCE_DIR}/config_scmi_apcore.c"
35            "${CMAKE_CURRENT_SOURCE_DIR}/config_scmi.c"
36            "${CMAKE_CURRENT_SOURCE_DIR}/config_scmi_clock.c"
37            "${CMAKE_CURRENT_SOURCE_DIR}/config_scmi_perf.c"
38            "${CMAKE_CURRENT_SOURCE_DIR}/config_scmi_power_domain.c"
39            "${CMAKE_CURRENT_SOURCE_DIR}/config_scmi_system_power.c"
40            "${CMAKE_CURRENT_SOURCE_DIR}/config_sds.c"
41            "${CMAKE_CURRENT_SOURCE_DIR}/config_sensor.c"
42            "${CMAKE_CURRENT_SOURCE_DIR}/config_sgm775_ddr_phy500.c"
43            "${CMAKE_CURRENT_SOURCE_DIR}/config_sgm775_dmc500.c"
44            "${CMAKE_CURRENT_SOURCE_DIR}/config_transport.c"
45            "${CMAKE_CURRENT_SOURCE_DIR}/config_system_pll.c"
46            "${CMAKE_CURRENT_SOURCE_DIR}/config_system_power.c"
47            "${CMAKE_CURRENT_SOURCE_DIR}/config_timer.c"
48    PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../src/sgm775_core.c"
49            "${CMAKE_CURRENT_SOURCE_DIR}/../src/config_sid.c"
50            "${CMAKE_CURRENT_SOURCE_DIR}/../src/config_system_info.c")
51
52if(SCP_ENABLE_DEBUGGER)
53    target_compile_definitions(sgm775-bl2 PRIVATE BUILD_HAS_DEBUGGER)
54    target_sources(sgm775-bl2
55                   PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/config_debugger_cli.c")
56endif()
57
58if(SCP_ENABLE_RESOURCE_PERMISSIONS)
59    target_sources(
60        sgm775-bl2
61        PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/config_resource_perms.c")
62endif()
63
64#
65# Some of our firmware includes require CMSIS.
66#
67
68target_link_libraries(sgm775-bl2 PUBLIC cmsis::core-m)
69
70#
71# We explicitly add the CMSIS include directories to our interface include
72# directories. Each module target adds these include directories to their own,
73# allowing them to include any firmware includes we expose.
74#
75
76target_include_directories(
77    sgm775-bl2
78    PUBLIC $<TARGET_PROPERTY:cmsis::core-m,INTERFACE_INCLUDE_DIRECTORIES>)
79
80if(SCP_ENABLE_RESOURCE_PERMISSIONS)
81    list(APPEND SCP_MODULES "resource-perms")
82endif()
83
84if(SCP_ENABLE_DEBUGGER)
85    list(APPEND SCP_MODULES "debugger-cli")
86endif()
87
88set(SCP_MODULES ${SCP_MODULES} PARENT_SCOPE)
89set(SCP_MODULE_PATHS ${SCP_MODULE_PATHS} PARENT_SCOPE)
90