1#
2# Arm SCP/MCP Software
3# Copyright (c) 2021-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(rdn2-bl2)
13
14# SCP_PLATFORM_VARIANT value for supported RD-N2 platform variants:
15# - '0' for RD-N2 platform
16# - '1' for RD-N2-Cfg1 platform
17# - '2' for RD-N2-Cfg2 platform
18# - '3' for RD-N2-Cfg3 platform
19
20if (SCP_PLATFORM_VARIANT STREQUAL "0")
21      target_compile_definitions(rdn2-bl2
22                                 PUBLIC -DPLATFORM_VARIANT=0)
23elseif (SCP_PLATFORM_VARIANT STREQUAL "1")
24      target_compile_definitions(rdn2-bl2
25                                 PUBLIC -DPLATFORM_VARIANT=1)
26elseif (SCP_PLATFORM_VARIANT STREQUAL "2")
27      target_compile_definitions(rdn2-bl2
28                                 PUBLIC -DPLATFORM_VARIANT=2)
29             set(SCP_LOG_LEVEL "INFO" PARENT_SCOPE)
30elseif (SCP_PLATFORM_VARIANT STREQUAL "3")
31      target_compile_definitions(rdn2-bl2
32                                 PUBLIC -DPLATFORM_VARIANT=3)
33else()
34      message(FATAL_ERROR "Please set SCP_PLATFORM_VARIANT to \n"
35                                "'0' for RD-N2 \n"
36                                "'1' for RD-N2-Cfg1 \n"
37                                "'2' for RD-N2-Cfg2 \n"
38                                "'3' for RD-N2-Cfg3 \n")
39endif()
40
41target_include_directories(
42    rdn2-bl2 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../include"
43                    "${CMAKE_CURRENT_SOURCE_DIR}")
44
45# cmake-lint: disable=E1122
46
47target_sources(
48    rdn2-bl2
49    PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/config_system_power.c"
50            "${CMAKE_CURRENT_SOURCE_DIR}/config_armv7m_mpu.c"
51            "${CMAKE_CURRENT_SOURCE_DIR}/config_power_domain.c"
52            "${CMAKE_CURRENT_SOURCE_DIR}/config_ppu_v1.c"
53            "${CMAKE_CURRENT_SOURCE_DIR}/config_mhu2.c"
54            "${CMAKE_CURRENT_SOURCE_DIR}/config_transport.c"
55            "${CMAKE_CURRENT_SOURCE_DIR}/config_scmi.c"
56            "${CMAKE_CURRENT_SOURCE_DIR}/config_sds.c"
57            "${CMAKE_CURRENT_SOURCE_DIR}/config_timer.c"
58            "${CMAKE_CURRENT_SOURCE_DIR}/config_gtimer.c"
59            "${CMAKE_CURRENT_SOURCE_DIR}/config_scmi_system_power.c"
60            "${CMAKE_CURRENT_SOURCE_DIR}/config_cmn700.c"
61            "${CMAKE_CURRENT_SOURCE_DIR}/config_system_pll.c"
62            "${CMAKE_CURRENT_SOURCE_DIR}/config_pik_clock.c"
63            "${CMAKE_CURRENT_SOURCE_DIR}/config_css_clock.c"
64            "${CMAKE_CURRENT_SOURCE_DIR}/config_clock.c"
65            "${CMAKE_CURRENT_SOURCE_DIR}/config_apcontext.c"
66            "${CMAKE_CURRENT_SOURCE_DIR}/config_pcie_integ_ctrl.c"
67            "${CMAKE_CURRENT_SOURCE_DIR}/config_apremap.c"
68            "${CMAKE_CURRENT_SOURCE_DIR}/config_scmi_power_domain.c"
69            "${CMAKE_CURRENT_SOURCE_DIR}/config_platform_system.c"
70            "${CMAKE_CURRENT_SOURCE_DIR}/config_psu.c"
71            "${CMAKE_CURRENT_SOURCE_DIR}/config_mock_psu.c"
72            "${CMAKE_CURRENT_SOURCE_DIR}/config_dvfs.c"
73            "${CMAKE_CURRENT_SOURCE_DIR}/config_scmi_perf.c"
74            "${CMAKE_CURRENT_SOURCE_DIR}/config_sp805.c"
75            "${CMAKE_CURRENT_SOURCE_DIR}/../src/config_system_info.c"
76            "${CMAKE_CURRENT_SOURCE_DIR}/../src/config_pl011.c"
77            "${CMAKE_CURRENT_SOURCE_DIR}/../src/config_sid.c")
78
79#
80# Some of our firmware includes require CMSIS.
81#
82
83target_link_libraries(rdn2-bl2 PUBLIC cmsis::core-m)
84
85#
86# We explicitly add the CMSIS include directories to our interfaceinclude
87# directories. Each module target adds these include directories totheir own,
88# allowing them to include any firmware includes we expose.
89#
90
91target_include_directories(rdn2-bl2
92    PUBLIC $<TARGET_PROPERTY:cmsis::core-m,INTERFACE_INCLUDE_DIRECTORIES>)
93