feat(stm32mp1): add support for building the FWU feature

Add support for enabling the FWU multi bank boot feature on the
platform.

Currently, this feature is supported on the STM32MP157C-DK2 board,
which boots off a uSD card. Also, support has been enabled when
booting from a FIP image.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Change-Id: Ia69e858461e2daf599d41d66d7ff2ccae0c341c2
diff --git a/plat/st/stm32mp1/platform.mk b/plat/st/stm32mp1/platform.mk
index 13dea2a..6f7c79b 100644
--- a/plat/st/stm32mp1/platform.mk
+++ b/plat/st/stm32mp1/platform.mk
@@ -38,8 +38,22 @@
 # Not needed for Cortex-A7
 WORKAROUND_CVE_2017_5715:=	0
 
+ifeq (${PSA_FWU_SUPPORT},1)
+ifneq (${STM32MP_USE_STM32IMAGE},1)
+# Number of banks of updatable firmware
+NR_OF_FW_BANKS			:=	2
+NR_OF_IMAGES_IN_FW_BANK		:=	1
+
 # Number of TF-A copies in the device
 STM32_TF_A_COPIES		:=	2
+STM32_BL33_PARTS_NUM		:=	2
+STM32_RUNTIME_PARTS_NUM		:=	4
+else
+$(error FWU Feature enabled only with FIP images)
+endif
+else
+# Number of TF-A copies in the device
+STM32_TF_A_COPIES		:=	2
 STM32_BL33_PARTS_NUM		:=	1
 ifeq ($(AARCH32_SP),optee)
 STM32_RUNTIME_PARTS_NUM		:=	3
@@ -48,6 +62,7 @@
 else
 STM32_RUNTIME_PARTS_NUM		:=	1
 endif
+endif
 PLAT_PARTITION_MAX_ENTRIES	:=	$(shell echo $$(($(STM32_TF_A_COPIES) + \
 							 $(STM32_BL33_PARTS_NUM) + \
 							 $(STM32_RUNTIME_PARTS_NUM))))
@@ -237,6 +252,13 @@
 				plat/st/stm32mp1/stm32mp1_security.c
 endif
 
+ifeq (${PSA_FWU_SUPPORT},1)
+include lib/zlib/zlib.mk
+include drivers/fwu/fwu.mk
+
+BL2_SOURCES		+=	$(ZLIB_SOURCES)
+endif
+
 BL2_SOURCES		+=	drivers/io/io_block.c					\
 				drivers/io/io_mtd.c					\
 				drivers/io/io_storage.c					\