]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
stm32mp1: sort platform.mk
authorYann Gautier <yann.gautier@st.com>
Wed, 12 Feb 2020 08:30:49 +0000 (09:30 +0100)
committerManish Pandey <manish.pandey2@arm.com>
Fri, 9 Oct 2020 09:24:40 +0000 (09:24 +0000)
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: Yann Gautier <yann.gautier@st.com>
plat/st/stm32mp1/platform.mk

index 54f832a34752662b774fb4700f69081c4d523505..f71b080d71a68b2ff72b3cd5255dd662ed26b989 100644 (file)
@@ -13,8 +13,6 @@ STM32_TF_VERSION      ?=      0
 
 # Enable dynamic memory mapping
 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)
 # Disable Neon support: sp_min runtime may conflict with non-secure world
@@ -26,13 +24,11 @@ WORKAROUND_CVE_2017_5715:=  0
 
 # Number of TF-A copies in the device
 STM32_TF_A_COPIES              :=      2
-$(eval $(call add_define,STM32_TF_A_COPIES))
 ifeq ($(AARCH32_SP),optee)
 PLAT_PARTITION_MAX_ENTRIES     :=      $(shell echo $$(($(STM32_TF_A_COPIES) + 4)))
 else
 PLAT_PARTITION_MAX_ENTRIES     :=      $(shell echo $$(($(STM32_TF_A_COPIES) + 1)))
 endif
-$(eval $(call add_define,PLAT_PARTITION_MAX_ENTRIES))
 
 # Boot devices
 STM32MP_EMMC           ?=      0
@@ -46,32 +42,60 @@ ifeq ($(filter 1,${STM32MP_EMMC} ${STM32MP_SDMMC} ${STM32MP_RAW_NAND} \
 $(error "No boot device driver is enabled")
 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,\
-    $(sort \
-        STM32MP_EMMC \
-        STM32MP_SDMMC \
-        STM32MP_RAW_NAND \
-        STM32MP_SPI_NAND \
-        STM32MP_SPI_NOR \
+       $(sort \
+               STM32MP_EMMC \
+               STM32MP_SDMMC \
+               STM32MP_RAW_NAND \
+               STM32MP_SPI_NAND \
+               STM32MP_SPI_NOR \
+               PLAT_XLAT_TABLES_DYNAMIC \
+)))
+
+$(eval $(call assert_numerics,\
+       $(sort \
+               STM32_TF_A_COPIES \
+               PLAT_PARTITION_MAX_ENTRIES \
 )))
 
 $(eval $(call add_defines,\
-    $(sort \
-        STM32MP_EMMC \
-        STM32MP_SDMMC \
-        STM32MP_RAW_NAND \
-        STM32MP_SPI_NAND \
-        STM32MP_SPI_NOR \
+       $(sort \
+               STM32MP_EMMC \
+               STM32MP_SDMMC \
+               STM32MP_RAW_NAND \
+               STM32MP_SPI_NAND \
+               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/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
 
 PLAT_BL_COMMON_SOURCES :=      common/fdt_wrappers.c                                   \
@@ -165,27 +189,12 @@ ifeq ($(AARCH32_SP),optee)
 BL2_SOURCES            +=      lib/optee/optee_utils.c
 endif
 
-# 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
-
-# Variables for use with stm32image
-STM32IMAGEPATH         ?= tools/stm32image
-STM32IMAGE             ?= ${STM32IMAGEPATH}/stm32image${BIN_EXT}
-
-.PHONY:                        check_dtc_version stm32image clean_stm32image
+# Compilation rules
+.PHONY: check_dtc_version stm32image clean_stm32image
 .SUFFIXES:
 
 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
 
 stm32image: