Platform: STM32H573idk:Port build split update

Change-Id: Ibe6d7cbf7db1b833a9f0fb65b84c657efd10c379
Signed-off-by: Ahmad EL JOUAID <ahmad.eljouaid@st.com>
diff --git a/platform/ext/target/stm/common/stm32h5xx/secure/low_level_device.c b/platform/ext/target/stm/common/stm32h5xx/secure/low_level_device.c
index 13ab0aa..0cf4243 100644
--- a/platform/ext/target/stm/common/stm32h5xx/secure/low_level_device.c
+++ b/platform/ext/target/stm/common/stm32h5xx/secure/low_level_device.c
@@ -6,10 +6,12 @@
   ******************************************************************************
   * @attention
   *
-  * Copyright (c) 2023 STMicroelectronics.
-  * All rights reserved.
+  * <h2><center>&copy; Copyright (c) 2020 STMicroelectronics.
+  * All rights reserved.</center></h2>
+  * <h2><center>&copy; Copyright (c) 2021 Arm Limited.
+  * All rights reserved.</center></h2>
   *
-  * This software component is licensed by ST under BSD 3-Clause license,
+  * This software component is licensed under BSD 3-Clause license,
   * the "License"; You may not use this file except in compliance with the
   * License. You may obtain a copy of the License at:
   *                        opensource.org/licenses/BSD-3-Clause
@@ -17,40 +19,16 @@
   ******************************************************************************
   */
 
-#include "region_defs.h"
+#include "flash_layout.h"
 #include "low_level_flash.h"
-static struct flash_range write_vect[] =
-{
-  { FLASH_NV_COUNTERS_AREA_OFFSET, FLASH_NV_COUNTERS_AREA_OFFSET + FLASH_NV_COUNTERS_AREA_SIZE - 1},
-  { FLASH_PS_AREA_OFFSET, FLASH_PS_AREA_OFFSET + FLASH_PS_AREA_SIZE - 1},
-  { FLASH_ITS_AREA_OFFSET, FLASH_ITS_AREA_OFFSET + FLASH_ITS_AREA_SIZE - 1},
-  /* Area for writing confirm flag on in installed image */
-  { S_IMAGE_PRIMARY_PARTITION_OFFSET + FLASH_S_PARTITION_SIZE - 32, S_IMAGE_PRIMARY_PARTITION_OFFSET + FLASH_S_PARTITION_SIZE - 16 - 1},
-  { NS_IMAGE_PRIMARY_PARTITION_OFFSET + FLASH_NS_PARTITION_SIZE - 32, NS_IMAGE_PRIMARY_PARTITION_OFFSET + FLASH_NS_PARTITION_SIZE - 16 - 1},
-  /* Area for writing secondary images */
-  { S_IMAGE_SECONDARY_PARTITION_OFFSET ,  NS_IMAGE_SECONDARY_PARTITION_OFFSET + FLASH_NS_PARTITION_SIZE - 1}
-};
-static struct flash_range erase_vect[] =
-{
-  { FLASH_NV_COUNTERS_AREA_OFFSET, FLASH_NV_COUNTERS_AREA_OFFSET + FLASH_NV_COUNTERS_AREA_SIZE - 1},
-  { FLASH_PS_AREA_OFFSET, FLASH_PS_AREA_OFFSET + FLASH_PS_AREA_SIZE - 1},
-  { FLASH_ITS_AREA_OFFSET, FLASH_ITS_AREA_OFFSET + FLASH_ITS_AREA_SIZE - 1},
-  /* Area for writing secondary images */
-  { S_IMAGE_SECONDARY_PARTITION_OFFSET ,  NS_IMAGE_SECONDARY_PARTITION_OFFSET + FLASH_NS_PARTITION_SIZE - 1}
+
+struct flash_range nvm_psa_its_vect[] = {
+	{ FLASH_OTP_NV_COUNTERS_AREA_OFFSET, FLASH_ITS_AREA_OFFSET + FLASH_ITS_AREA_SIZE - 1},
 };
 
-static struct flash_range secure_vect[] =
-{
-  { FLASH_NV_COUNTERS_AREA_OFFSET, FLASH_NV_COUNTERS_AREA_OFFSET + FLASH_NV_COUNTERS_AREA_SIZE - 1},
-  { FLASH_PS_AREA_OFFSET, FLASH_PS_AREA_OFFSET + FLASH_PS_AREA_SIZE - 1},
-  { FLASH_ITS_AREA_OFFSET, FLASH_ITS_AREA_OFFSET + FLASH_ITS_AREA_SIZE - 1},
-  /* Area for writing confirm flag on in installed image */
-  { S_IMAGE_PRIMARY_PARTITION_OFFSET + FLASH_S_PARTITION_SIZE - 32, S_IMAGE_PRIMARY_PARTITION_OFFSET + FLASH_S_PARTITION_SIZE -1},
-};
-
-struct low_level_device FLASH0_DEV =
-{
-  .erase = { .nb = sizeof(erase_vect) / sizeof(struct flash_range), .range = erase_vect},
-  .write = { .nb = sizeof(write_vect) / sizeof(struct flash_range), .range = write_vect},
-  .secure ={ .nb = sizeof(secure_vect) / sizeof(struct flash_range), .range = secure_vect}
+struct low_level_device FLASH0_DEV =  {
+	.erase = { .nb =sizeof(nvm_psa_its_vect)/sizeof(struct flash_range), .range = nvm_psa_its_vect},
+	.write = { .nb =sizeof(nvm_psa_its_vect)/sizeof(struct flash_range), .range = nvm_psa_its_vect},
+	.secure = { 0, NULL},
+	.read_error = 1
 };
diff --git a/platform/ext/target/stm/stm32h573i_dk/CMakeLists.txt b/platform/ext/target/stm/stm32h573i_dk/CMakeLists.txt
index a2e92aa..709f567 100644
--- a/platform/ext/target/stm/stm32h573i_dk/CMakeLists.txt
+++ b/platform/ext/target/stm/stm32h573i_dk/CMakeLists.txt
@@ -34,14 +34,18 @@
     )
 endif()
 
-install(FILES ${STM32H573I_DK_DIR}/include/flash_layout.h
-              ${STM32H573I_DK_DIR}/include/region_defs.h
-        DESTINATION  ${CMAKE_BINARY_DIR} )
+install(FILES
+    ${STM32H573I_DK_DIR}/include/flash_layout.h
+    ${STM32H573I_DK_DIR}/include/region_defs.h
+    DESTINATION ${CMAKE_INSTALL_PREFIX}
+)
 set (BL2_FILE_TO_PREPROCESS ${CMAKE_CURRENT_BINARY_DIR}/image_macros_to_preprocess_bl2.c)
 file(WRITE ${BL2_FILE_TO_PREPROCESS} ${BL2_PREPROCESSING})
-install(FILES ${BL2_FILE_TO_PREPROCESS}
-        DESTINATION ${CMAKE_BINARY_DIR} )
 
+install(FILES
+    ${BL2_FILE_TO_PREPROCESS}
+    DESTINATION ${CMAKE_INSTALL_PREFIX}
+)
 ################# Install platform files for NS build #################
 
 # cpuarch.cmake is used to set things that related to the platform that are both