blob: c9cda3ec6602e95b18fb206c9b1ddfa2f1b153fa [file] [log] [blame]
Yann Gautier35527fb2023-06-14 10:40:59 +02001#
Yann Gautier197ac782024-01-03 14:28:23 +01002# Copyright (c) 2023-2024, STMicroelectronics - All Rights Reserved
Yann Gautier35527fb2023-06-14 10:40:59 +02003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
Yann Gautier66b4c5c2023-01-05 14:34:37 +01007# 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
Yann Gautier35527fb2023-06-14 10:40:59 +020011include plat/st/common/common.mk
12
13CRASH_REPORTING := 1
14ENABLE_PIE := 1
15PROGRAMMABLE_RESET_ADDRESS := 1
Yann Gautierdb77f8b2024-05-21 11:46:59 +020016BL2_IN_XIP_MEM := 1
Yann Gautier35527fb2023-06-14 10:40:59 +020017
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
Yann Gautier2e905c02024-02-02 17:07:20 +010027# Set load address for serial boot devices
Yann Gautierdb77f8b2024-05-21 11:46:59 +020028DWL_BUFFER_BASE ?= 0x87000000
Yann Gautier2e905c02024-02-02 17:07:20 +010029
Yann Gautiere5839ed2023-06-14 18:44:41 +020030# 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
Yann Gautierdb77f8b2024-05-21 11:46:59 +020039# 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
Yann Gautier2e905c02024-02-02 17:07:20 +010052$(eval $(call add_defines,\
53 $(sort \
54 DWL_BUFFER_BASE \
Yann Gautierdb77f8b2024-05-21 11:46:59 +020055 PLAT_PARTITION_MAX_ENTRIES \
56 PLAT_TBBR_IMG_DEF \
57 STM32_TF_A_COPIES \
58 STM32MP25 \
Yann Gautier2e905c02024-02-02 17:07:20 +010059)))
60
Yann Gautier35527fb2023-06-14 10:40:59 +020061# 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
Yann Gautier87a940e2023-06-14 18:05:47 +020069PLAT_BL_COMMON_SOURCES += drivers/st/uart/${ARCH}/stm32_console.S
Yann Gautier35527fb2023-06-14 10:40:59 +020070PLAT_BL_COMMON_SOURCES += plat/st/stm32mp2/${ARCH}/stm32mp2_helper.S
71
Yann Gautierdb77f8b2024-05-21 11:46:59 +020072PLAT_BL_COMMON_SOURCES += plat/st/stm32mp2/stm32mp2_private.c
73
Gabriel Fernandezf829d7d2022-04-20 10:08:08 +020074PLAT_BL_COMMON_SOURCES += drivers/st/bsec/bsec3.c \
Yann Gautier154e6e62024-05-21 12:05:43 +020075 drivers/st/reset/stm32mp2_reset.c \
76 plat/st/stm32mp2/stm32mp2_syscfg.c
Yann Gautier197ac782024-01-03 14:28:23 +010077
Gabriel Fernandez615f31f2022-04-20 10:08:49 +020078PLAT_BL_COMMON_SOURCES += drivers/st/clk/clk-stm32-core.c \
79 drivers/st/clk/clk-stm32mp2.c
80
Yann Gautier35527fb2023-06-14 10:40:59 +020081BL2_SOURCES += plat/st/stm32mp2/plat_bl2_mem_params_desc.c
Yann Gautierdb77f8b2024-05-21 11:46:59 +020082
Yann Gautier35527fb2023-06-14 10:40:59 +020083BL2_SOURCES += plat/st/stm32mp2/bl2_plat_setup.c
84
Yann Gautierdb77f8b2024-05-21 11:46:59 +020085ifneq ($(filter 1,${STM32MP_EMMC} ${STM32MP_SDMMC}),)
86BL2_SOURCES += drivers/st/mmc/stm32_sdmmc2.c
87endif
88
Yann Gautier2e905c02024-02-02 17:07:20 +010089ifeq (${STM32MP_USB_PROGRAMMER},1)
90BL2_SOURCES += plat/st/stm32mp2/stm32mp2_usb_dfu.c
91endif
92
Yann Gautier5e0be8c2024-05-21 20:54:04 +020093BL2_SOURCES += drivers/st/ddr/stm32mp2_ddr_helpers.c
94
Yann Gautierdb77f8b2024-05-21 11:46:59 +020095# Compilation rules
Yann Gautier35527fb2023-06-14 10:40:59 +020096include plat/st/common/common_rules.mk