Build: add cmake property to manage BL2_TRAILER_SIZE

Add cmake property to manage the trailer size in the code
and during the images building. If needed, a platform can
change this value in its config file.

Change-Id: Ifeed6ca2bf9a15c0f78880902f6cba8b0f9ed602
Signed-off-by: Ludovic Barre <ludovic.barre@foss.st.com>
diff --git a/bl2/ext/mcuboot/mcuboot_default_config.cmake b/bl2/ext/mcuboot/mcuboot_default_config.cmake
index 6f15591..593971a 100644
--- a/bl2/ext/mcuboot/mcuboot_default_config.cmake
+++ b/bl2/ext/mcuboot/mcuboot_default_config.cmake
@@ -16,6 +16,7 @@
 set(MCUBOOT_HW_KEY                      ON          CACHE BOOL      "Whether to embed the entire public key in the image metadata instead of the hash only")
 set(MCUBOOT_UPGRADE_STRATEGY            "OVERWRITE_ONLY" CACHE STRING "Upgrade strategy for images")
 set(BL2_HEADER_SIZE                     0x400       CACHE STRING    "Header size")
+set(BL2_TRAILER_SIZE                    0x400       CACHE STRING    "Trailer size")
 
 # Specifying a scope of the accepted values of MCUBOOT_UPGRADE_STRATEGY for
 # platforms to choose a specific upgrade strategy for images. These certain
diff --git a/config/config_default.cmake b/config/config_default.cmake
index 31e643b..a6d4f97 100755
--- a/config/config_default.cmake
+++ b/config/config_default.cmake
@@ -10,6 +10,7 @@
 set(CROSS_COMPILE                       arm-none-eabi CACHE STRING  "Cross-compilation triplet")
 
 set(BL2_HEADER_SIZE                     0x000       CACHE STRING    "Header size")
+set(BL2_TRAILER_SIZE                    0x000       CACHE STRING    "Trailer size")
 set(NS                                  ON          CACHE BOOL      "Whether to build NS app")
 
 set(TEST_S                              OFF         CACHE BOOL      "Whether to build S regression tests")
diff --git a/platform/CMakeLists.txt b/platform/CMakeLists.txt
index a5b09fd..599927d 100755
--- a/platform/CMakeLists.txt
+++ b/platform/CMakeLists.txt
@@ -166,6 +166,7 @@
         $<$<BOOL:${BL1}>:BL1>
         $<$<BOOL:${BL2}>:BL2>
         BL2_HEADER_SIZE=${BL2_HEADER_SIZE}
+        BL2_TRAILER_SIZE=${BL2_TRAILER_SIZE}
         $<$<BOOL:${SECURE_UART1}>:SECURE_UART1>
         DAUTH_${DEBUG_AUTHENTICATION}
         $<$<BOOL:${MCUBOOT_IMAGE_NUMBER}>:MCUBOOT_IMAGE_NUMBER=${MCUBOOT_IMAGE_NUMBER}>