blob: b20251cf462f8b2e77d249df923ad99cdd138b5b [file] [log] [blame]
Andre Przywara6d471e12019-07-09 11:25:57 +01001#
2# Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
7include lib/libfdt/libfdt.mk
8include lib/xlat_tables_v2/xlat_tables.mk
9
10PLAT_INCLUDES := -Iplat/rpi/common/include \
11 -Iplat/rpi/rpi4/include
12
13PLAT_BL_COMMON_SOURCES := drivers/ti/uart/aarch64/16550_console.S \
14 plat/rpi/common/rpi3_common.c \
15 ${XLAT_TABLES_LIB_SRCS}
16
17BL31_SOURCES += lib/cpus/aarch64/cortex_a72.S \
18 plat/rpi/rpi4/aarch64/plat_helpers.S \
Andre Przywara2d8e99a2019-07-10 18:09:18 +010019 plat/rpi/rpi4/aarch64/armstub8_header.S \
Andre Przywara6d471e12019-07-09 11:25:57 +010020 drivers/arm/gic/common/gic_common.c \
21 drivers/arm/gic/v2/gicv2_helpers.c \
22 drivers/arm/gic/v2/gicv2_main.c \
23 plat/common/plat_gicv2.c \
24 plat/rpi/rpi4/rpi4_bl31_setup.c \
25 plat/rpi/common/rpi3_pm.c \
26 plat/common/plat_psci_common.c \
27 plat/rpi/common/rpi3_topology.c \
28 ${LIBFDT_SRCS}
29
30# For now we only support BL31, using the kernel loaded by the GPU firmware.
31RESET_TO_BL31 := 1
32
33# All CPUs enter armstub8.bin.
34COLD_BOOT_SINGLE_CPU := 0
35
36# Tune compiler for Cortex-A72
37ifeq ($(notdir $(CC)),armclang)
38 TF_CFLAGS_aarch64 += -mcpu=cortex-a72
39else ifneq ($(findstring clang,$(notdir $(CC))),)
40 TF_CFLAGS_aarch64 += -mcpu=cortex-a72
41else
42 TF_CFLAGS_aarch64 += -mtune=cortex-a72
43endif
44
Andre Przywara2d8e99a2019-07-10 18:09:18 +010045# Add support for platform supplied linker script for BL31 build
46$(eval $(call add_define,PLAT_EXTRA_LD_SCRIPT))
Andre Przywara6d471e12019-07-09 11:25:57 +010047
48# Enable all errata workarounds for Cortex-A72
49ERRATA_A72_859971 := 1
50
51WORKAROUND_CVE_2017_5715 := 1
52
53# Add new default target when compiling this platform
54all: bl31
55
56# Build config flags
57# ------------------
58
59# Disable stack protector by default
60ENABLE_STACK_PROTECTOR := 0
61
62# Have different sections for code and rodata
63SEPARATE_CODE_AND_RODATA := 1
64
65# Use Coherent memory
66USE_COHERENT_MEM := 1
67
68# Platform build flags
69# --------------------
70
71# Assume that BL33 isn't the Linux kernel by default
72RPI3_DIRECT_LINUX_BOOT := 0
73
74# BL33 images are in AArch64 by default
75RPI3_BL33_IN_AARCH32 := 0
76
77# UART to use at runtime. -1 means the runtime UART is disabled.
78# Any other value means the default UART will be used.
79RPI3_RUNTIME_UART := 0
80
81# Use normal memory mapping for ROM, FIP, SRAM and DRAM
82RPI3_USE_UEFI_MAP := 0
83
84# Process platform flags
85# ----------------------
86
87$(eval $(call add_define,RPI3_BL33_IN_AARCH32))
88$(eval $(call add_define,RPI3_DIRECT_LINUX_BOOT))
89ifdef RPI3_PRELOADED_DTB_BASE
90$(eval $(call add_define,RPI3_PRELOADED_DTB_BASE))
91endif
92$(eval $(call add_define,RPI3_RUNTIME_UART))
93$(eval $(call add_define,RPI3_USE_UEFI_MAP))
94
95# Verify build config
96# -------------------
97#
98ifneq (${RPI3_DIRECT_LINUX_BOOT}, 0)
99 ifndef RPI3_PRELOADED_DTB_BASE
100 $(error Error: RPI3_PRELOADED_DTB_BASE needed if RPI3_DIRECT_LINUX_BOOT=1)
101 endif
102endif
103
104ifeq (${ARCH},aarch32)
105 $(error Error: AArch32 not supported on rpi4)
106endif
107
108ifneq ($(ENABLE_STACK_PROTECTOR), 0)
109PLAT_BL_COMMON_SOURCES += drivers/rpi3/rng/rpi3_rng.c \
110 plat/rpi/common/rpi3_stack_protector.c
111endif