Commit 2eaffd51 authored by Yann Gautier's avatar Yann Gautier Committed by Manish Pandey
Browse files

stm32mp1: sort platform.mk



First put Makefile variables definition, then definitions for each feature,
then C flags, then source files, then compilation rules.

Change-Id: I238115ea2fe4ebafccd2135979814c27932c34e2
Signed-off-by: default avatarYann Gautier <yann.gautier@st.com>
parent 49e2373c
...@@ -13,8 +13,6 @@ STM32_TF_VERSION ?= 0 ...@@ -13,8 +13,6 @@ STM32_TF_VERSION ?= 0
# Enable dynamic memory mapping # Enable dynamic memory mapping
PLAT_XLAT_TABLES_DYNAMIC := 1 PLAT_XLAT_TABLES_DYNAMIC := 1
$(eval $(call assert_boolean,PLAT_XLAT_TABLES_DYNAMIC))
$(eval $(call add_define,PLAT_XLAT_TABLES_DYNAMIC))
ifeq ($(AARCH32_SP),sp_min) ifeq ($(AARCH32_SP),sp_min)
# Disable Neon support: sp_min runtime may conflict with non-secure world # Disable Neon support: sp_min runtime may conflict with non-secure world
...@@ -26,13 +24,11 @@ WORKAROUND_CVE_2017_5715:= 0 ...@@ -26,13 +24,11 @@ WORKAROUND_CVE_2017_5715:= 0
# Number of TF-A copies in the device # Number of TF-A copies in the device
STM32_TF_A_COPIES := 2 STM32_TF_A_COPIES := 2
$(eval $(call add_define,STM32_TF_A_COPIES))
ifeq ($(AARCH32_SP),optee) ifeq ($(AARCH32_SP),optee)
PLAT_PARTITION_MAX_ENTRIES := $(shell echo $$(($(STM32_TF_A_COPIES) + 4))) PLAT_PARTITION_MAX_ENTRIES := $(shell echo $$(($(STM32_TF_A_COPIES) + 4)))
else else
PLAT_PARTITION_MAX_ENTRIES := $(shell echo $$(($(STM32_TF_A_COPIES) + 1))) PLAT_PARTITION_MAX_ENTRIES := $(shell echo $$(($(STM32_TF_A_COPIES) + 1)))
endif endif
$(eval $(call add_define,PLAT_PARTITION_MAX_ENTRIES))
# Boot devices # Boot devices
STM32MP_EMMC ?= 0 STM32MP_EMMC ?= 0
...@@ -46,6 +42,28 @@ ifeq ($(filter 1,${STM32MP_EMMC} ${STM32MP_SDMMC} ${STM32MP_RAW_NAND} \ ...@@ -46,6 +42,28 @@ ifeq ($(filter 1,${STM32MP_EMMC} ${STM32MP_SDMMC} ${STM32MP_RAW_NAND} \
$(error "No boot device driver is enabled") $(error "No boot device driver is enabled")
endif endif
# Device tree
DTB_FILE_NAME ?= stm32mp157c-ev1.dtb
FDT_SOURCES := $(addprefix fdts/, $(patsubst %.dtb,%.dts,$(DTB_FILE_NAME)))
DTC_FLAGS += -Wno-unit_address_vs_reg
# Macros and rules to build TF binary
STM32_TF_ELF_LDFLAGS := --hash-style=gnu --as-needed
STM32_TF_STM32 := $(addprefix ${BUILD_PLAT}/tf-a-, $(patsubst %.dtb,%.stm32,$(DTB_FILE_NAME)))
STM32_TF_LINKERFILE := ${BUILD_PLAT}/stm32mp1.ld
ASFLAGS += -DBL2_BIN_PATH=\"${BUILD_PLAT}/bl2.bin\"
ifeq ($(AARCH32_SP),sp_min)
# BL32 is built only if using SP_MIN
BL32_DEP := bl32
ASFLAGS += -DBL32_BIN_PATH=\"${BUILD_PLAT}/bl32.bin\"
endif
# Variables for use with stm32image
STM32IMAGEPATH ?= tools/stm32image
STM32IMAGE ?= ${STM32IMAGEPATH}/stm32image${BIN_EXT}
# Enable flags for C files
$(eval $(call assert_booleans,\ $(eval $(call assert_booleans,\
$(sort \ $(sort \
STM32MP_EMMC \ STM32MP_EMMC \
...@@ -53,6 +71,13 @@ $(eval $(call assert_booleans,\ ...@@ -53,6 +71,13 @@ $(eval $(call assert_booleans,\
STM32MP_RAW_NAND \ STM32MP_RAW_NAND \
STM32MP_SPI_NAND \ STM32MP_SPI_NAND \
STM32MP_SPI_NOR \ STM32MP_SPI_NOR \
PLAT_XLAT_TABLES_DYNAMIC \
)))
$(eval $(call assert_numerics,\
$(sort \
STM32_TF_A_COPIES \
PLAT_PARTITION_MAX_ENTRIES \
))) )))
$(eval $(call add_defines,\ $(eval $(call add_defines,\
...@@ -62,16 +87,15 @@ $(eval $(call add_defines,\ ...@@ -62,16 +87,15 @@ $(eval $(call add_defines,\
STM32MP_RAW_NAND \ STM32MP_RAW_NAND \
STM32MP_SPI_NAND \ STM32MP_SPI_NAND \
STM32MP_SPI_NOR \ STM32MP_SPI_NOR \
PLAT_XLAT_TABLES_DYNAMIC \
STM32_TF_A_COPIES \
PLAT_PARTITION_MAX_ENTRIES \
))) )))
# Include paths and source files
PLAT_INCLUDES := -Iplat/st/common/include/ PLAT_INCLUDES := -Iplat/st/common/include/
PLAT_INCLUDES += -Iplat/st/stm32mp1/include/ PLAT_INCLUDES += -Iplat/st/stm32mp1/include/
# Device tree
DTB_FILE_NAME ?= stm32mp157c-ev1.dtb
FDT_SOURCES := $(addprefix fdts/, $(patsubst %.dtb,%.dts,$(DTB_FILE_NAME)))
DTC_FLAGS += -Wno-unit_address_vs_reg
include lib/libfdt/libfdt.mk include lib/libfdt/libfdt.mk
PLAT_BL_COMMON_SOURCES := common/fdt_wrappers.c \ PLAT_BL_COMMON_SOURCES := common/fdt_wrappers.c \
...@@ -165,27 +189,12 @@ ifeq ($(AARCH32_SP),optee) ...@@ -165,27 +189,12 @@ ifeq ($(AARCH32_SP),optee)
BL2_SOURCES += lib/optee/optee_utils.c BL2_SOURCES += lib/optee/optee_utils.c
endif endif
# Macros and rules to build TF binary # Compilation rules
STM32_TF_ELF_LDFLAGS := --hash-style=gnu --as-needed
STM32_TF_STM32 := $(addprefix ${BUILD_PLAT}/tf-a-, $(patsubst %.dtb,%.stm32,$(DTB_FILE_NAME)))
STM32_TF_LINKERFILE := ${BUILD_PLAT}/stm32mp1.ld
# Variables for use with stm32image
STM32IMAGEPATH ?= tools/stm32image
STM32IMAGE ?= ${STM32IMAGEPATH}/stm32image${BIN_EXT}
.PHONY: check_dtc_version stm32image clean_stm32image .PHONY: check_dtc_version stm32image clean_stm32image
.SUFFIXES: .SUFFIXES:
all: check_dtc_version ${STM32_TF_STM32} stm32image all: check_dtc_version ${STM32_TF_STM32} stm32image
ASFLAGS += -DBL2_BIN_PATH=\"${BUILD_PLAT}/bl2.bin\"
ifeq ($(AARCH32_SP),sp_min)
# BL32 is built only if using SP_MIN
BL32_DEP := bl32
ASFLAGS += -DBL32_BIN_PATH=\"${BUILD_PLAT}/bl32.bin\"
endif
distclean realclean clean: clean_stm32image distclean realclean clean: clean_stm32image
stm32image: stm32image:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment