xref: /rk3399_ARM-atf/plat/amlogic/gxl/platform.mk (revision bba792b1652e027c15acb3ff4fa700c878a3d3fd)
1#
2# Copyright (c) 2018-2024, Arm Limited and Contributors. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
7include lib/xlat_tables_v2/xlat_tables.mk
8
9AML_PLAT		:=	plat/amlogic
10AML_PLAT_SOC		:=	${AML_PLAT}/${PLAT}
11AML_PLAT_COMMON		:=	${AML_PLAT}/common
12
13DOIMAGEPATH		?=	tools/amlogic
14DOIMAGETOOL		?=	${DOIMAGEPATH}/doimage
15
16PLAT_INCLUDES		:=	-Iinclude/drivers/amlogic/			\
17				-I${AML_PLAT_SOC}/include			\
18				-I${AML_PLAT_COMMON}/include
19
20GIC_SOURCES		:=	drivers/arm/gic/common/gic_common.c		\
21				drivers/arm/gic/v2/gicv2_main.c			\
22				drivers/arm/gic/v2/gicv2_helpers.c		\
23				plat/common/plat_gicv2.c
24
25BL31_SOURCES		+=	lib/cpus/aarch64/cortex_a53.S			\
26				plat/common/plat_psci_common.c			\
27				drivers/amlogic/console/aarch64/meson_console.S	\
28				${AML_PLAT_SOC}/${PLAT}_bl31_setup.c		\
29				${AML_PLAT_SOC}/${PLAT}_pm.c			\
30				${AML_PLAT_SOC}/${PLAT}_common.c		\
31				${AML_PLAT_COMMON}/aarch64/aml_helpers.S	\
32				${AML_PLAT_COMMON}/aml_efuse.c			\
33				${AML_PLAT_COMMON}/aml_mhu.c			\
34				${AML_PLAT_COMMON}/aml_scpi.c			\
35				${AML_PLAT_COMMON}/aml_sip_svc.c		\
36				${AML_PLAT_COMMON}/aml_thermal.c		\
37				${AML_PLAT_COMMON}/aml_topology.c		\
38				${AML_PLAT_COMMON}/aml_console.c		\
39				drivers/amlogic/crypto/sha_dma.c		\
40				${XLAT_TABLES_LIB_SRCS}				\
41				${GIC_SOURCES}
42
43ifeq (${AML_STDPARAMS}, 1)
44    BL31_SOURCES	+=	common/desc_image_load.c
45    $(eval $(call add_define_val,AML_STDPARAMS,'$(AML_STDPARAMS)'))
46    $(info "Building with standard params")
47endif
48
49# Tune compiler for Cortex-A53
50ifeq ($($(ARCH)-cc-id),arm-clang)
51    TF_CFLAGS_aarch64	+=	-mcpu=cortex-a53
52else ifneq ($(filter %-clang,$($(ARCH)-cc-id)),)
53    TF_CFLAGS_aarch64	+=	-mcpu=cortex-a53
54else
55    TF_CFLAGS_aarch64	+=	-mtune=cortex-a53
56endif
57
58# Build config flags
59# ------------------
60
61# Enable all errata workarounds for Cortex-A53
62ERRATA_A53_855873		:= 1
63ERRATA_A53_819472		:= 1
64ERRATA_A53_824069		:= 1
65ERRATA_A53_827319		:= 1
66
67WORKAROUND_CVE_2017_5715	:= 0
68
69# Have different sections for code and rodata
70SEPARATE_CODE_AND_RODATA	:= 1
71
72# Use Coherent memory
73USE_COHERENT_MEM		:= 1
74
75# Verify build config
76# -------------------
77
78ifneq (${RESET_TO_BL31}, 0)
79  $(error Error: ${PLAT} needs RESET_TO_BL31=0)
80endif
81
82ifeq (${ARCH},aarch32)
83  $(error Error: AArch32 not supported on ${PLAT})
84endif
85
86all: ${BUILD_PLAT}/bl31.img
87distclean realclean clean: cleanimage
88
89cleanimage:
90	$(q)${MAKE} -C ${DOIMAGEPATH} clean
91
92${DOIMAGETOOL}:
93	$(q)${MAKE} -C ${DOIMAGEPATH}
94
95${BUILD_PLAT}/bl31.img: ${BUILD_PLAT}/bl31.bin ${DOIMAGETOOL}
96	${DOIMAGETOOL} ${BUILD_PLAT}/bl31.bin ${BUILD_PLAT}/bl31.img
97