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