xref: /rk3399_ARM-atf/bl2/bl2.mk (revision f43e09a12e4f4f32185d3e2accceb65895d1f16b)
1#
2# Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
7BL2_SOURCES		+=	bl2/bl2_image_load_v2.c			\
8				bl2/bl2_main.c				\
9				bl2/${ARCH}/bl2_arch_setup.c		\
10				lib/locks/exclusive/${ARCH}/spinlock.S	\
11				plat/common/${ARCH}/platform_up_stack.S	\
12				${MBEDTLS_SOURCES}
13
14ifeq (${ARCH},aarch64)
15BL2_SOURCES		+=	common/aarch64/early_exceptions.S
16endif
17
18ifneq ($(findstring gcc,$(notdir $(LD))),)
19        BL2_LDFLAGS	+=	-Wl,--sort-section=alignment
20else ifneq ($(findstring ld,$(notdir $(LD))),)
21        BL2_LDFLAGS	+=	--sort-section=alignment
22endif
23
24ifeq (${ENABLE_RME},1)
25# Using RME, run BL2 at EL3
26include lib/gpt_rme/gpt_rme.mk
27
28BL2_SOURCES		+=      bl2/${ARCH}/bl2_rme_entrypoint.S	\
29				bl2/${ARCH}/bl2_el3_exceptions.S	\
30				bl2/${ARCH}/bl2_run_next_image.S	\
31				${GPT_LIB_SRCS}
32BL2_DEFAULT_LINKER_SCRIPT_SOURCE := bl2/bl2.ld.S
33
34else ifeq (${RESET_TO_BL2},0)
35# Normal operation, no RME, no BL2 at EL3
36BL2_SOURCES		+=	bl2/${ARCH}/bl2_entrypoint.S
37BL2_DEFAULT_LINKER_SCRIPT_SOURCE := bl2/bl2.ld.S
38
39else
40# BL2 at EL3, no RME
41BL2_SOURCES		+=	bl2/${ARCH}/bl2_el3_entrypoint.S	\
42				bl2/${ARCH}/bl2_el3_exceptions.S	\
43				bl2/${ARCH}/bl2_run_next_image.S        \
44				lib/cpus/${ARCH}/cpu_helpers.S
45
46ifeq (${DISABLE_MTPMU},1)
47BL2_SOURCES		+=	lib/extensions/mtpmu/${ARCH}/mtpmu.S
48endif
49
50ifeq (${ARCH},aarch64)
51BL2_SOURCES		+=	lib/cpus/aarch64/dsu_helpers.S
52endif
53
54BL2_DEFAULT_LINKER_SCRIPT_SOURCE := bl2/bl2_el3.ld.S
55endif
56