feat(stm32mp2): introduce DDR type compilation flags

Binary size limitation implies to define DDR type build flags.
User must set one single type in the build command line.
DDR_TYPE is then deduced, and will help in relative definitions.
A check routine is implemented to verify correct configuration.

Signed-off-by: Nicolas Le Bayon <nicolas.le.bayon@st.com>
Signed-off-by: Maxime Méré <maxime.mere@foss.st.com>
Change-Id: I87d0a492196efea33831d9c090e6e434cc7c0a1e
This commit is contained in:
Nicolas Le Bayon 2021-07-05 15:23:54 +02:00 committed by Maxime Méré
parent 631c5f86d5
commit d07e9467d3

View file

@ -27,6 +27,20 @@ STM32_HEADER_VERSION_MINOR := 2
# Set load address for serial boot devices # Set load address for serial boot devices
DWL_BUFFER_BASE ?= 0x87000000 DWL_BUFFER_BASE ?= 0x87000000
# DDR types
STM32MP_DDR3_TYPE ?= 0
STM32MP_DDR4_TYPE ?= 0
STM32MP_LPDDR4_TYPE ?= 0
ifeq (${STM32MP_DDR3_TYPE},1)
DDR_TYPE := ddr3
endif
ifeq (${STM32MP_DDR4_TYPE},1)
DDR_TYPE := ddr4
endif
ifeq (${STM32MP_LPDDR4_TYPE},1)
DDR_TYPE := lpddr4
endif
# Device tree # Device tree
BL2_DTSI := stm32mp25-bl2.dtsi BL2_DTSI := stm32mp25-bl2.dtsi
FDT_SOURCES := $(addprefix ${BUILD_PLAT}/fdts/, $(patsubst %.dtb,%-bl2.dts,$(DTB_FILE_NAME))) FDT_SOURCES := $(addprefix ${BUILD_PLAT}/fdts/, $(patsubst %.dtb,%-bl2.dts,$(DTB_FILE_NAME)))
@ -45,6 +59,9 @@ $(eval $(call TOOL_ADD_PAYLOAD,${STM32MP_FW_CONFIG},--fw-config))
# Enable flags for C files # Enable flags for C files
$(eval $(call assert_booleans,\ $(eval $(call assert_booleans,\
$(sort \ $(sort \
STM32MP_DDR3_TYPE \
STM32MP_DDR4_TYPE \
STM32MP_LPDDR4_TYPE \
STM32MP25 \ STM32MP25 \
))) )))
@ -61,6 +78,9 @@ $(eval $(call add_defines,\
PLAT_PARTITION_MAX_ENTRIES \ PLAT_PARTITION_MAX_ENTRIES \
PLAT_TBBR_IMG_DEF \ PLAT_TBBR_IMG_DEF \
STM32_TF_A_COPIES \ STM32_TF_A_COPIES \
STM32MP_DDR3_TYPE \
STM32MP_DDR4_TYPE \
STM32MP_LPDDR4_TYPE \
STM32MP25 \ STM32MP25 \
))) )))
@ -115,4 +135,18 @@ BL31_SOURCES += ${GICV2_SOURCES} \
BL31_SOURCES += plat/common/plat_psci_common.c BL31_SOURCES += plat/common/plat_psci_common.c
# Compilation rules # Compilation rules
.PHONY: check_ddr_type
.SUFFIXES:
bl2: check_ddr_type
check_ddr_type:
$(eval DDR_TYPE = $(shell echo $$(($(STM32MP_DDR3_TYPE) + \
$(STM32MP_DDR4_TYPE) + \
$(STM32MP_LPDDR4_TYPE)))))
@if [ ${DDR_TYPE} != 1 ]; then \
echo "One and only one DDR type must be defined"; \
false; \
fi
include plat/st/common/common_rules.mk include plat/st/common/common_rules.mk