xref: /rk3399_ARM-atf/plat/st/stm32mp2/platform.mk (revision 5e0be8c0241e5075b34bd5b14df2df9f048715d3)
1#
2# Copyright (c) 2023-2024, STMicroelectronics - All Rights Reserved
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
7# Extra partitions used to find FIP, contains:
8# metadata (2) and fsbl-m (2) and the FIP partitions (default is 2).
9STM32_EXTRA_PARTS		:=	6
10
11include plat/st/common/common.mk
12
13CRASH_REPORTING			:=	1
14ENABLE_PIE			:=	1
15PROGRAMMABLE_RESET_ADDRESS	:=	1
16BL2_IN_XIP_MEM			:=	1
17
18# Default Device tree
19DTB_FILE_NAME			?=	stm32mp257f-ev1.dtb
20
21STM32MP25			:=	1
22
23# STM32 image header version v2.2
24STM32_HEADER_VERSION_MAJOR	:=	2
25STM32_HEADER_VERSION_MINOR	:=	2
26
27# Set load address for serial boot devices
28DWL_BUFFER_BASE 		?=	0x87000000
29
30# Device tree
31BL2_DTSI			:=	stm32mp25-bl2.dtsi
32FDT_SOURCES			:=	$(addprefix ${BUILD_PLAT}/fdts/, $(patsubst %.dtb,%-bl2.dts,$(DTB_FILE_NAME)))
33
34# Macros and rules to build TF binary
35STM32_TF_STM32			:=	$(addprefix ${BUILD_PLAT}/tf-a-, $(patsubst %.dtb,%.stm32,$(DTB_FILE_NAME)))
36STM32_LD_FILE			:=	plat/st/stm32mp2/${ARCH}/stm32mp2.ld.S
37STM32_BINARY_MAPPING		:=	plat/st/stm32mp2/${ARCH}/stm32mp2.S
38
39# Enable flags for C files
40$(eval $(call assert_booleans,\
41	$(sort \
42		STM32MP25 \
43)))
44
45$(eval $(call assert_numerics,\
46	$(sort \
47		PLAT_PARTITION_MAX_ENTRIES \
48		STM32_HEADER_VERSION_MAJOR \
49		STM32_TF_A_COPIES \
50)))
51
52$(eval $(call add_defines,\
53	$(sort \
54		DWL_BUFFER_BASE \
55		PLAT_PARTITION_MAX_ENTRIES \
56		PLAT_TBBR_IMG_DEF \
57		STM32_TF_A_COPIES \
58		STM32MP25 \
59)))
60
61# STM32MP2x is based on Cortex-A35, which is Armv8.0, and does not support BTI
62# Disable mbranch-protection to avoid adding useless code
63TF_CFLAGS			+=	-mbranch-protection=none
64
65# Include paths and source files
66PLAT_INCLUDES			+=	-Iplat/st/stm32mp2/include/
67
68PLAT_BL_COMMON_SOURCES		+=	lib/cpus/${ARCH}/cortex_a35.S
69PLAT_BL_COMMON_SOURCES		+=	drivers/st/uart/${ARCH}/stm32_console.S
70PLAT_BL_COMMON_SOURCES		+=	plat/st/stm32mp2/${ARCH}/stm32mp2_helper.S
71
72PLAT_BL_COMMON_SOURCES		+=	plat/st/stm32mp2/stm32mp2_private.c
73
74PLAT_BL_COMMON_SOURCES		+=	drivers/st/bsec/bsec3.c					\
75					drivers/st/reset/stm32mp2_reset.c			\
76					plat/st/stm32mp2/stm32mp2_syscfg.c
77
78PLAT_BL_COMMON_SOURCES		+=	drivers/st/clk/clk-stm32-core.c				\
79					drivers/st/clk/clk-stm32mp2.c
80
81BL2_SOURCES			+=	plat/st/stm32mp2/plat_bl2_mem_params_desc.c
82
83BL2_SOURCES			+=	plat/st/stm32mp2/bl2_plat_setup.c
84
85ifneq ($(filter 1,${STM32MP_EMMC} ${STM32MP_SDMMC}),)
86BL2_SOURCES			+=	drivers/st/mmc/stm32_sdmmc2.c
87endif
88
89ifeq (${STM32MP_USB_PROGRAMMER},1)
90BL2_SOURCES			+=	plat/st/stm32mp2/stm32mp2_usb_dfu.c
91endif
92
93BL2_SOURCES			+=	drivers/st/ddr/stm32mp2_ddr_helpers.c
94
95# Compilation rules
96include plat/st/common/common_rules.mk
97