blob: 81b7dedfb41163735ed123517d9465ed16957322 [file] [log] [blame]
Mario Bălănicăc883ce02023-12-02 03:08:02 +02001#
2# Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved.
3# Copyright (c) 2024, Mario Bălănică <mariobalanica02@gmail.com>
4#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7
8include lib/xlat_tables_v2/xlat_tables.mk
9
10include drivers/arm/gic/v2/gicv2.mk
11
12PLAT_INCLUDES := -Iplat/rpi/common/include \
13 -Iplat/rpi/rpi5/include
14
15PLAT_BL_COMMON_SOURCES := drivers/arm/pl011/aarch64/pl011_console.S \
16 plat/rpi/common/rpi3_common.c \
17 plat/rpi/common/rpi3_console_pl011.c \
18 ${XLAT_TABLES_LIB_SRCS}
19
20BL31_SOURCES += lib/cpus/aarch64/cortex_a76.S \
21 plat/rpi/common/aarch64/plat_helpers.S \
22 plat/rpi/common/aarch64/armstub8_header.S \
23 drivers/delay_timer/delay_timer.c \
24 plat/common/plat_gicv2.c \
25 plat/rpi/common/rpi4_bl31_setup.c \
26 plat/rpi/rpi5/rpi5_setup.c \
27 plat/rpi/common/rpi3_pm.c \
28 plat/common/plat_psci_common.c \
29 plat/rpi/common/rpi3_topology.c \
30 ${GICV2_SOURCES}
31
32# For now we only support BL31, using the kernel loaded by the GPU firmware.
33RESET_TO_BL31 := 1
34
35# All CPUs enter armstub8.bin.
36COLD_BOOT_SINGLE_CPU := 0
37
38# Tune compiler for Cortex-A76
39ifeq ($(notdir $(CC)),armclang)
40 TF_CFLAGS_aarch64 += -mcpu=cortex-a76
41else ifneq ($(findstring clang,$(notdir $(CC))),)
42 TF_CFLAGS_aarch64 += -mcpu=cortex-a76
43else
44 TF_CFLAGS_aarch64 += -mtune=cortex-a76
45endif
46
47# Add support for platform supplied linker script for BL31 build
48$(eval $(call add_define,PLAT_EXTRA_LD_SCRIPT))
49
50# Enable all errata workarounds for Cortex-A76 r4p1
51ERRATA_A76_1946160 := 1
52ERRATA_A76_2743102 := 1
53
54# Add new default target when compiling this platform
55all: bl31
56
57# Build config flags
58# ------------------
59
60# Disable stack protector by default
61ENABLE_STACK_PROTECTOR := 0
62
63# Have different sections for code and rodata
64SEPARATE_CODE_AND_RODATA := 1
65
66# Hardware-managed coherency
67HW_ASSISTED_COHERENCY := 1
68USE_COHERENT_MEM := 0
69
70# Cortex-A76 is 64-bit only
71CTX_INCLUDE_AARCH32_REGS := 0
72
73# Platform build flags
74# --------------------
75
76# There is not much else than a Linux kernel to load at the moment.
77RPI3_DIRECT_LINUX_BOOT := 1
78
79# BL33 images can only be AArch64 on this platform.
80RPI3_BL33_IN_AARCH32 := 0
81
82# UART to use at runtime. -1 means the runtime UART is disabled.
83# Any other value means the default UART will be used.
84RPI3_RUNTIME_UART := 0
85
86# Use normal memory mapping for ROM, FIP, SRAM and DRAM
87RPI3_USE_UEFI_MAP := 0
88
89# Process platform flags
90# ----------------------
91
92$(eval $(call add_define,RPI3_BL33_IN_AARCH32))
93$(eval $(call add_define,RPI3_DIRECT_LINUX_BOOT))
94ifdef RPI3_PRELOADED_DTB_BASE
95$(eval $(call add_define,RPI3_PRELOADED_DTB_BASE))
96endif
97$(eval $(call add_define,RPI3_RUNTIME_UART))
98$(eval $(call add_define,RPI3_USE_UEFI_MAP))
99
100ifeq (${ARCH},aarch32)
101 $(error Error: AArch32 not supported on rpi5)
102endif
103
104ifneq ($(ENABLE_STACK_PROTECTOR), 0)
105PLAT_BL_COMMON_SOURCES += drivers/rpi3/rng/rpi3_rng.c \
106 plat/rpi/common/rpi3_stack_protector.c
107endif