xref: /rk3399_ARM-atf/plat/imx/imx7/warp7/platform.mk (revision 40d553cfde38d4f68449c62967cd1ce0d6478750)
1#
2# Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
7# Architecture
8$(eval $(call add_define,ARMV7_SUPPORTS_LARGE_PAGE_ADDRESSING))
9
10# Tune compiler for Cortex-A7
11ifeq ($(notdir $(CC)),armclang)
12    TF_CFLAGS	+=	-mfpu=neon
13    ASFLAGS	+=	-mfpu=neon
14else ifneq ($(findstring clang,$(notdir $(CC))),)
15    TF_CFLAGS	+=	-mfpu=neon
16    ASFLAGS	+=	-mfpu=neon
17else
18    TF_CFLAGS	+=	-mfpu=neon
19    ASFLAGS	+=	-mfpu=neon
20endif
21
22# Platform
23PLAT_INCLUDES		:=	-Idrivers/imx/uart			\
24				-Iplat/imx/common/include/		\
25				-Iplat/imx/imx7/warp7/include		\
26				-Idrivers/imx/timer			\
27				-Idrivers/imx/usdhc			\
28				-Iplat/imx/imx7/include
29
30# Translation tables library
31include lib/xlat_tables_v2/xlat_tables.mk
32
33BL2_SOURCES		+=	common/desc_image_load.c			\
34				drivers/console/aarch32/console.S		\
35				drivers/delay_timer/delay_timer.c		\
36				drivers/mmc/mmc.c				\
37				drivers/io/io_block.c				\
38				drivers/io/io_fip.c				\
39				drivers/io/io_memmap.c				\
40				drivers/io/io_storage.c				\
41				drivers/imx/timer/imx_gpt.c			\
42				drivers/imx/uart/imx_uart.c			\
43				drivers/imx/uart/imx_crash_uart.S		\
44				drivers/imx/usdhc/imx_usdhc.c			\
45				lib/aarch32/arm32_aeabi_divmod.c		\
46				lib/aarch32/arm32_aeabi_divmod_a32.S		\
47				lib/cpus/aarch32/cortex_a7.S			\
48				lib/optee/optee_utils.c				\
49				plat/imx/common/imx_aips.c			\
50				plat/imx/common/imx_caam.c			\
51				plat/imx/common/imx_clock.c			\
52				plat/imx/common/imx_csu.c			\
53				plat/imx/common/imx_io_mux.c			\
54				plat/imx/common/imx_snvs.c			\
55				plat/imx/common/imx_wdog.c			\
56				plat/imx/common/imx7_clock.c		\
57				plat/imx/imx7/warp7/aarch32/warp7_helpers.S	\
58				plat/imx/imx7/warp7/warp7_bl2_el3_setup.c	\
59				plat/imx/imx7/warp7/warp7_bl2_mem_params_desc.c \
60				plat/imx/imx7/warp7/warp7_io_storage.c		\
61				plat/imx/imx7/warp7/warp7_image_load.c		\
62				plat/imx/common/aarch32/imx_uart_console.S	\
63				${XLAT_TABLES_LIB_SRCS}
64
65ifneq (${TRUSTED_BOARD_BOOT},0)
66
67include drivers/auth/mbedtls/mbedtls_crypto.mk
68include drivers/auth/mbedtls/mbedtls_x509.mk
69
70AUTH_SOURCES	:=	drivers/auth/auth_mod.c			\
71			drivers/auth/crypto_mod.c		\
72			drivers/auth/img_parser_mod.c		\
73			drivers/auth/tbbr/tbbr_cot.c
74
75BL2_SOURCES		+=	${AUTH_SOURCES}					\
76				plat/common/tbbr/plat_tbbr.c			\
77				plat/imx/imx7/warp7/warp7_trusted_boot.c	\
78				plat/imx/imx7/warp7/warp7_rotpk.S
79
80ROT_KEY             = $(BUILD_PLAT)/rot_key.pem
81ROTPK_HASH          = $(BUILD_PLAT)/rotpk_sha256.bin
82
83$(eval $(call add_define_val,ROTPK_HASH,'"$(ROTPK_HASH)"'))
84$(eval $(call MAKE_LIB_DIRS))
85
86$(BUILD_PLAT)/bl2/warp7_rotpk.o: $(ROTPK_HASH)
87
88certificates: $(ROT_KEY)
89
90$(ROT_KEY): | $(BUILD_PLAT)
91	@echo "  OPENSSL $@"
92	@if [ ! -f $(ROT_KEY) ]; then \
93		openssl genrsa 2048 > $@ 2>/dev/null; \
94	fi
95
96$(ROTPK_HASH): $(ROT_KEY)
97	@echo "  OPENSSL $@"
98	$(Q)openssl rsa -in $< -pubout -outform DER 2>/dev/null |\
99	openssl dgst -sha256 -binary > $@ 2>/dev/null
100endif
101
102# Build config flags
103# ------------------
104
105WORKAROUND_CVE_2017_5715	:= 0
106
107# Enable reset to BL31 by default
108RESET_TO_BL31			:= 0
109
110# Non-TF Boot ROM
111BL2_AT_EL3			:= 1
112
113# Indicate single-core
114COLD_BOOT_SINGLE_CPU		:= 1
115
116# Have different sections for code and rodata
117SEPARATE_CODE_AND_RODATA	:= 1
118
119# Use Coherent memory
120USE_COHERENT_MEM		:= 1
121
122# Use multi console API
123MULTI_CONSOLE_API               := 1
124
125# PLAT_WARP7_UART
126PLAT_WARP7_UART			:=1
127$(eval $(call add_define,PLAT_WARP7_UART))
128
129# Add the build options to pack BLx images and kernel device tree
130# in the FIP if the platform requires.
131ifneq ($(BL2),)
132$(eval $(call TOOL_ADD_PAYLOAD,${BUILD_PLAT}/tb_fw.crt,--tb-fw-cert))
133endif
134ifneq ($(BL32_EXTRA1),)
135$(eval $(call TOOL_ADD_IMG,BL32_EXTRA1,--tos-fw-extra1))
136endif
137ifneq ($(BL32_EXTRA2),)
138$(eval $(call TOOL_ADD_IMG,BL32_EXTRA2,--tos-fw-extra2))
139endif
140ifneq ($(HW_CONFIG),)
141$(eval $(call TOOL_ADD_IMG,HW_CONFIG,--hw-config))
142endif
143
144# Verify build config
145# -------------------
146
147ifeq (${ARCH},aarch64)
148  $(error Error: AArch64 not supported on i.mx7)
149endif
150