Build: Convert stm targets to modern cmake

Add cmake files to stm vendor directory. Alter scatter files to
remove preprocessor shebang. Alter header files where include paths have
changed.

WARNING: This change will not build in isolation, it requires _all_
other cmake changes to successfully build. It is split out only for ease
of understanding.

Change-Id: Ic0ff1e22c5594e68b637c4921f4680551d8ec213
Signed-off-by: Michel Jaouen <michel.jaouen@st.com>
Signed-off-by: Balint Matyi <Balint.Matyi@arm.com>
Signed-off-by: Raef Coles <raef.coles@arm.com>
Signed-off-by: Anton Komlev <anton.komlev@arm.com>
diff --git a/platform/ext/stm.cmake b/platform/ext/stm.cmake
deleted file mode 100644
index 42aa597..0000000
--- a/platform/ext/stm.cmake
+++ /dev/null
@@ -1,17 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2020, STMicroelectronics - All Rights Reserved
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-#This file gathers all target of stm.
-
-set(PLATFORM_DIR ${CMAKE_CURRENT_LIST_DIR})
-
-if(${TARGET_PLATFORM} STREQUAL "STM_DISCO_L562QE")
-	include("${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l562e_dk.cmake")
-elseif(${TARGET_PLATFORM} STREQUAL "STM_NUCLEO_L552ZE_Q")
-	include("${PLATFORM_DIR}/target/stm/stm32l5xx/nucleo_l552ze_q.cmake")
-else()
-	message(FATAL_ERROR "ERROR: Target \"${TARGET_PLATFORM}\" is not supported.")
-endif()
\ No newline at end of file
diff --git a/platform/ext/target/stm/stm32l5xx/CMSIS_Driver/low_level_com.c b/platform/ext/target/stm/common/stm32l5xx/CMSIS_Driver/low_level_com.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/CMSIS_Driver/low_level_com.c
rename to platform/ext/target/stm/common/stm32l5xx/CMSIS_Driver/low_level_com.c
diff --git a/platform/ext/target/stm/stm32l5xx/CMSIS_Driver/low_level_flash.c b/platform/ext/target/stm/common/stm32l5xx/CMSIS_Driver/low_level_flash.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/CMSIS_Driver/low_level_flash.c
rename to platform/ext/target/stm/common/stm32l5xx/CMSIS_Driver/low_level_flash.c
diff --git a/platform/ext/target/stm/stm32l5xx/CMSIS_Driver/low_level_flash.h b/platform/ext/target/stm/common/stm32l5xx/CMSIS_Driver/low_level_flash.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/CMSIS_Driver/low_level_flash.h
rename to platform/ext/target/stm/common/stm32l5xx/CMSIS_Driver/low_level_flash.h
diff --git a/platform/ext/target/stm/common/stm32l5xx/CMakeLists.txt b/platform/ext/target/stm/common/stm32l5xx/CMakeLists.txt
new file mode 100644
index 0000000..175e55f
--- /dev/null
+++ b/platform/ext/target/stm/common/stm32l5xx/CMakeLists.txt
@@ -0,0 +1,235 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+cmake_policy(SET CMP0076 NEW)
+set(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR})
+
+#========================= Platform region defs ===============================#
+
+target_include_directories(platform_region_defs
+    INTERFACE
+        include
+        ${CMAKE_CURRENT_SOURCE_DIR}/boards
+)
+
+target_compile_definitions(platform_region_defs
+    INTERFACE
+        $<$<OR:$<BOOL:${TEST_NS}>,$<BOOL:${TEST_S}>>:FLASH_LAYOUT_FOR_TEST>
+)
+
+#========================= Platform common defs ===============================#
+target_add_scatter_file(tfm_s
+    $<$<C_COMPILER_ID:GNU>:${CMAKE_BINARY_DIR}/generated/platform/ext/common/gcc/tfm_common_s.ld>
+    $<$<C_COMPILER_ID:ARMClang>:${CMAKE_BINARY_DIR}/generated/platform/ext/common/armclang/tfm_common_s.sct>
+    $<$<C_COMPILER_ID:IAR>:${CMAKE_BINARY_DIR}/generated/platform/ext/common/iar/tfm_common_s.icf>
+)
+
+if(NS)
+    target_add_scatter_file(tfm_ns
+        $<$<C_COMPILER_ID:GNU>:${STM_COMMON_DIR}/stm32l5xx/Device/Source/gcc/stm32l5xx_ns.ld>
+        $<$<C_COMPILER_ID:ARMClang>:${STM_COMMON_DIR}/stm32l5xx/Device/Source/armclang/stm32l5xx_ns.sct>
+        $<$<C_COMPILER_ID:IAR>:${STM_COMMON_DIR}/stm32l5xx/Device/Source/iar/stm32l5xx_ns.icf>
+    )
+    target_link_libraries(tfm_ns
+        PRIVATE
+            $<$<C_COMPILER_ID:ARMClang>:${CMSIS_5_PATH}/RTOS2/RTX/Library/ARM/RTX_V8MMN.lib>
+            $<$<C_COMPILER_ID:GNU>:${CMSIS_5_PATH}/RTOS2/RTX/Library/GCC/libRTX_V8MMN.a>
+            $<$<C_COMPILER_ID:IAR>:${CMSIS_5_PATH}/RTOS2/RTX/Library/IAR/RTX_V8MMN.a>
+            # These libraries require linking to the veneers, so the veneers are
+            # marked again here as a link dependency to get the ordering right
+            tfm_s_veneers
+    )
+endif()
+
+if(BL2)
+    target_add_scatter_file(bl2
+        $<$<C_COMPILER_ID:GNU>:${STM_COMMON_DIR}/stm32l5xx/Device/Source/gcc/stm32l5xx_bl2.ld>
+        $<$<C_COMPILER_ID:ARMClang>:${STM_COMMON_DIR}/stm32l5xx/Device/Source/armclang/stm32l5xx_bl2.sct>
+        $<$<C_COMPILER_ID:IAR>:${STM_COMMON_DIR}/stm32l5xx/Device/Source/iar/stm32l5xx_bl2.icf>
+    )
+endif()
+
+#========================= Platform Secure ====================================#
+
+target_include_directories(platform_s
+    PUBLIC
+        ${CMAKE_CURRENT_SOURCE_DIR}
+        ${CMAKE_CURRENT_SOURCE_DIR}/Native_Driver
+        ${CMAKE_CURRENT_SOURCE_DIR}/CMSIS_Driver
+        ${CMAKE_CURRENT_SOURCE_DIR}/Device/Include
+        ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Inc
+)
+
+target_sources(platform_s
+    PRIVATE
+        ${CMAKE_CURRENT_SOURCE_DIR}/secure/system_stm32l5xx.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/Native_Driver/tick.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/Native_Driver/mpu_armv8m_drv.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/secure/spm_hal.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/secure/target_cfg.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/secure/low_level_device.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/CMSIS_Driver/low_level_flash.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/CMSIS_Driver/low_level_com.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_flash.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_flash_ex.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_dma.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_pwr.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_pwr_ex.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_gpio.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_uart.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_rcc.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_gtzc.c
+        $<$<BOOL:${TFM_PARTITION_PLATFORM}>:${CMAKE_CURRENT_SOURCE_DIR}/secure/tfm_platform_system>
+)
+
+target_compile_options(platform_s
+    PUBLIC
+        ${COMPILER_CMSE_FLAG}
+)
+
+# GNU ld has some strange behaviour to do with weak functions, and does not deal
+# well with strong functions in static libraries overriding weak functions in
+# object files. For this reason, the file mailbox_ipc_intr is linked directly to
+# the ns binary as an object file. This issue does not affect armclang, but the
+# fix is compatible.
+target_sources(tfm_s
+    PRIVATE
+        ${CMAKE_CURRENT_SOURCE_DIR}/Native_Driver/tick.c
+)
+
+target_compile_definitions(platform_s
+    PUBLIC
+        $<$<C_COMPILER_ID:GNU>:__STARTUP_CLEAR_BSS_MULTIPLE>
+        $<$<C_COMPILER_ID:GNU>:__STARTUP_COPY_MULTIPLE>
+)
+
+#========================= Platform Non-Secure ================================#
+
+target_include_directories(platform_ns
+    PUBLIC
+        ${CMAKE_CURRENT_SOURCE_DIR}/Device/Include
+        ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Inc
+)
+
+target_sources(platform_ns
+    PRIVATE
+        ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/Device/Source/Templates/system_stm32l5xx.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/CMSIS_Driver/low_level_com.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_dma.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_pwr.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_pwr_ex.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_rcc.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_gpio.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_uart.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_uart_ex.c
+        ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_cortex.c
+)
+
+#========================= Platform BL2 =======================================#
+
+if(BL2)
+    target_include_directories(platform_bl2
+        PUBLIC
+            ${CMAKE_CURRENT_SOURCE_DIR}
+            ${CMAKE_CURRENT_SOURCE_DIR}/Native_Driver
+            ${CMAKE_CURRENT_SOURCE_DIR}/CMSIS_Driver
+            ${CMAKE_CURRENT_SOURCE_DIR}/Device/Include
+            ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Inc
+            ${MCUBOOT_PATH}/boot/bootutil/include
+            $<TARGET_PROPERTY:bl2,BINARY_DIR>/ext/mcuboot
+            ${CMAKE_SOURCE_DIR}/bl2/ext/mcuboot/include
+    )
+
+    target_sources(platform_bl2
+        PRIVATE
+            ${CMAKE_CURRENT_SOURCE_DIR}/Device/Source/Templates/system_stm32l5xx.c
+            ${CMAKE_CURRENT_SOURCE_DIR}/bl2/boot_hal.c
+            ${CMAKE_CURRENT_SOURCE_DIR}/Native_Driver/mpu_armv8m_drv.c
+            ${CMAKE_CURRENT_SOURCE_DIR}/bl2/tfm_low_level_security.c
+            ${CMAKE_CURRENT_SOURCE_DIR}/bl2/low_level_device.c
+            ${CMAKE_CURRENT_SOURCE_DIR}/CMSIS_Driver/low_level_flash.c
+            ${CMAKE_CURRENT_SOURCE_DIR}/CMSIS_Driver/low_level_com.c
+            ${CMAKE_CURRENT_SOURCE_DIR}/Native_Driver/tick.c
+            ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal.c
+            ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_flash.c
+            ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_flash_ex.c
+            ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_pwr_ex.c
+            ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_dma.c
+            ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_pwr.c
+            ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_rcc.c
+            ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_cortex.c
+            ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_gpio.c
+            ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_uart.c
+            ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_uart_ex.c
+            ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_gtzc.c
+    )
+
+    target_compile_options(platform_bl2
+        PUBLIC
+            ${COMPILER_CMSE_FLAG}
+    )
+
+    # GNU ld has some strange behaviour to do with weak functions, and does not deal
+    # well with strong functions in static libraries overriding weak functions in
+    # object files. For this reason, the file mailbox_ipc_intr is linked directly to
+    # the ns binary as an object file. This issue does not affect armclang, but the
+    # fix is compatible.
+    target_sources(tfm_s
+        PRIVATE
+            ${CMAKE_CURRENT_SOURCE_DIR}/Native_Driver/tick.c
+    )
+endif()
+
+install(FILES
+        ${CMAKE_CURRENT_SOURCE_DIR}/boards/scripts/stm_tool.py
+        ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../bl2/ext/mcuboot/scripts/macro_parser.py
+        DESTINATION ./scripts/ )
+
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/boards/scripts/regression.sh
+         ${CMAKE_CURRENT_SOURCE_DIR}/boards/scripts/TFM_UPDATE.sh
+         ${CMAKE_CURRENT_SOURCE_DIR}/boards/scripts/postbuild.sh
+         PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
+         DESTINATION ./ )
+
+if (TEST_S)
+    #the define FLASH_LAYOUT_FOR_TEST
+    #increase SECURE and NON SECURE IMAGE and modify the  content of  low_level_device.c from BL2 (low_level_flash.c)
+    set(FLAGS_FOR_BL2_PREPROCESSING
+        "#define FLASH_LAYOUT_FOR_TEST\n"
+            "#define BL2\n"
+         )
+    add_definitions("-DFLASH_LAYOUT_FOR_TEST")
+else()
+    set(FLAGS_FOR_BL2_PREPROCESSING
+        "#define BL2\n"
+       )
+endif()
+
+set(CONTENT_FOR_BL2_PREPROCESSING
+    "#include \"flash_layout.h\"\n\n"
+    "enum bl2_image_attributes {\n"
+    "\tRE_IMAGE_FLASH_ADDRESS_SECURE = (FLASH_BASE_ADDRESS+FLASH_AREA_0_OFFSET),\n"
+    "\tRE_IMAGE_FLASH_ADDRESS_NON_SECURE = (FLASH_BASE_ADDRESS+FLASH_AREA_1_OFFSET),\n"
+    "\tRE_BL2_PERSO_ADDRESS = (FLASH_BASE_ADDRESS+FLASH_AREA_BL2_OFFSET),\n"
+    "\tRE_BL2_BOOT_ADDRESS = (FLASH_BASE_ADDRESS+FLASH_AREA_BL2_OFFSET),\n"
+    "\tRE_BL2_WRP_START = (FLASH_AREA_BL2_OFFSET),\n"
+    "\tRE_BL2_WRP_END = (FLASH_AREA_BL2_NOHDP_OFFSET+FLASH_AREA_BL2_NOHDP_SIZE-0x1),\n"
+    "\tRE_BL2_HDP_END = (FLASH_AREA_BL2_NOHDP_OFFSET-0x1),\n"
+   "\tRE_IMAGE_FLASH_SECURE_UPDATE = (FLASH_BASE_ADDRESS+FLASH_AREA_2_OFFSET),\n"
+    "\tRE_IMAGE_FLASH_NON_SECURE_UPDATE = (FLASH_BASE_ADDRESS+FLASH_AREA_3_OFFSET),\n"
+    "\tRE_IMAGE_FLASH_UNUSED = (FLASH_BASE_ADDRESS+FLASH_AREA_3_OFFSET+FLASH_AREA_3_SIZE),\n"
+    "\tRE_IMAGE_FLASH_SCRATCH = (FLASH_BASE_ADDRESS+FLASH_AREA_SCRATCH_OFFSET),\n"
+    "\tRE_IMAGE_FLASH_NV_COUNTERS = (FLASH_BASE_ADDRESS+FLASH_NV_COUNTERS_AREA_OFFSET),\n"
+    "\tRE_IMAGE_FLASH_NV_PS = (FLASH_BASE_ADDRESS+FLASH_PS_AREA_OFFSET),\n"
+    "\tRE_IMAGE_FLASH_NV_ITS = (FLASH_BASE_ADDRESS+FLASH_ITS_AREA_OFFSET)\n}\;"
+)
+
+string(CONCAT BL2_PREPROCESSING ${FLAGS_FOR_BL2_PREPROCESSING}
+       ${CONTENT_FOR_BL2_PREPROCESSING})
diff --git a/platform/ext/target/stm/stm32l5xx/Device/Include/stm32l552xx.h b/platform/ext/target/stm/common/stm32l5xx/Device/Include/stm32l552xx.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/Device/Include/stm32l552xx.h
rename to platform/ext/target/stm/common/stm32l5xx/Device/Include/stm32l552xx.h
diff --git a/platform/ext/target/stm/stm32l5xx/Device/Include/stm32l562xx.h b/platform/ext/target/stm/common/stm32l5xx/Device/Include/stm32l562xx.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/Device/Include/stm32l562xx.h
rename to platform/ext/target/stm/common/stm32l5xx/Device/Include/stm32l562xx.h
diff --git a/platform/ext/target/stm/stm32l5xx/Device/Include/stm32l5xx.h b/platform/ext/target/stm/common/stm32l5xx/Device/Include/stm32l5xx.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/Device/Include/stm32l5xx.h
rename to platform/ext/target/stm/common/stm32l5xx/Device/Include/stm32l5xx.h
diff --git a/platform/ext/target/stm/stm32l5xx/Device/Include/system_stm32l5xx.h b/platform/ext/target/stm/common/stm32l5xx/Device/Include/system_stm32l5xx.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/Device/Include/system_stm32l5xx.h
rename to platform/ext/target/stm/common/stm32l5xx/Device/Include/system_stm32l5xx.h
diff --git a/platform/ext/target/stm/stm32l5xx/Device/Source/Templates/system_stm32l5xx.c b/platform/ext/target/stm/common/stm32l5xx/Device/Source/Templates/system_stm32l5xx.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/Device/Source/Templates/system_stm32l5xx.c
rename to platform/ext/target/stm/common/stm32l5xx/Device/Source/Templates/system_stm32l5xx.c
diff --git a/platform/ext/target/stm/stm32l5xx/Device/Source/armclang/stm32l5xx_bl2.sct b/platform/ext/target/stm/common/stm32l5xx/Device/Source/armclang/stm32l5xx_bl2.sct
similarity index 95%
rename from platform/ext/target/stm/stm32l5xx/Device/Source/armclang/stm32l5xx_bl2.sct
rename to platform/ext/target/stm/common/stm32l5xx/Device/Source/armclang/stm32l5xx_bl2.sct
index 3b7b5a1..e690aca 100644
--- a/platform/ext/target/stm/stm32l5xx/Device/Source/armclang/stm32l5xx_bl2.sct
+++ b/platform/ext/target/stm/common/stm32l5xx/Device/Source/armclang/stm32l5xx_bl2.sct
@@ -1,5 +1,3 @@
-#! armclang --target=arm-arm-none-eabi -march=armv8-m.main -E -xc
-
 /*
  * Copyright (c) 2017-2018 Arm Limited. All rights reserved.
  *
diff --git a/platform/ext/target/stm/stm32l5xx/Device/Source/armclang/stm32l5xx_ns.sct b/platform/ext/target/stm/common/stm32l5xx/Device/Source/armclang/stm32l5xx_ns.sct
similarity index 94%
rename from platform/ext/target/stm/stm32l5xx/Device/Source/armclang/stm32l5xx_ns.sct
rename to platform/ext/target/stm/common/stm32l5xx/Device/Source/armclang/stm32l5xx_ns.sct
index d38a305..7bbe4ea 100644
--- a/platform/ext/target/stm/stm32l5xx/Device/Source/armclang/stm32l5xx_ns.sct
+++ b/platform/ext/target/stm/common/stm32l5xx/Device/Source/armclang/stm32l5xx_ns.sct
@@ -1,5 +1,3 @@
-#! armclang --target=arm-arm-none-eabi -march=armv8-m.main -E -xc
-
 /*
  * Copyright (c) 2017-2018 ARM Limited
  *
diff --git a/platform/ext/target/stm/stm32l5xx/Device/Source/gcc/stm32l5xx_bl2.ld b/platform/ext/target/stm/common/stm32l5xx/Device/Source/gcc/stm32l5xx_bl2.ld
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/Device/Source/gcc/stm32l5xx_bl2.ld
rename to platform/ext/target/stm/common/stm32l5xx/Device/Source/gcc/stm32l5xx_bl2.ld
diff --git a/platform/ext/target/stm/stm32l5xx/Device/Source/gcc/stm32l5xx_ns.ld b/platform/ext/target/stm/common/stm32l5xx/Device/Source/gcc/stm32l5xx_ns.ld
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/Device/Source/gcc/stm32l5xx_ns.ld
rename to platform/ext/target/stm/common/stm32l5xx/Device/Source/gcc/stm32l5xx_ns.ld
diff --git a/platform/ext/target/stm/stm32l5xx/Device/Source/iar/stm32l5xx_bl2.icf b/platform/ext/target/stm/common/stm32l5xx/Device/Source/iar/stm32l5xx_bl2.icf
similarity index 96%
rename from platform/ext/target/stm/stm32l5xx/Device/Source/iar/stm32l5xx_bl2.icf
rename to platform/ext/target/stm/common/stm32l5xx/Device/Source/iar/stm32l5xx_bl2.icf
index 85688dd..3ff1f23 100644
--- a/platform/ext/target/stm/stm32l5xx/Device/Source/iar/stm32l5xx_bl2.icf
+++ b/platform/ext/target/stm/common/stm32l5xx/Device/Source/iar/stm32l5xx_bl2.icf
@@ -15,7 +15,7 @@
        readonly section .BL2_NoHdp_Code,
        readonly object mpu_armv8m_drv.o};
 
-define block LR_NOHDP_CODE with fixed order, maximum size = BL2_NOHDP_CODE_SIZE {block ER_NOHDP_CODE};	   
+define block LR_NOHDP_CODE with fixed order, maximum size = BL2_NOHDP_CODE_SIZE {block ER_NOHDP_CODE};
 place at address BL2_NOHDP_CODE_START {block LR_NOHDP_CODE};
 
 define block ER_DATA            with alignment = 32 {readwrite};
diff --git a/platform/ext/target/stm/stm32l5xx/Device/Source/iar/stm32l5xx_flash_ns.icf b/platform/ext/target/stm/common/stm32l5xx/Device/Source/iar/stm32l5xx_flash_ns.icf
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/Device/Source/iar/stm32l5xx_flash_ns.icf
rename to platform/ext/target/stm/common/stm32l5xx/Device/Source/iar/stm32l5xx_flash_ns.icf
diff --git a/platform/ext/target/stm/stm32l5xx/Device/Source/startup_stm32l5xx_bl2.c b/platform/ext/target/stm/common/stm32l5xx/Device/Source/startup_stm32l5xx_bl2.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/Device/Source/startup_stm32l5xx_bl2.c
rename to platform/ext/target/stm/common/stm32l5xx/Device/Source/startup_stm32l5xx_bl2.c
diff --git a/platform/ext/target/stm/stm32l5xx/Device/Source/startup_stm32l5xx_ns.c b/platform/ext/target/stm/common/stm32l5xx/Device/Source/startup_stm32l5xx_ns.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/Device/Source/startup_stm32l5xx_ns.c
rename to platform/ext/target/stm/common/stm32l5xx/Device/Source/startup_stm32l5xx_ns.c
diff --git a/platform/ext/target/stm/stm32l5xx/Device/Source/startup_stm32l5xx_s.c b/platform/ext/target/stm/common/stm32l5xx/Device/Source/startup_stm32l5xx_s.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/Device/Source/startup_stm32l5xx_s.c
rename to platform/ext/target/stm/common/stm32l5xx/Device/Source/startup_stm32l5xx_s.c
diff --git a/platform/ext/target/stm/stm32l5xx/Native_Driver/low_level_rng.c b/platform/ext/target/stm/common/stm32l5xx/Native_Driver/low_level_rng.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/Native_Driver/low_level_rng.c
rename to platform/ext/target/stm/common/stm32l5xx/Native_Driver/low_level_rng.c
diff --git a/platform/ext/target/stm/stm32l5xx/Native_Driver/low_level_rng.h b/platform/ext/target/stm/common/stm32l5xx/Native_Driver/low_level_rng.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/Native_Driver/low_level_rng.h
rename to platform/ext/target/stm/common/stm32l5xx/Native_Driver/low_level_rng.h
diff --git a/platform/ext/target/stm/stm32l5xx/Native_Driver/mpu_armv8m_drv.c b/platform/ext/target/stm/common/stm32l5xx/Native_Driver/mpu_armv8m_drv.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/Native_Driver/mpu_armv8m_drv.c
rename to platform/ext/target/stm/common/stm32l5xx/Native_Driver/mpu_armv8m_drv.c
diff --git a/platform/ext/target/stm/stm32l5xx/Native_Driver/mpu_armv8m_drv.h b/platform/ext/target/stm/common/stm32l5xx/Native_Driver/mpu_armv8m_drv.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/Native_Driver/mpu_armv8m_drv.h
rename to platform/ext/target/stm/common/stm32l5xx/Native_Driver/mpu_armv8m_drv.h
diff --git a/platform/ext/target/stm/stm32l5xx/Native_Driver/tick.c b/platform/ext/target/stm/common/stm32l5xx/Native_Driver/tick.c
similarity index 99%
rename from platform/ext/target/stm/stm32l5xx/Native_Driver/tick.c
rename to platform/ext/target/stm/common/stm32l5xx/Native_Driver/tick.c
index 748c736..8d29fcb 100644
--- a/platform/ext/target/stm/stm32l5xx/Native_Driver/tick.c
+++ b/platform/ext/target/stm/common/stm32l5xx/Native_Driver/tick.c
@@ -25,6 +25,7 @@
   *       In this implementation, nothing is done.
   * @retval HAL status
   */
+
 HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
 {
   /* load 1Hz for timeout 1 second */
diff --git a/platform/ext/target/stm/stm32l5xx/bl2/boot_hal.c b/platform/ext/target/stm/common/stm32l5xx/bl2/boot_hal.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/bl2/boot_hal.c
rename to platform/ext/target/stm/common/stm32l5xx/bl2/boot_hal.c
diff --git a/platform/ext/target/stm/stm32l5xx/bl2/low_level_device.c b/platform/ext/target/stm/common/stm32l5xx/bl2/low_level_device.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/bl2/low_level_device.c
rename to platform/ext/target/stm/common/stm32l5xx/bl2/low_level_device.c
diff --git a/platform/ext/target/stm/stm32l5xx/bl2/tfm_low_level_security.c b/platform/ext/target/stm/common/stm32l5xx/bl2/tfm_low_level_security.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/bl2/tfm_low_level_security.c
rename to platform/ext/target/stm/common/stm32l5xx/bl2/tfm_low_level_security.c
diff --git a/platform/ext/target/stm/stm32l5xx/boards/cmsis.h b/platform/ext/target/stm/common/stm32l5xx/boards/cmsis.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/boards/cmsis.h
rename to platform/ext/target/stm/common/stm32l5xx/boards/cmsis.h
diff --git a/platform/ext/target/stm/stm32l5xx/boards/platform_irq.h b/platform/ext/target/stm/common/stm32l5xx/boards/platform_irq.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/boards/platform_irq.h
rename to platform/ext/target/stm/common/stm32l5xx/boards/platform_irq.h
diff --git a/platform/ext/target/stm/stm32l5xx/boards/scripts/TFM_UPDATE.sh b/platform/ext/target/stm/common/stm32l5xx/boards/scripts/TFM_UPDATE.sh
similarity index 84%
rename from platform/ext/target/stm/stm32l5xx/boards/scripts/TFM_UPDATE.sh
rename to platform/ext/target/stm/common/stm32l5xx/boards/scripts/TFM_UPDATE.sh
index 6154890..2d04ae0 100755
--- a/platform/ext/target/stm/stm32l5xx/boards/scripts/TFM_UPDATE.sh
+++ b/platform/ext/target/stm/common/stm32l5xx/boards/scripts/TFM_UPDATE.sh
@@ -34,12 +34,12 @@
 boot=0x0c001000
 unused=
 
-$stm32programmercli $connect -d $SCRIPTPATH/../tfm_s_signed.bin $slot0 -v
+$stm32programmercli $connect -d $SCRIPTPATH/tfm_s_signed.bin $slot0 -v
 echo "TFM_Appli Secure Written"
 echo "Write TFM_Appli NonSecure"
-$stm32programmercli $connect -d $SCRIPTPATH/../tfm_ns_signed.bin $slot1 -v
+$stm32programmercli $connect -d $SCRIPTPATH/tfm_ns_signed.bin $slot1 -v
 echo "TFM_Appli NonSecure Written"
 echo "Write TFM_SBSFU_Boot"
-$stm32programmercli $connect -d $SCRIPTPATH/../bl2/ext/mcuboot/mcuboot.bin $boot -v
+$stm32programmercli $connect -d $SCRIPTPATH/bl2.bin $boot -v
 echo "TFM_SBSFU_Boot Written"
 echo "TFM_UPDATE Done"
\ No newline at end of file
diff --git a/platform/ext/target/stm/stm32l5xx/boards/scripts/armclang/preprocess.sh b/platform/ext/target/stm/common/stm32l5xx/boards/scripts/armclang/preprocess.sh
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/boards/scripts/armclang/preprocess.sh
rename to platform/ext/target/stm/common/stm32l5xx/boards/scripts/armclang/preprocess.sh
diff --git a/platform/ext/target/stm/stm32l5xx/boards/scripts/gcc/preprocess.sh b/platform/ext/target/stm/common/stm32l5xx/boards/scripts/gcc/preprocess.sh
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/boards/scripts/gcc/preprocess.sh
rename to platform/ext/target/stm/common/stm32l5xx/boards/scripts/gcc/preprocess.sh
diff --git a/platform/ext/target/stm/stm32l5xx/boards/scripts/iar/preprocess.sh b/platform/ext/target/stm/common/stm32l5xx/boards/scripts/iar/preprocess.sh
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/boards/scripts/iar/preprocess.sh
rename to platform/ext/target/stm/common/stm32l5xx/boards/scripts/iar/preprocess.sh
diff --git a/platform/ext/target/stm/stm32l5xx/boards/scripts/postbuild.sh b/platform/ext/target/stm/common/stm32l5xx/boards/scripts/postbuild.sh
similarity index 96%
rename from platform/ext/target/stm/stm32l5xx/boards/scripts/postbuild.sh
rename to platform/ext/target/stm/common/stm32l5xx/boards/scripts/postbuild.sh
index d894a3d..f4cee4e 100644
--- a/platform/ext/target/stm/stm32l5xx/boards/scripts/postbuild.sh
+++ b/platform/ext/target/stm/common/stm32l5xx/boards/scripts/postbuild.sh
@@ -18,8 +18,8 @@
 projectdir=`dirname $SCRIPT`
 source $projectdir/preprocess.sh
 # the file to preprocess is generated and present outside of install dir
-bl2_file_to_preprocess=$projectdir/../image_macros_to_preprocess_bl2.c
-preprocess_bl2_file=$projectdir/../image_macros_preprocessed_bl2.c
+bl2_file_to_preprocess=$projectdir/image_macros_to_preprocess_bl2.c
+preprocess_bl2_file=$projectdir/image_macros_preprocessed_bl2.c
 regressionsh=$projectdir/regression.sh
 updatesh=$projectdir/TFM_UPDATE.sh
 
diff --git a/platform/ext/target/stm/stm32l5xx/boards/scripts/regression.sh b/platform/ext/target/stm/common/stm32l5xx/boards/scripts/regression.sh
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/boards/scripts/regression.sh
rename to platform/ext/target/stm/common/stm32l5xx/boards/scripts/regression.sh
diff --git a/platform/ext/target/stm/stm32l5xx/boards/scripts/stm_tool.py b/platform/ext/target/stm/common/stm32l5xx/boards/scripts/stm_tool.py
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/boards/scripts/stm_tool.py
rename to platform/ext/target/stm/common/stm32l5xx/boards/scripts/stm_tool.py
diff --git a/platform/ext/target/stm/stm32l5xx/boards/target_cfg.h b/platform/ext/target/stm/common/stm32l5xx/boards/target_cfg.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/boards/target_cfg.h
rename to platform/ext/target/stm/common/stm32l5xx/boards/target_cfg.h
diff --git a/platform/ext/target/stm/stm32l5xx/boards/tfm_peripherals_def.h b/platform/ext/target/stm/common/stm32l5xx/boards/tfm_peripherals_def.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/boards/tfm_peripherals_def.h
rename to platform/ext/target/stm/common/stm32l5xx/boards/tfm_peripherals_def.h
diff --git a/platform/ext/target/stm/stm32l5xx/readme.rst b/platform/ext/target/stm/common/stm32l5xx/readme.rst
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/readme.rst
rename to platform/ext/target/stm/common/stm32l5xx/readme.rst
diff --git a/platform/ext/target/stm/stm32l5xx/secure/low_level_device.c b/platform/ext/target/stm/common/stm32l5xx/secure/low_level_device.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/secure/low_level_device.c
rename to platform/ext/target/stm/common/stm32l5xx/secure/low_level_device.c
diff --git a/platform/ext/target/stm/stm32l5xx/secure/spm_hal.c b/platform/ext/target/stm/common/stm32l5xx/secure/spm_hal.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/secure/spm_hal.c
rename to platform/ext/target/stm/common/stm32l5xx/secure/spm_hal.c
diff --git a/platform/ext/target/stm/stm32l5xx/secure/system_stm32l5xx.c b/platform/ext/target/stm/common/stm32l5xx/secure/system_stm32l5xx.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/secure/system_stm32l5xx.c
rename to platform/ext/target/stm/common/stm32l5xx/secure/system_stm32l5xx.c
diff --git a/platform/ext/target/stm/stm32l5xx/secure/target_cfg.c b/platform/ext/target/stm/common/stm32l5xx/secure/target_cfg.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/secure/target_cfg.c
rename to platform/ext/target/stm/common/stm32l5xx/secure/target_cfg.c
diff --git a/platform/ext/target/stm/stm32l5xx/secure/tfm_platform_system.c b/platform/ext/target/stm/common/stm32l5xx/secure/tfm_platform_system.c
similarity index 85%
rename from platform/ext/target/stm/stm32l5xx/secure/tfm_platform_system.c
rename to platform/ext/target/stm/common/stm32l5xx/secure/tfm_platform_system.c
index 06bd86a..ee68f7a 100644
--- a/platform/ext/target/stm/stm32l5xx/secure/tfm_platform_system.c
+++ b/platform/ext/target/stm/common/stm32l5xx/secure/tfm_platform_system.c
@@ -25,15 +25,8 @@
      return TFM_PLAT_ERR_SYSTEM_ERR;
 }
 
-enum tfm_hal_status_t tfm_hal_platform_init(void)
-{
-    __enable_irq();
-    stdio_init();
 
-    return TFM_HAL_SUCCESS;
-}
-
-__WEAK void tfm_hal_system_reset(void)
+void tfm_spm_hal_system_reset(void)
 {
     NVIC_SystemReset();
 }
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/Legacy/stm32_hal_legacy.h b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/Legacy/stm32_hal_legacy.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/Legacy/stm32_hal_legacy.h
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/Legacy/stm32_hal_legacy.h
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32_assert_template.h b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32_assert_template.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32_assert_template.h
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32_assert_template.h
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal.h b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal.h
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal.h
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_cortex.h b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_cortex.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_cortex.h
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_cortex.h
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_def.h b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_def.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_def.h
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_def.h
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_dma.h b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_dma.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_dma.h
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_dma.h
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_dma_ex.h b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_dma_ex.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_dma_ex.h
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_dma_ex.h
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_exti.h b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_exti.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_exti.h
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_exti.h
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_flash.h b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_flash.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_flash.h
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_flash.h
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_flash_ex.h b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_flash_ex.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_flash_ex.h
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_flash_ex.h
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_flash_ramfunc.h b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_flash_ramfunc.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_flash_ramfunc.h
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_flash_ramfunc.h
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_gpio.h b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_gpio.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_gpio.h
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_gpio.h
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_gpio_ex.h b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_gpio_ex.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_gpio_ex.h
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_gpio_ex.h
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_gtzc.h b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_gtzc.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_gtzc.h
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_gtzc.h
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_pwr.h b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_pwr.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_pwr.h
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_pwr.h
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_pwr_ex.h b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_pwr_ex.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_pwr_ex.h
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_pwr_ex.h
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_rcc.h b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_rcc.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_rcc.h
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_rcc.h
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_rcc_ex.h b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_rcc_ex.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_rcc_ex.h
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_rcc_ex.h
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_rng.h b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_rng.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_rng.h
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_rng.h
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_rng_ex.h b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_rng_ex.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_rng_ex.h
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_rng_ex.h
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_uart.h b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_uart.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_uart.h
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_uart.h
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_uart_ex.h b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_uart_ex.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_uart_ex.h
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_uart_ex.h
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_usart.h b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_usart.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_usart.h
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Inc/stm32l5xx_hal_usart.h
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal.c b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal.c
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal.c
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_cortex.c b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_cortex.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_cortex.c
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_cortex.c
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_dma.c b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_dma.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_dma.c
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_dma.c
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_exti.c b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_exti.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_exti.c
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_exti.c
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_flash.c b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_flash.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_flash.c
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_flash.c
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_flash_ex.c b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_flash_ex.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_flash_ex.c
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_flash_ex.c
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_gpio.c b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_gpio.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_gpio.c
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_gpio.c
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_gtzc.c b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_gtzc.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_gtzc.c
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_gtzc.c
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_pwr.c b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_pwr.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_pwr.c
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_pwr.c
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_pwr_ex.c b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_pwr_ex.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_pwr_ex.c
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_pwr_ex.c
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_rcc.c b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_rcc.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_rcc.c
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_rcc.c
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_rcc_ex.c b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_rcc_ex.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_rcc_ex.c
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_rcc_ex.c
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_rng.c b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_rng.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_rng.c
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_rng.c
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_rng_ex.c b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_rng_ex.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_rng_ex.c
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_rng_ex.c
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_uart.c b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_uart.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_uart.c
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_uart.c
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_uart_ex.c b/platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_uart_ex.c
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_uart_ex.c
rename to platform/ext/target/stm/common/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_uart_ex.c
diff --git a/platform/ext/target/stm/stm32l5xx/tfm_low_level_security.h b/platform/ext/target/stm/common/stm32l5xx/tfm_low_level_security.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/tfm_low_level_security.h
rename to platform/ext/target/stm/common/stm32l5xx/tfm_low_level_security.h
diff --git a/platform/ext/target/stm/nucleo_l552ze_q/CMakeLists.txt b/platform/ext/target/stm/nucleo_l552ze_q/CMakeLists.txt
new file mode 100644
index 0000000..1b6f465
--- /dev/null
+++ b/platform/ext/target/stm/nucleo_l552ze_q/CMakeLists.txt
@@ -0,0 +1,43 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+cmake_policy(SET CMP0076 NEW)
+
+set(NUCLEO_L552ZE_Q_DIR ${CMAKE_CURRENT_LIST_DIR})
+set(STM_COMMON_DIR ${NUCLEO_L552ZE_Q_DIR}/../common)
+
+#def for stm32l5xx
+include(${STM_COMMON_DIR}/stm32l5xx/CMakeLists.txt) 
+#========================= Platform defs ===============================#
+
+# Specify the location of platform specific build dependencies.
+target_sources(tfm_s
+    PRIVATE
+        ${STM_COMMON_DIR}/stm32l5xx/Device/Source/startup_stm32l5xx_s.c
+)
+
+if(NS)
+    target_sources(tfm_ns
+        PRIVATE
+            ${STM_COMMON_DIR}/stm32l5xx/Device/Source/startup_stm32l5xx_ns.c
+    )
+endif()
+
+if(BL2)
+    target_sources(bl2
+        PRIVATE
+            ${STM_COMMON_DIR}/stm32l5xx/Device/Source/startup_stm32l5xx_bl2.c
+    )
+endif()
+
+install(FILES ${NUCLEO_L552ZE_Q_DIR}/include/flash_layout.h
+              ${NUCLEO_L552ZE_Q_DIR}/include/region_defs.h
+        DESTINATION ./ )
+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 ./ )
diff --git a/platform/ext/target/stm/nucleo_l552ze_q/config.cmake b/platform/ext/target/stm/nucleo_l552ze_q/config.cmake
new file mode 100644
index 0000000..b0049e6
--- /dev/null
+++ b/platform/ext/target/stm/nucleo_l552ze_q/config.cmake
@@ -0,0 +1,14 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+########################## BL2 #################################################
+
+set(MCUBOOT_IMAGE_NUMBER                2           CACHE STRING    "Whether to combine S and NS into either 1 image, or sign each seperately" FORCE)
+
+################################## Dependencies ################################
+
+set(MBEDCRYPTO_BUILD_TYPE               minsizerel  CACHE STRING "Build type of Mbed Crypto library" FORCE)
diff --git a/platform/ext/target/stm/nucleo_l552ze_q/image_macros_to_preprocess_bl2.c b/platform/ext/target/stm/nucleo_l552ze_q/image_macros_to_preprocess_bl2.c
new file mode 100644
index 0000000..046fe85
--- /dev/null
+++ b/platform/ext/target/stm/nucleo_l552ze_q/image_macros_to_preprocess_bl2.c
@@ -0,0 +1,19 @@
+#define BL2
+#include "flash_layout.h"
+
+enum bl2_image_attributes {
+	RE_IMAGE_FLASH_ADDRESS_SECURE = (FLASH_BASE_ADDRESS+FLASH_AREA_0_OFFSET),
+	RE_IMAGE_FLASH_ADDRESS_NON_SECURE = (FLASH_BASE_ADDRESS+FLASH_AREA_1_OFFSET),
+	RE_BL2_PERSO_ADDRESS = (FLASH_BASE_ADDRESS+FLASH_AREA_BL2_OFFSET),
+	RE_BL2_BOOT_ADDRESS = (FLASH_BASE_ADDRESS+FLASH_AREA_BL2_OFFSET),
+	RE_BL2_WRP_START = (FLASH_AREA_BL2_OFFSET),
+	RE_BL2_WRP_END = (FLASH_AREA_BL2_NOHDP_OFFSET+FLASH_AREA_BL2_NOHDP_SIZE-0x1),
+	RE_BL2_HDP_END = (FLASH_AREA_BL2_NOHDP_OFFSET-0x1),
+	RE_IMAGE_FLASH_SECURE_UPDATE = (FLASH_BASE_ADDRESS+FLASH_AREA_2_OFFSET),
+	RE_IMAGE_FLASH_NON_SECURE_UPDATE = (FLASH_BASE_ADDRESS+FLASH_AREA_3_OFFSET),
+	RE_IMAGE_FLASH_UNUSED = (FLASH_BASE_ADDRESS+FLASH_AREA_3_OFFSET+FLASH_AREA_3_SIZE),
+	RE_IMAGE_FLASH_SCRATCH = (FLASH_BASE_ADDRESS+FLASH_AREA_SCRATCH_OFFSET),
+	RE_IMAGE_FLASH_NV_COUNTERS = (FLASH_BASE_ADDRESS+FLASH_NV_COUNTERS_AREA_OFFSET),
+	RE_IMAGE_FLASH_NV_PS = (FLASH_BASE_ADDRESS+FLASH_PS_AREA_OFFSET),
+	RE_IMAGE_FLASH_NV_ITS = (FLASH_BASE_ADDRESS+FLASH_ITS_AREA_OFFSET)
+}
\ No newline at end of file
diff --git a/platform/ext/target/stm/stm32l5xx/boards/nucleo_l552ze_q/board.h b/platform/ext/target/stm/nucleo_l552ze_q/include/board.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/boards/nucleo_l552ze_q/board.h
rename to platform/ext/target/stm/nucleo_l552ze_q/include/board.h
diff --git a/platform/ext/target/stm/stm32l5xx/boards/nucleo_l552ze_q/boot_hal_cfg.h b/platform/ext/target/stm/nucleo_l552ze_q/include/boot_hal_cfg.h
similarity index 94%
copy from platform/ext/target/stm/stm32l5xx/boards/nucleo_l552ze_q/boot_hal_cfg.h
copy to platform/ext/target/stm/nucleo_l552ze_q/include/boot_hal_cfg.h
index 9fc92e2..2ec5683 100644
--- a/platform/ext/target/stm/stm32l5xx/boards/nucleo_l552ze_q/boot_hal_cfg.h
+++ b/platform/ext/target/stm/nucleo_l552ze_q/include/boot_hal_cfg.h
@@ -1,3 +1,4 @@
+
 /**
   ******************************************************************************
   * @file    boot_hal_cfg.h
@@ -41,7 +42,7 @@
 #define TFM_OB_BOOT_LOCK 0 /*!< BOOT Lock expected value  */
 /* run time protection */
 #define TFM_FLASH_PRIVONLY_ENABLE  /*!< Flash Command in Privileged only  */
-#define TFM_BOOT_MPU_PROTECTION    /*!< TFM_SBSFU_Boot uses MPU to prevent execution outside of TFM_SBSFU_Boot code  */
+/*#define TFM_BOOT_MPU_PROTECTION  *//*!< TFM_SBSFU_Boot uses MPU to prevent execution outside of TFM_SBSFU_Boot code  */
 #define TFM_ENABLE_SET_OB /*!< Option bytes are set by TFM_SBSFU_Boot when not correctly set  */
 #define TFM_ERROR_HANDLER_NON_SECURE /*!< Error handler is in Non Secure , this allows regression without jumping   */
 /* Exported types ------------------------------------------------------------*/
diff --git a/platform/ext/target/stm/stm32l5xx/boards/stm32l562e_dk/device_cfg.h b/platform/ext/target/stm/nucleo_l552ze_q/include/device_cfg.h
similarity index 100%
copy from platform/ext/target/stm/stm32l5xx/boards/stm32l562e_dk/device_cfg.h
copy to platform/ext/target/stm/nucleo_l552ze_q/include/device_cfg.h
diff --git a/platform/ext/target/stm/stm32l5xx/boards/nucleo_l552ze_q/flash_layout.h b/platform/ext/target/stm/nucleo_l552ze_q/include/flash_layout.h
similarity index 90%
rename from platform/ext/target/stm/stm32l5xx/boards/nucleo_l552ze_q/flash_layout.h
rename to platform/ext/target/stm/nucleo_l552ze_q/include/flash_layout.h
index 7ee7da0..783fb62 100644
--- a/platform/ext/target/stm/stm32l5xx/boards/nucleo_l552ze_q/flash_layout.h
+++ b/platform/ext/target/stm/nucleo_l552ze_q/include/flash_layout.h
@@ -18,7 +18,6 @@
 #ifndef __FLASH_LAYOUT_H__
 #define __FLASH_LAYOUT_H__
 
-
 /* This header file is included from linker scatter file as well, where only a
  * limited C constructs are allowed. Therefore it is not possible to include
  * here the platform_retarget.h to access flash related defines. To resolve this
@@ -27,11 +26,11 @@
  *
  * Flash layout on nucleo_l552ze_q with BL2 (multiple image boot):
  *
- * 0x0000_0000 BL2 - MCUBoot (60 KB)
- * 0x0001_0000 NV counters area (4 KB)
- * 0x0001_1000 Secure Storage Area (8 KB)
- * 0x0001_3000 Internal Trusted Storage Area (8 KB)
- * 0x0001_5000 Secure image     primary slot (176 KB)
+ * 0x0000_0000 BL2 - MCUBoot (72 KB)
+ * 0x0001_2000 NV counters area (4 KB)
+ * 0x0001_3000 Secure Storage Area (8 KB)
+ * 0x0001_5000 Internal Trusted Storage Area (8 KB)
+ * 0x0001_7000 Secure image     primary slot (172 KB)
  * 0x0004_1000 Non-secure image primary slot (36 KB)
  * 0x0004_a000 Secure image     secondary slot (176 KB)
  * 0x0007_6000 Non-secure image secondary slot (36 KB)
@@ -39,11 +38,13 @@
  *
  * Flash layout on nucleo_l552ze_q with BL2 (multiple image boot, layout for test):
  * No Firmware update , ITS, PS in RAM.
- * 0x0000_0000 BL2 - MCUBoot (60 KB)
- * 0x0001_0000 NV counters area (4 KB)
- * 0x0001_1000 Secure image     primary slot (256 KB)
- * 0x0005_1000 Non-secure image primary slot (184 KB)
- * 0x0007_F000 Unused (4 KB) *
+ * 0x0000_0000 BL2 - MCUBoot (72 KB)
+ * 0x0001_2000 NV counters area (4 KB)
+ * 0x0001_3000 Secure Storage Area (8 KB)
+ * 0x0001_5000 Internal Trusted Storage Area (8 KB)
+ * 0x0001_7000 Secure image     primary slot (224 KB)
+ * 0x0004_F000 Non-secure image primary slot (168 KB)
+ * 0x0007_9000 Unused (28K)
  * The size of a partition. This should be large enough to contain a S or NS
  * sw binary. Each FLASH_AREA_IMAGE contains two partitions. See Flash layout
  * above.
@@ -64,7 +65,7 @@
 
 /* area for BL2 code protected by hdp */
 #define FLASH_AREA_BL2_OFFSET           (0x0)
-#define FLASH_AREA_BL2_SIZE             (0xF800)
+#define FLASH_AREA_BL2_SIZE             (0x11000)
 /* HDP area end at this address */
 #define FLASH_BL2_HDP_END               (FLASH_AREA_BL2_OFFSET+FLASH_AREA_BL2_SIZE-1)
 /* area for BL2 code not protected by hdp */
@@ -87,15 +88,15 @@
 #define FLASH_PS_AREA_OFFSET           (FLASH_NV_COUNTERS_AREA_OFFSET+FLASH_NV_COUNTERS_SECTOR_SIZE)
 
 /* Internal Trusted Storage (ITS) Service definitions */
-#define FLASH_ITS_AREA_OFFSET           (FLASH_PS_AREA_OFFSET)
+#define FLASH_ITS_AREA_OFFSET           (FLASH_PS_AREA_OFFSET+FLASH_PS_AREA_SIZE)
 #define FLASH_ITS_AREA_SIZE             (0x2000)   /* 8 KB */
 
-#define FLASH_S_PARTITION_SIZE          (0x40000) /* S partition */
-#define FLASH_NS_PARTITION_SIZE         (0x2e000) /* NS partition */
+#define FLASH_S_PARTITION_SIZE          (0x38000) /* S partition */
+#define FLASH_NS_PARTITION_SIZE         (0x2A000) /* NS partition */
 #define FLASH_PARTITION_SIZE (FLASH_S_PARTITION_SIZE+FLASH_NS_PARTITION_SIZE)
 /* Secure image primary slot */
 #define FLASH_AREA_0_ID                 (1)
-#define FLASH_AREA_0_OFFSET             (FLASH_ITS_AREA_OFFSET)
+#define FLASH_AREA_0_OFFSET             (FLASH_ITS_AREA_OFFSET+FLASH_ITS_AREA_SIZE)
 #define FLASH_AREA_0_SIZE               (FLASH_S_PARTITION_SIZE)
 #else
 /* Non Volatile Counters definitions */
@@ -112,7 +113,7 @@
 #define FLASH_ITS_AREA_OFFSET           (FLASH_PS_AREA_OFFSET+FLASH_PS_AREA_SIZE)
 #define FLASH_ITS_AREA_SIZE             (0x2000)   /* 8 KB */
 
-#define FLASH_S_PARTITION_SIZE          (0x2C000) /* S partition */
+#define FLASH_S_PARTITION_SIZE          (0x2B000) /* S partition */
 #define FLASH_NS_PARTITION_SIZE         (0x9000) /* NS partition */
 #define FLASH_PARTITION_SIZE (FLASH_S_PARTITION_SIZE+FLASH_NS_PARTITION_SIZE)
 /* Secure image primary slot */
diff --git a/platform/ext/target/stm/stm32l5xx/boards/stm32l562e_dk/flash_layout_test.h b/platform/ext/target/stm/nucleo_l552ze_q/include/flash_layout_test.h
similarity index 100%
copy from platform/ext/target/stm/stm32l5xx/boards/stm32l562e_dk/flash_layout_test.h
copy to platform/ext/target/stm/nucleo_l552ze_q/include/flash_layout_test.h
diff --git a/platform/ext/target/stm/stm32l5xx/boards/nucleo_l552ze_q/region_defs.h b/platform/ext/target/stm/nucleo_l552ze_q/include/region_defs.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/boards/nucleo_l552ze_q/region_defs.h
rename to platform/ext/target/stm/nucleo_l552ze_q/include/region_defs.h
diff --git a/platform/ext/target/stm/stm32l5xx/boards/stm32l562e_dk/stm32l5xx_hal_conf.h b/platform/ext/target/stm/nucleo_l552ze_q/include/stm32l5xx_hal_conf.h
similarity index 100%
copy from platform/ext/target/stm/stm32l5xx/boards/stm32l562e_dk/stm32l5xx_hal_conf.h
copy to platform/ext/target/stm/nucleo_l552ze_q/include/stm32l5xx_hal_conf.h
diff --git a/platform/ext/target/stm/nucleo_l552ze_q/preload.cmake b/platform/ext/target/stm/nucleo_l552ze_q/preload.cmake
new file mode 100644
index 0000000..a263f9c
--- /dev/null
+++ b/platform/ext/target/stm/nucleo_l552ze_q/preload.cmake
@@ -0,0 +1,22 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+# preload.cmake is used to set things that related to the platform that are both
+# immutable and global, which is to say they should apply to any kind of project
+# that uses this platform. In practise this is normally compiler definitions and
+# variables related to hardware.
+
+# Set architecture and CPU
+set(TFM_SYSTEM_PROCESSOR cortex-m33)
+set(TFM_SYSTEM_ARCHITECTURE armv8-m.main)
+
+# Reload compiler to generate options from the CPU and architecture
+_compiler_reload()
+
+add_compile_definitions(
+    STM32L552xx
+)
diff --git a/platform/ext/target/stm/stm32l562e_dk/CMakeLists.txt b/platform/ext/target/stm/stm32l562e_dk/CMakeLists.txt
new file mode 100644
index 0000000..b72a45c
--- /dev/null
+++ b/platform/ext/target/stm/stm32l562e_dk/CMakeLists.txt
@@ -0,0 +1,43 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+cmake_policy(SET CMP0076 NEW)
+
+set(STM32L563E_DK_DIR ${CMAKE_CURRENT_LIST_DIR})
+set(STM_COMMON_DIR ${STM32L563E_DK_DIR}/../common)
+
+#def for stm32l5xx
+include(${STM_COMMON_DIR}/stm32l5xx/CMakeLists.txt) 
+#========================= Platform defs ===============================#
+
+# Specify the location of platform specific build dependencies.
+target_sources(tfm_s
+    PRIVATE
+        ${STM_COMMON_DIR}/stm32l5xx/Device/Source/startup_stm32l5xx_s.c
+)
+
+if(NS)
+    target_sources(tfm_ns
+        PRIVATE
+            ${STM_COMMON_DIR}/stm32l5xx/Device/Source/startup_stm32l5xx_ns.c
+    )
+endif()
+
+if(BL2)
+    target_sources(bl2
+        PRIVATE
+            ${STM_COMMON_DIR}/stm32l5xx/Device/Source/startup_stm32l5xx_bl2.c
+    )
+endif()
+
+install(FILES ${STM32L563E_DK_DIR}/include/flash_layout.h
+              ${STM32L563E_DK_DIR}/include/region_defs.h
+        DESTINATION ./ )
+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 ./ )
diff --git a/platform/ext/target/stm/stm32l562e_dk/config.cmake b/platform/ext/target/stm/stm32l562e_dk/config.cmake
new file mode 100644
index 0000000..b0049e6
--- /dev/null
+++ b/platform/ext/target/stm/stm32l562e_dk/config.cmake
@@ -0,0 +1,14 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+########################## BL2 #################################################
+
+set(MCUBOOT_IMAGE_NUMBER                2           CACHE STRING    "Whether to combine S and NS into either 1 image, or sign each seperately" FORCE)
+
+################################## Dependencies ################################
+
+set(MBEDCRYPTO_BUILD_TYPE               minsizerel  CACHE STRING "Build type of Mbed Crypto library" FORCE)
diff --git a/platform/ext/target/stm/stm32l562e_dk/image_macros_to_preprocess_bl2.c b/platform/ext/target/stm/stm32l562e_dk/image_macros_to_preprocess_bl2.c
new file mode 100644
index 0000000..046fe85
--- /dev/null
+++ b/platform/ext/target/stm/stm32l562e_dk/image_macros_to_preprocess_bl2.c
@@ -0,0 +1,19 @@
+#define BL2
+#include "flash_layout.h"
+
+enum bl2_image_attributes {
+	RE_IMAGE_FLASH_ADDRESS_SECURE = (FLASH_BASE_ADDRESS+FLASH_AREA_0_OFFSET),
+	RE_IMAGE_FLASH_ADDRESS_NON_SECURE = (FLASH_BASE_ADDRESS+FLASH_AREA_1_OFFSET),
+	RE_BL2_PERSO_ADDRESS = (FLASH_BASE_ADDRESS+FLASH_AREA_BL2_OFFSET),
+	RE_BL2_BOOT_ADDRESS = (FLASH_BASE_ADDRESS+FLASH_AREA_BL2_OFFSET),
+	RE_BL2_WRP_START = (FLASH_AREA_BL2_OFFSET),
+	RE_BL2_WRP_END = (FLASH_AREA_BL2_NOHDP_OFFSET+FLASH_AREA_BL2_NOHDP_SIZE-0x1),
+	RE_BL2_HDP_END = (FLASH_AREA_BL2_NOHDP_OFFSET-0x1),
+	RE_IMAGE_FLASH_SECURE_UPDATE = (FLASH_BASE_ADDRESS+FLASH_AREA_2_OFFSET),
+	RE_IMAGE_FLASH_NON_SECURE_UPDATE = (FLASH_BASE_ADDRESS+FLASH_AREA_3_OFFSET),
+	RE_IMAGE_FLASH_UNUSED = (FLASH_BASE_ADDRESS+FLASH_AREA_3_OFFSET+FLASH_AREA_3_SIZE),
+	RE_IMAGE_FLASH_SCRATCH = (FLASH_BASE_ADDRESS+FLASH_AREA_SCRATCH_OFFSET),
+	RE_IMAGE_FLASH_NV_COUNTERS = (FLASH_BASE_ADDRESS+FLASH_NV_COUNTERS_AREA_OFFSET),
+	RE_IMAGE_FLASH_NV_PS = (FLASH_BASE_ADDRESS+FLASH_PS_AREA_OFFSET),
+	RE_IMAGE_FLASH_NV_ITS = (FLASH_BASE_ADDRESS+FLASH_ITS_AREA_OFFSET)
+}
\ No newline at end of file
diff --git a/platform/ext/target/stm/stm32l5xx/boards/stm32l562e_dk/board.h b/platform/ext/target/stm/stm32l562e_dk/include/board.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/boards/stm32l562e_dk/board.h
rename to platform/ext/target/stm/stm32l562e_dk/include/board.h
diff --git a/platform/ext/target/stm/stm32l5xx/boards/nucleo_l552ze_q/boot_hal_cfg.h b/platform/ext/target/stm/stm32l562e_dk/include/boot_hal_cfg.h
similarity index 94%
rename from platform/ext/target/stm/stm32l5xx/boards/nucleo_l552ze_q/boot_hal_cfg.h
rename to platform/ext/target/stm/stm32l562e_dk/include/boot_hal_cfg.h
index 9fc92e2..5d23b8e 100644
--- a/platform/ext/target/stm/stm32l5xx/boards/nucleo_l552ze_q/boot_hal_cfg.h
+++ b/platform/ext/target/stm/stm32l562e_dk/include/boot_hal_cfg.h
@@ -1,3 +1,4 @@
+
 /**
   ******************************************************************************
   * @file    boot_hal_cfg.h
@@ -41,7 +42,7 @@
 #define TFM_OB_BOOT_LOCK 0 /*!< BOOT Lock expected value  */
 /* run time protection */
 #define TFM_FLASH_PRIVONLY_ENABLE  /*!< Flash Command in Privileged only  */
-#define TFM_BOOT_MPU_PROTECTION    /*!< TFM_SBSFU_Boot uses MPU to prevent execution outside of TFM_SBSFU_Boot code  */
+/*#define TFM_BOOT_MPU_PROTECTION */  /*!< TFM_SBSFU_Boot uses MPU to prevent execution outside of TFM_SBSFU_Boot code  */
 #define TFM_ENABLE_SET_OB /*!< Option bytes are set by TFM_SBSFU_Boot when not correctly set  */
 #define TFM_ERROR_HANDLER_NON_SECURE /*!< Error handler is in Non Secure , this allows regression without jumping   */
 /* Exported types ------------------------------------------------------------*/
diff --git a/platform/ext/target/stm/stm32l5xx/boards/stm32l562e_dk/device_cfg.h b/platform/ext/target/stm/stm32l562e_dk/include/device_cfg.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/boards/stm32l562e_dk/device_cfg.h
rename to platform/ext/target/stm/stm32l562e_dk/include/device_cfg.h
diff --git a/platform/ext/target/stm/stm32l5xx/boards/stm32l562e_dk/flash_layout.h b/platform/ext/target/stm/stm32l562e_dk/include/flash_layout.h
similarity index 90%
rename from platform/ext/target/stm/stm32l5xx/boards/stm32l562e_dk/flash_layout.h
rename to platform/ext/target/stm/stm32l562e_dk/include/flash_layout.h
index c46d317..940553f 100644
--- a/platform/ext/target/stm/stm32l5xx/boards/stm32l562e_dk/flash_layout.h
+++ b/platform/ext/target/stm/stm32l562e_dk/include/flash_layout.h
@@ -26,24 +26,25 @@
  *
  * Flash layout on stm23l562e_dk with BL2 (multiple image boot):
  *
- * 0x0000_0000 BL2 - MCUBoot (60 KB)
- * 0x0001_0000 NV counters area (4 KB)
- * 0x0001_1000 Secure Storage Area (8 KB)
- * 0x0001_3000 Internal Trusted Storage Area (8 KB)
- * 0x0001_5000 Secure image     primary slot (176 KB)
+ * 0x0000_0000 BL2 - MCUBoot (72 KB)
+ * 0x0001_2000 NV counters area (4 KB)
+ * 0x0001_3000 Secure Storage Area (8 KB)
+ * 0x0001_5000 Internal Trusted Storage Area (8 KB)
+ * 0x0001_7000 Secure image     primary slot (172 KB)
  * 0x0004_1000 Non-secure image primary slot (36 KB)
  * 0x0004_a000 Secure image     secondary slot (176 KB)
  * 0x0007_6000 Non-secure image secondary slot (36 KB)
  * 0x0007_F000 Unused (4 KB)
  *
  * Flash layout on  stm23l562e_dk with BL2 (multiple image boot, layout for test):
- * No Firmware update , ITS, PS in RAM.
- * 0x0000_0000 BL2 - MCUBoot (60 KB)
- * 0x0001_0000 NV counters area (4 KB)
- * 0x0001_1000 Secure image     primary slot (256 KB)
- * 0x0005_1000 Non-secure image primary slot (184 KB)
- * 0x0007_F000 Unused (4 KB)
- *
+ * No Firmware update
+ * 0x0000_0000 BL2 - MCUBoot (72 KB)
+ * 0x0001_2000 NV counters area (4 KB)
+ * 0x0001_3000 Secure Storage Area (8 KB)
+ * 0x0001_5000 Internal Trusted Storage Area (8 KB)
+ * 0x0001_7000 Secure image     primary slot (224 KB)
+ * 0x0004_F000 Non-secure image primary slot (168 KB)
+ * 0x0007_9000 Unused (28K)
  * The size of a partition. This should be large enough to contain a S or NS
  * sw binary. Each FLASH_AREA_IMAGE contains two partitions. See Flash layout
  * above.
@@ -64,7 +65,7 @@
 
 /* area for BL2 code protected by hdp */
 #define FLASH_AREA_BL2_OFFSET           (0x0)
-#define FLASH_AREA_BL2_SIZE             (0xF800)
+#define FLASH_AREA_BL2_SIZE             (0x11000)
 /* HDP area end at this address */
 #define FLASH_BL2_HDP_END               (FLASH_AREA_BL2_OFFSET+FLASH_AREA_BL2_SIZE-1)
 /* area for BL2 code not protected by hdp */
@@ -87,15 +88,15 @@
 #define FLASH_PS_AREA_OFFSET           (FLASH_NV_COUNTERS_AREA_OFFSET+FLASH_NV_COUNTERS_SECTOR_SIZE)
 
 /* Internal Trusted Storage (ITS) Service definitions */
-#define FLASH_ITS_AREA_OFFSET           (FLASH_PS_AREA_OFFSET)
+#define FLASH_ITS_AREA_OFFSET           (FLASH_PS_AREA_OFFSET+FLASH_PS_AREA_SIZE)
 #define FLASH_ITS_AREA_SIZE             (0x2000)   /* 8 KB */
 
-#define FLASH_S_PARTITION_SIZE          (0x40000) /* S partition */
-#define FLASH_NS_PARTITION_SIZE         (0x2E000) /* NS partition */
+#define FLASH_S_PARTITION_SIZE          (0x38000) /* S partition */
+#define FLASH_NS_PARTITION_SIZE         (0x2A000) /* NS partition */
 #define FLASH_PARTITION_SIZE (FLASH_S_PARTITION_SIZE+FLASH_NS_PARTITION_SIZE)
 /* Secure image primary slot */
 #define FLASH_AREA_0_ID                 (1)
-#define FLASH_AREA_0_OFFSET             (FLASH_ITS_AREA_OFFSET)
+#define FLASH_AREA_0_OFFSET             (FLASH_ITS_AREA_OFFSET+FLASH_ITS_AREA_SIZE)
 #define FLASH_AREA_0_SIZE               (FLASH_S_PARTITION_SIZE)
 #else
 /* Non Volatile Counters definitions */
@@ -112,7 +113,7 @@
 #define FLASH_ITS_AREA_OFFSET           (FLASH_PS_AREA_OFFSET+FLASH_PS_AREA_SIZE)
 #define FLASH_ITS_AREA_SIZE             (0x2000)   /* 8 KB */
 
-#define FLASH_S_PARTITION_SIZE          (0x2C000) /* S partition */
+#define FLASH_S_PARTITION_SIZE          (0x2B000) /* S partition */
 #define FLASH_NS_PARTITION_SIZE         (0x9000) /* NS partition */
 #define FLASH_PARTITION_SIZE (FLASH_S_PARTITION_SIZE+FLASH_NS_PARTITION_SIZE)
 /* Secure image primary slot */
@@ -144,7 +145,6 @@
 #define MCUBOOT_MAX_IMG_SECTORS           ((2 * FLASH_PARTITION_SIZE) / \
                                          FLASH_AREA_IMAGE_SECTOR_SIZE)
 
-
 #define FLASH_NV_COUNTERS_AREA_SIZE     (0x18)     /* 16 Bytes */
 
 #define SECURE_IMAGE_OFFSET             (0x0)
@@ -153,9 +153,6 @@
 #define NON_SECURE_IMAGE_OFFSET         (SECURE_IMAGE_OFFSET + SECURE_IMAGE_MAX_SIZE)
 #define NON_SECURE_IMAGE_MAX_SIZE       FLASH_NS_PARTITION_SIZE
 
-
-
-
 /* Flash device name used by BL2 and NV Counter
   * Name is defined in flash driver file: Driver_Flash.c
   */
@@ -187,7 +184,6 @@
 /* The maximum number of assets to be stored in the PS area */
 #define PS_NUM_ASSETS          10
 
-
 #define ITS_FLASH_DEV_NAME TFM_Driver_FLASH0
 
 #define ITS_FLASH_AREA_ADDR     FLASH_ITS_AREA_OFFSET
diff --git a/platform/ext/target/stm/stm32l5xx/boards/stm32l562e_dk/flash_layout_test.h b/platform/ext/target/stm/stm32l562e_dk/include/flash_layout_test.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/boards/stm32l562e_dk/flash_layout_test.h
rename to platform/ext/target/stm/stm32l562e_dk/include/flash_layout_test.h
diff --git a/platform/ext/target/stm/stm32l5xx/boards/stm32l562e_dk/region_defs.h b/platform/ext/target/stm/stm32l562e_dk/include/region_defs.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/boards/stm32l562e_dk/region_defs.h
rename to platform/ext/target/stm/stm32l562e_dk/include/region_defs.h
diff --git a/platform/ext/target/stm/stm32l5xx/boards/stm32l562e_dk/stm32l5xx_hal_conf.h b/platform/ext/target/stm/stm32l562e_dk/include/stm32l5xx_hal_conf.h
similarity index 100%
rename from platform/ext/target/stm/stm32l5xx/boards/stm32l562e_dk/stm32l5xx_hal_conf.h
rename to platform/ext/target/stm/stm32l562e_dk/include/stm32l5xx_hal_conf.h
diff --git a/platform/ext/target/stm/stm32l562e_dk/preload.cmake b/platform/ext/target/stm/stm32l562e_dk/preload.cmake
new file mode 100644
index 0000000..83247d0
--- /dev/null
+++ b/platform/ext/target/stm/stm32l562e_dk/preload.cmake
@@ -0,0 +1,22 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+# preload.cmake is used to set things that related to the platform that are both
+# immutable and global, which is to say they should apply to any kind of project
+# that uses this platform. In practise this is normally compiler definitions and
+# variables related to hardware.
+
+# Set architecture and CPU
+set(TFM_SYSTEM_PROCESSOR cortex-m33)
+set(TFM_SYSTEM_ARCHITECTURE armv8-m.main)
+
+# Reload compiler to generate options from the CPU and architecture
+_compiler_reload()
+
+add_compile_definitions(
+    STM32L562xx
+)
diff --git a/platform/ext/target/stm/stm32l5xx/boards/nucleo_l552ze_q/device_cfg.h b/platform/ext/target/stm/stm32l5xx/boards/nucleo_l552ze_q/device_cfg.h
deleted file mode 100644
index 10ce543..0000000
--- a/platform/ext/target/stm/stm32l5xx/boards/nucleo_l552ze_q/device_cfg.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2017-2019 Arm Limited. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __DEVICE_CFG_H__
-#define __DEVICE_CFG_H__
-
-/**
- * \file device_cfg.h
- * \brief Configuration file native driver re-targeting
- *
- * \details This file can be used to add native driver specific macro
- *          definitions to select which peripherals are available in the build.
- *
- * This is a default device configuration file with all peripherals enabled.
- */
-
-
-/* Default UART baud rate */
-#define DEFAULT_UART_BAUDRATE 115200
-
-#endif  /* __DEVICE_CFG_H__ */
\ No newline at end of file
diff --git a/platform/ext/target/stm/stm32l5xx/boards/nucleo_l552ze_q/flash_layout_test.h b/platform/ext/target/stm/stm32l5xx/boards/nucleo_l552ze_q/flash_layout_test.h
deleted file mode 100644
index 4ebabe5..0000000
--- a/platform/ext/target/stm/stm32l5xx/boards/nucleo_l552ze_q/flash_layout_test.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (c) 2018 Arm Limited. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __FLASH_LAYOUT_TEST_H__
-#define __FLASH_LAYOUT_TEST_H__
-
-
-#define FLASH_LAYOUT_FOR_TEST
-#include "flash_layout.h"
-#endif /* __FLASH_LAYOUT_TEST_H__*/
diff --git a/platform/ext/target/stm/stm32l5xx/boards/nucleo_l552ze_q/stm32l5xx_hal_conf.h b/platform/ext/target/stm/stm32l5xx/boards/nucleo_l552ze_q/stm32l5xx_hal_conf.h
deleted file mode 100644
index 84103a3..0000000
--- a/platform/ext/target/stm/stm32l5xx/boards/nucleo_l552ze_q/stm32l5xx_hal_conf.h
+++ /dev/null
@@ -1,439 +0,0 @@
-/**
-  ******************************************************************************
-  * @file    stm32l5xx_hal_conf.h
-  * @author  MCD Application Team
-  * @brief   HAL configuration template file.
-  *          This file should be copied to the application folder and renamed
-  *          to stm32l5xx_hal_conf.h.
-  ******************************************************************************
-  * @attention
-  *
-  * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
-  * All rights reserved.</center></h2>
-  *
-  * This software component is licensed by ST 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
-  *
-  ******************************************************************************
-  */
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef STM32L5xx_HAL_CONF_H
-#define STM32L5xx_HAL_CONF_H
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-/* Exported types ------------------------------------------------------------*/
-/* Exported constants --------------------------------------------------------*/
-
-/* ########################## Module Selection ############################## */
-/**
-  * @brief This is the list of modules to be used in the HAL driver
-  */
-#define HAL_MODULE_ENABLED
-/* #define HAL_ADC_MODULE_ENABLED */
-/* #define HAL_COMP_MODULE_ENABLED */
-#define HAL_CORTEX_MODULE_ENABLED
-/* #define HAL_CRC_MODULE_ENABLED */
-/* #define HAL_CRYP_MODULE_ENABLED */
-/* #define HAL_DAC_MODULE_ENABLED */
-/* #define HAL_DFSDM_MODULE_ENABLED */
-#define HAL_DMA_MODULE_ENABLED
-#define HAL_EXTI_MODULE_ENABLED
-/* #define HAL_FDCAN_MODULE_ENABLED */
-#define HAL_FLASH_MODULE_ENABLED
-#define HAL_GPIO_MODULE_ENABLED
-#define HAL_GTZC_MODULE_ENABLED
-/* #define HAL_HASH_MODULE_ENABLED */
-/* #define HAL_I2C_MODULE_ENABLED */
-/* #define HAL_ICACHE_MODULE_ENABLED */
-/* #define HAL_IRDA_MODULE_ENABLED */
-/* #define HAL_IWDG_MODULE_ENABLED */
-/* #define HAL_LPTIM_MODULE_ENABLED */
-/* #define HAL_MMC_MODULE_ENABLED */
-/* #define HAL_NAND_MODULE_ENABLED */
-/* #define HAL_NOR_MODULE_ENABLED */
-/* #define HAL_OPAMP_MODULE_ENABLED */
-/* #define HAL_OSPI_MODULE_ENABLED */
-/* #define HAL_OTFDEC_MODULE_ENABLED */
-/* #define HAL_PCD_MODULE_ENABLED */
-/* #define HAL_PKA_MODULE_ENABLED */
-#define HAL_PWR_MODULE_ENABLED
-#define HAL_RCC_MODULE_ENABLED
-#define HAL_RNG_MODULE_ENABLED
-/* #define HAL_RTC_MODULE_ENABLED */
-/* #define HAL_SAI_MODULE_ENABLED */
-/* #define HAL_SD_MODULE_ENABLED */
-/* #define HAL_SMARTCARD_MODULE_ENABLED */
-/* #define HAL_SMBUS_MODULE_ENABLED */
-/* #define HAL_SPI_MODULE_ENABLED */
-/* #define HAL_SRAM_MODULE_ENABLED */
-/* #define HAL_TIM_MODULE_ENABLED */
-/* #define HAL_TSC_MODULE_ENABLED */
-#define HAL_UART_MODULE_ENABLED
-/* #define HAL_USART_MODULE_ENABLED */
-/* #define HAL_WWDG_MODULE_ENABLED */
-
-
-/* ########################## Oscillator Values adaptation ####################*/
-/**
-  * @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
-  *        This value is used by the RCC HAL module to compute the system frequency
-  *        (when HSE is used as system clock source, directly or through the PLL).
-  */
-#if !defined  (HSE_VALUE)
-  #define HSE_VALUE              16000000U /*!< Value of the External oscillator in Hz */
-#endif /* HSE_VALUE */
-
-#if !defined  (HSE_STARTUP_TIMEOUT)
-  #define HSE_STARTUP_TIMEOUT 100U   /*!< Time out for HSE start up, in ms */
-#endif /* HSE_STARTUP_TIMEOUT */
-
-/**
-  * @brief Internal Multiple Speed oscillator (MSI) default value.
-  *        This value is the default MSI range value after Reset.
-  */
-#if !defined  (MSI_VALUE)
-  #define MSI_VALUE           4000000U /*!< Value of the Internal oscillator in Hz*/
-#endif /* MSI_VALUE */
-
-/**
-  * @brief Internal High Speed oscillator (HSI) value.
-  *        This value is used by the RCC HAL module to compute the system frequency
-  *        (when HSI is used as system clock source, directly or through the PLL).
-  */
-#if !defined  (HSI_VALUE)
-  #define HSI_VALUE           16000000U /*!< Value of the Internal oscillator in Hz*/
-#endif /* HSI_VALUE */
-
-/**
-  * @brief Internal High Speed oscillator (HSI48) value for USB FS, SDMMC and RNG.
-  *        This internal oscillator is mainly dedicated to provide a high precision clock to
-  *        the USB peripheral by means of a special Clock Recovery System (CRS) circuitry.
-  *        When the CRS is not used, the HSI48 RC oscillator runs on it default frequency
-  *        which is subject to manufacturing process variations.
-  */
-#if !defined  (HSI48_VALUE)
- #define HSI48_VALUE          48000000U /*!< Value of the Internal High Speed oscillator for USB FS/SDMMC/RNG in Hz.
-                                          The real value my vary depending on manufacturing process variations.*/
-#endif /* HSI48_VALUE */
-
-/**
-  * @brief Internal Low Speed oscillator (LSI) value.
-  */
-#if !defined  (LSI_VALUE)
- #define LSI_VALUE            32000U    /*!< LSI Typical Value in Hz*/
-#endif /* LSI_VALUE */                  /*!< Value of the Internal Low Speed oscillator in Hz
-                                          The real value may vary depending on the variations
-                                          in voltage and temperature.*/
-/**
-  * @brief External Low Speed oscillator (LSE) value.
-  *        This value is used by the UART, RTC HAL module to compute the system frequency
-  */
-#if !defined  (LSE_VALUE)
-  #define LSE_VALUE           32768U    /*!< Value of the External oscillator in Hz*/
-#endif /* LSE_VALUE */
-
-#if !defined  (LSE_STARTUP_TIMEOUT)
-  #define LSE_STARTUP_TIMEOUT 5000U     /*!< Time out for LSE start up, in ms */
-#endif /* HSE_STARTUP_TIMEOUT */
-
-/**
-  * @brief External clock source for SAI1 peripheral
-  *        This value is used by the RCC HAL module to compute the SAI1 & SAI2 clock source
-  *        frequency.
-  */
-#if !defined  (EXTERNAL_SAI1_CLOCK_VALUE)
-  #define EXTERNAL_SAI1_CLOCK_VALUE  48000U /*!< Value of the SAI1 External clock source in Hz*/
-#endif /* EXTERNAL_SAI1_CLOCK_VALUE */
-
-/**
-  * @brief External clock source for SAI2 peripheral
-  *        This value is used by the RCC HAL module to compute the SAI1 & SAI2 clock source
-  *        frequency.
-  */
-#if !defined  (EXTERNAL_SAI2_CLOCK_VALUE)
-  #define EXTERNAL_SAI2_CLOCK_VALUE   48000U /*!< Value of the SAI2 External clock source in Hz*/
-#endif /* EXTERNAL_SAI2_CLOCK_VALUE */
-
-/* Tip: To avoid modifying this file each time you need to use different HSE,
-   ===  you can define the HSE value in your toolchain compiler preprocessor. */
-
-/* ########################### System Configuration ######################### */
-/**
-  * @brief This is the HAL system configuration section
-  */
-#define VDD_VALUE          3300U /*!< Value of VDD in mv */
-#define TICK_INT_PRIORITY  ((1UL<<__NVIC_PRIO_BITS) - 1UL)  /*!< tick interrupt priority (lowest by default) */
-#define USE_RTOS           0U
-
-/* ########################## Assert Selection ############################## */
-/**
-  * @brief Uncomment the line below to expanse the "assert_param" macro in the
-  *        HAL drivers code
-  */
-/* #define USE_FULL_ASSERT               1U */
-
-/* ################## Register callback feature configuration ############### */
-/**
-  * @brief Set below the peripheral configuration  to "1U" to add the support
-  *        of HAL callback registration/unregistration feature for the HAL
-  *        driver(s). This allows user application to provide specific callback
-  *        functions thanks to HAL_PPP_RegisterCallback() rather than overwriting
-  *        the default weak callback functions (see each stm32l5xx_hal_ppp.h file
-  *        for possible callback identifiers defined in HAL_PPP_CallbackIDTypeDef
-  *        for each PPP peripheral).
-  */
-#define USE_HAL_ADC_REGISTER_CALLBACKS        0U
-#define USE_HAL_COMP_REGISTER_CALLBACKS       0U
-#define USE_HAL_CRYP_REGISTER_CALLBACKS       0U
-#define USE_HAL_DAC_REGISTER_CALLBACKS        0U
-#define USE_HAL_DFSDM_REGISTER_CALLBACKS      0U
-#define USE_HAL_FDCAN_REGISTER_CALLBACKS      0U
-#define USE_HAL_HASH_REGISTER_CALLBACKS       0U
-#define USE_HAL_I2C_REGISTER_CALLBACKS        0U
-#define USE_HAL_IRDA_REGISTER_CALLBACKS       0U
-#define USE_HAL_LPTIM_REGISTER_CALLBACKS      0U
-#define USE_HAL_MMC_REGISTER_CALLBACKS        0U
-#define USE_HAL_NAND_REGISTER_CALLBACKS       0U
-#define USE_HAL_NOR_REGISTER_CALLBACKS        0U
-#define USE_HAL_OPAMP_REGISTER_CALLBACKS      0U
-#define USE_HAL_OSPI_REGISTER_CALLBACKS       0U
-#define USE_HAL_OTFDEC_REGISTER_CALLBACKS     0U
-#define USE_HAL_PCD_REGISTER_CALLBACKS        0U
-#define USE_HAL_PKA_REGISTER_CALLBACKS        0U
-#define USE_HAL_RNG_REGISTER_CALLBACKS        0U
-#define USE_HAL_RTC_REGISTER_CALLBACKS        0U
-#define USE_HAL_SAI_REGISTER_CALLBACKS        0U
-#define USE_HAL_SD_REGISTER_CALLBACKS         0U
-#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS  0U
-#define USE_HAL_SMBUS_REGISTER_CALLBACKS      0U
-#define USE_HAL_SPI_REGISTER_CALLBACKS        0U
-#define USE_HAL_SRAM_REGISTER_CALLBACKS       0U
-#define USE_HAL_TIM_REGISTER_CALLBACKS        0U
-#define USE_HAL_TSC_REGISTER_CALLBACKS        0U
-#define USE_HAL_UART_REGISTER_CALLBACKS       0U
-#define USE_HAL_USART_REGISTER_CALLBACKS      0U
-#define USE_HAL_WWDG_REGISTER_CALLBACKS       0U
-
-/* ################## SPI peripheral configuration ########################## */
-
-/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver
- * Activated: CRC code is present inside driver
- * Deactivated: CRC code cleaned from driver
- */
-
-#define USE_SPI_CRC                   1U
-
-/* ################## CRYP peripheral configuration ########################## */
-
-#define USE_HAL_CRYP_SUSPEND_RESUME   1U
-
-/* ################## SDMMC peripheral configuration ######################### */
-
-#define USE_SD_TRANSCEIVER            0U
-
-
-
-/* Includes ------------------------------------------------------------------*/
-/**
-  * @brief Include module's header file
-  */
-
-#ifdef HAL_RCC_MODULE_ENABLED
-  #include "stm32l5xx_hal_rcc.h"
-#endif /* HAL_RCC_MODULE_ENABLED */
-
-#ifdef HAL_GPIO_MODULE_ENABLED
-  #include "stm32l5xx_hal_gpio.h"
-#endif /* HAL_GPIO_MODULE_ENABLED */
-
-#ifdef HAL_DMA_MODULE_ENABLED
-  #include "stm32l5xx_hal_dma.h"
-#endif /* HAL_DMA_MODULE_ENABLED */
-
-#ifdef HAL_DFSDM_MODULE_ENABLED
-  #include "stm32l5xx_hal_dfsdm.h"
-#endif /* HAL_DFSDM_MODULE_ENABLED */
-
-#ifdef HAL_CORTEX_MODULE_ENABLED
-  #include "stm32l5xx_hal_cortex.h"
-#endif /* HAL_CORTEX_MODULE_ENABLED */
-
-#ifdef HAL_ADC_MODULE_ENABLED
-  #include "stm32l5xx_hal_adc.h"
-#endif /* HAL_ADC_MODULE_ENABLED */
-
-#ifdef HAL_COMP_MODULE_ENABLED
-  #include "stm32l5xx_hal_comp.h"
-#endif /* HAL_COMP_MODULE_ENABLED */
-
-#ifdef HAL_CRC_MODULE_ENABLED
-  #include "stm32l5xx_hal_crc.h"
-#endif /* HAL_CRC_MODULE_ENABLED */
-
-#ifdef HAL_CRYP_MODULE_ENABLED
-  #include "stm32l5xx_hal_cryp.h"
-#endif /* HAL_CRYP_MODULE_ENABLED */
-
-#ifdef HAL_DAC_MODULE_ENABLED
-  #include "stm32l5xx_hal_dac.h"
-#endif /* HAL_DAC_MODULE_ENABLED */
-
-#ifdef HAL_EXTI_MODULE_ENABLED
-  #include "stm32l5xx_hal_exti.h"
-#endif /* HAL_EXTI_MODULE_ENABLED */
-
-#ifdef HAL_FDCAN_MODULE_ENABLED
-  #include "stm32l5xx_hal_fdcan.h"
-#endif /* HAL_FDCAN_MODULE_ENABLED */
-
-#ifdef HAL_FLASH_MODULE_ENABLED
-  #include "stm32l5xx_hal_flash.h"
-#endif /* HAL_FLASH_MODULE_ENABLED */
-
-#ifdef HAL_GTZC_MODULE_ENABLED
-  #include "stm32l5xx_hal_gtzc.h"
-#endif /* HAL_GTZC_MODULE_ENABLED */
-
-#ifdef HAL_HASH_MODULE_ENABLED
-  #include "stm32l5xx_hal_hash.h"
-#endif /* HAL_HASH_MODULE_ENABLED */
-
-#ifdef HAL_I2C_MODULE_ENABLED
-  #include "stm32l5xx_hal_i2c.h"
-#endif /* HAL_I2C_MODULE_ENABLED */
-
-#ifdef HAL_ICACHE_MODULE_ENABLED
-  #include "stm32l5xx_hal_icache.h"
-#endif /* HAL_ICACHE_MODULE_ENABLED */
-
-#ifdef HAL_IRDA_MODULE_ENABLED
-  #include "stm32l5xx_hal_irda.h"
-#endif /* HAL_IRDA_MODULE_ENABLED */
-
-#ifdef HAL_IWDG_MODULE_ENABLED
-  #include "stm32l5xx_hal_iwdg.h"
-#endif /* HAL_IWDG_MODULE_ENABLED */
-
-#ifdef HAL_LPTIM_MODULE_ENABLED
-  #include "stm32l5xx_hal_lptim.h"
-#endif /* HAL_LPTIM_MODULE_ENABLED */
-
-#ifdef HAL_MMC_MODULE_ENABLED
-  #include "stm32l5xx_hal_mmc.h"
-#endif /* HAL_MMC_MODULE_ENABLED */
-
-#ifdef HAL_NAND_MODULE_ENABLED
-  #include "stm32l5xx_hal_nand.h"
-#endif /* HAL_NAND_MODULE_ENABLED */
-
-#ifdef HAL_NOR_MODULE_ENABLED
-  #include "stm32l5xx_hal_nor.h"
-#endif /* HAL_NOR_MODULE_ENABLED */
-
-#ifdef HAL_OPAMP_MODULE_ENABLED
-  #include "stm32l5xx_hal_opamp.h"
-#endif /* HAL_OPAMP_MODULE_ENABLED */
-
-#ifdef HAL_OSPI_MODULE_ENABLED
-  #include "stm32l5xx_hal_ospi.h"
-#endif /* HAL_OSPI_MODULE_ENABLED */
-
-#ifdef HAL_OTFDEC_MODULE_ENABLED
-  #include "stm32l5xx_hal_otfdec.h"
-#endif /* HAL_OTFDEC_MODULE_ENABLED */
-
-#ifdef HAL_PCD_MODULE_ENABLED
-  #include "stm32l5xx_hal_pcd.h"
-#endif /* HAL_PCD_MODULE_ENABLED */
-
-#ifdef HAL_PKA_MODULE_ENABLED
-  #include "stm32l5xx_hal_pka.h"
-#endif /* HAL_PKA_MODULE_ENABLED */
-
-#ifdef HAL_PWR_MODULE_ENABLED
-  #include "stm32l5xx_hal_pwr.h"
-#endif /* HAL_PWR_MODULE_ENABLED */
-
-#ifdef HAL_RNG_MODULE_ENABLED
-  #include "stm32l5xx_hal_rng.h"
-#endif /* HAL_RNG_MODULE_ENABLED */
-
-#ifdef HAL_RTC_MODULE_ENABLED
-  #include "stm32l5xx_hal_rtc.h"
-#endif /* HAL_RTC_MODULE_ENABLED */
-
-#ifdef HAL_SAI_MODULE_ENABLED
-  #include "stm32l5xx_hal_sai.h"
-#endif /* HAL_SAI_MODULE_ENABLED */
-
-#ifdef HAL_SD_MODULE_ENABLED
-  #include "stm32l5xx_hal_sd.h"
-#endif /* HAL_SD_MODULE_ENABLED */
-
-#ifdef HAL_SMARTCARD_MODULE_ENABLED
-  #include "stm32l5xx_hal_smartcard.h"
-#endif /* HAL_SMARTCARD_MODULE_ENABLED */
-
-#ifdef HAL_SMBUS_MODULE_ENABLED
-  #include "stm32l5xx_hal_smbus.h"
-#endif /* HAL_SMBUS_MODULE_ENABLED */
-
-#ifdef HAL_SPI_MODULE_ENABLED
-  #include "stm32l5xx_hal_spi.h"
-#endif /* HAL_SPI_MODULE_ENABLED */
-
-#ifdef HAL_SRAM_MODULE_ENABLED
-  #include "stm32l5xx_hal_sram.h"
-#endif /* HAL_SRAM_MODULE_ENABLED */
-
-#ifdef HAL_TIM_MODULE_ENABLED
-  #include "stm32l5xx_hal_tim.h"
-#endif /* HAL_TIM_MODULE_ENABLED */
-
-#ifdef HAL_TSC_MODULE_ENABLED
-  #include "stm32l5xx_hal_tsc.h"
-#endif /* HAL_TSC_MODULE_ENABLED */
-
-#ifdef HAL_UART_MODULE_ENABLED
-  #include "stm32l5xx_hal_uart.h"
-#endif /* HAL_UART_MODULE_ENABLED */
-
-#ifdef HAL_USART_MODULE_ENABLED
-  #include "stm32l5xx_hal_usart.h"
-#endif /* HAL_USART_MODULE_ENABLED */
-
-#ifdef HAL_WWDG_MODULE_ENABLED
-  #include "stm32l5xx_hal_wwdg.h"
-#endif /* HAL_WWDG_MODULE_ENABLED */
-
-/* Exported macro ------------------------------------------------------------*/
-#ifdef  USE_FULL_ASSERT
-/**
-  * @brief  The assert_param macro is used for function's parameters check.
-  * @param  expr: If expr is false, it calls assert_failed function
-  *         which reports the name of the source file and the source
-  *         line number of the call that failed.
-  *         If expr is true, it returns no value.
-  * @retval None
-  */
-  #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
-/* Exported functions ------------------------------------------------------- */
-  void assert_failed(uint8_t *file, uint32_t line);
-#else
-  #define assert_param(expr) ((void)0U)
-#endif /* USE_FULL_ASSERT */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* STM32L5xx_HAL_CONF_H */
-
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/platform/ext/target/stm/stm32l5xx/boards/stm32l562e_dk/boot_hal_cfg.h b/platform/ext/target/stm/stm32l5xx/boards/stm32l562e_dk/boot_hal_cfg.h
deleted file mode 100644
index 9fc92e2..0000000
--- a/platform/ext/target/stm/stm32l5xx/boards/stm32l562e_dk/boot_hal_cfg.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
-  ******************************************************************************
-  * @file    boot_hal_cfg.h
-  * @author  MCD Application Team
-  * @brief   File fixing configuration flag specific for STM32L5xx platform
-  *
-  ******************************************************************************
-  * @attention
-  *
-  * <h2><center>&copy; Copyright (c) 2020 STMicroelectronics.
-  * All rights reserved.</center></h2>
-  *
-  * This software component is licensed by ST 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
-  *
-  ******************************************************************************
-  */
-
-
-/* Define to prevent recursive inclusion -------------------------------------*/
-#ifndef BOOT_HAL_CFG_H
-#define BOOT_HAL_CFG_H
-
-/* Includes ------------------------------------------------------------------*/
-#include "stm32l5xx_hal.h"
-#define RTC_CLOCK_SOURCE_LSE
-
-
-#ifdef RTC_CLOCK_SOURCE_LSE
-#define RTC_ASYNCH_PREDIV  0x7F
-#define RTC_SYNCH_PREDIV   0x00FF
-#endif /* RTC_CLOCK_SOURCE_LSE */
-
-/* Static protection checking  Flag */
-/* #define TFM_OB_RDP_LEVEL_VALUE OB_RDP_LEVEL_1 */ /*!< RDP level */
-/* #define TFM_WRP_PROTECT_ENABLE */ /*!< Write Protection  */
-#define TFM_HDP_PROTECT_ENABLE /*!< HDP protection   */
-#define TFM_SECURE_USER_SRAM2_ERASE_AT_RESET /*!< SRAM2 clear at Reset  */
-#define TFM_OB_BOOT_LOCK 0 /*!< BOOT Lock expected value  */
-/* run time protection */
-#define TFM_FLASH_PRIVONLY_ENABLE  /*!< Flash Command in Privileged only  */
-#define TFM_BOOT_MPU_PROTECTION    /*!< TFM_SBSFU_Boot uses MPU to prevent execution outside of TFM_SBSFU_Boot code  */
-#define TFM_ENABLE_SET_OB /*!< Option bytes are set by TFM_SBSFU_Boot when not correctly set  */
-#define TFM_ERROR_HANDLER_NON_SECURE /*!< Error handler is in Non Secure , this allows regression without jumping   */
-/* Exported types ------------------------------------------------------------*/
-typedef enum
-{
-  TFM_SUCCESS = 0U,
-  TFM_FAILED
-} TFM_ErrorStatus;
-
-/* Exported constants --------------------------------------------------------*/
-/* Exported macro ------------------------------------------------------------*/
-/* Exported functions ------------------------------------------------------- */
-void Error_Handler(void);
-#endif /* BOOT_HAL_CFG_H */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/platform/ext/target/stm/stm32l5xx/nucleo_l552ze_q.cmake b/platform/ext/target/stm/stm32l5xx/nucleo_l552ze_q.cmake
deleted file mode 100644
index b23701e..0000000
--- a/platform/ext/target/stm/stm32l5xx/nucleo_l552ze_q.cmake
+++ /dev/null
@@ -1,155 +0,0 @@
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-#This file gathers all nucleo_l552ze_q specific files in the application.
-
-#stm  has a Cortex M33 CPU.
-include("Common/CpuM33")
-set(PS_CREATE_FLASH_LAYOUT ON)
-set(ITS_CREATE_FLASH_LAYOUT ON)
-set(ATTEST_INCLUDE_TEST_CODE ON)
-set(MCUBOOT_HW_KEY OFF)
-set(MBEDCRYPTO_DEBUG OFF)
-set(MCUBOOT_IMAGE_NUMBER 2)
-set(TFM_ENABLE_IRQ_TEST OFF)
-set(TFM_ENABLE_PERIPH_ACCESS_TEST OFF)
-set(ITS_RAM_FS ON)
-set(PS_RAM_FS ON)
-add_definitions("-DSTM32L552xx")
-
-# force RDP level 0 usage
-add_definitions("-DTFM_OB_RDP_LEVEL_VALUE=0xAA")
-include ("${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx.cmake")
-#Specify the location of platform specific build dependencies.
-if(COMPILER STREQUAL "GNUARM")
-  set(BL2_SCATTER_FILE_NAME "${PLATFORM_DIR}/target/stm/stm32l5xx/Device/Source/gcc/stm32l5xx_bl2.ld")
-  set(S_SCATTER_FILE_NAME   "${PLATFORM_DIR}/common/gcc/tfm_common_s.ld")
-  set(NS_SCATTER_FILE_NAME  "${PLATFORM_DIR}/target/stm/stm32l5xx/Device/Source/gcc/stm32l5xx_ns.ld")
-  set(PREPROCESS_BL2_FILE "${PLATFORM_DIR}/target/stm/stm32l5xx/boards/scripts/gcc/preprocess.sh")
-  if (DEFINED CMSIS_DIR)
-    # not all project defines CMSIS_DIR, only the ones that use it.
-    set(RTX_LIB_PATH "${CMSIS_DIR}/RTOS2/RTX/Library/GCC/RTX_V8MMN.a")
-  endif()
-elseif(COMPILER STREQUAL "ARMCLANG")
-  set(S_SCATTER_FILE_NAME   "${PLATFORM_DIR}/common/armclang/tfm_common_s.sct")
-  set(BL2_SCATTER_FILE_NAME "${PLATFORM_DIR}/target/stm/stm32l5xx/Device/Source/armclang/stm32l5xx_bl2.sct")
-  set(NS_SCATTER_FILE_NAME  "${PLATFORM_DIR}/target/stm/stm32l5xx/Device/Source/armclang/stm32l5xx_ns.sct")
-  set(PREPROCESS_BL2_FILE "${PLATFORM_DIR}/target/stm/stm32l5xx/boards/scripts/armclang/preprocess.sh")
-  if (DEFINED CMSIS_DIR)
-    # Not all projects define CMSIS_5_DIR, only the ones that use it.
-    set(RTX_LIB_PATH "${CMSIS_DIR}/RTOS2/RTX/Library/ARM/RTX_V8MMN.lib")
-  endif()
-elseif(COMPILER STREQUAL "IARARM")
-  set(S_SCATTER_FILE_NAME   "${PLATFORM_DIR}/common/iar/tfm_common_s.icf")
-  set(BL2_SCATTER_FILE_NAME "${PLATFORM_DIR}/target/stm/stm32l5xx/Device/Source/iar/stm32l5xx_bl2.icf")
-  set(NS_SCATTER_FILE_NAME  "${PLATFORM_DIR}/target/stm/stm32l5xx/Device/Source/iar/stm32l5xx_flash_ns.icf")
-  set(PREPROCESS_BL2_FILE "${PLATFORM_DIR}/target/stm/stm32l5xx/boards/scripts/iar/preprocess.sh")
-  if (DEFINED CMSIS_DIR)
-    # not all project defines CMSIS_5_DIR, only the ones that use it.
-    set (RTX_LIB_PATH "${CMSIS_DIR}/RTOS2/RTX/Library/IAR/RTX_V8MMN.a")
-  endif()
-else()
-  message(FATAL_ERROR "'${COMPILER}' is not supported.")
-endif()
-
-if (REGRESSION OR CORE_TEST OR IPC_TEST OR PSA_API_TEST)
-  set(FLASH_LAYOUT          "${PLATFORM_DIR}/target/stm/stm32l5xx/boards/nucleo_l552ze_q/flash_layout_test.h")
-else()
-  set(FLASH_LAYOUT          "${PLATFORM_DIR}/target/stm/stm32l5xx/boards/nucleo_l552ze_q/flash_layout.h")
-endif()
-set(PLATFORM_LINK_INCLUDES "${PLATFORM_DIR}/target/stm/stm32l5xx/boards/nucleo_l552ze_q" "${PLATFORM_DIR}/target/stm/stm32l5xx/Device/include")
-
-
-
-if (BL2)
-  set(BL2_LINKER_CONFIG ${BL2_SCATTER_FILE_NAME})
-endif()
-
-embedded_include_directories(PATH "${PLATFORM_DIR}/cmsis" ABSOLUTE)
-embedded_include_directories(PATH "${PLATFORM_DIR}/target/stm/stm32l5xx" ABSOLUTE)
-embedded_include_directories(PATH "${PLATFORM_DIR}/target/stm/stm32l5xx/boards" ABSOLUTE)
-embedded_include_directories(PATH "${PLATFORM_DIR}/target/stm/stm32l5xx/Device/Include" ABSOLUTE)
-embedded_include_directories(PATH "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Inc" ABSOLUTE)
-embedded_include_directories(PATH "${PLATFORM_DIR}/target/stm/stm32l5xx/boards/nucleo_l552ze_q" ABSOLUTE)
-embedded_include_directories(PATH "${PLATFORM_DIR}/../include" ABSOLUTE)
-
-if (NOT DEFINED BUILD_UART_STDOUT)
-  message(FATAL_ERROR "Configuration variable BUILD_UART_STDOUT (true|false) is undefined!")
-elseif(BUILD_UART_STDOUT)
-  if (NOT DEFINED SECURE_UART1)
-    message(FATAL_ERROR "Configuration variable SECURE_UART1 (true|false) is undefined!")
-  elseif(SECURE_UART1)
-    message(FATAL_ERROR "Configuration SECURE_UART1 TRUE is invalid for this target!")
-  endif()
-  list(APPEND ALL_SRC_C "${PLATFORM_DIR}/common/uart_stdout.c")
-  embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE)
-  set(BUILD_NATIVE_DRIVERS true)
-  set(BUILD_CMSIS_DRIVERS true)
-endif()
-
-
-
-if (NOT DEFINED BUILD_TIME)
-  message(FATAL_ERROR "Configuration variable BUILD_TIME (true|false) is undefined!")
-elseif(BUILD_TIME)
-#fix me add a cmsis_driver for L5
-endif()
-
-if (NOT DEFINED BUILD_FLASH)
-  message(FATAL_ERROR "Configuration variable BUILD_FLASH (true|false) is undefined!")
-elseif(BUILD_FLASH)
-  #list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/stm/stm32l5xx/CMSIS_Driver/Driver_Flash.c")
-  # As the PS area is going to be in RAM, it is required to set PS_CREATE_FLASH_LAYOUT
-  # to be sure the PS service knows that when it starts the PS area does not contain any
-  # valid PS flash layout and it needs to create one.
-  set(ITS_CREATE_FLASH_LAYOUT ON)
-  set(ITS_RAM_FS OFF)
-  set(PS_CREATE_FLASH_LAYOUT ON)
-  set(PS_RAM_FS OFF)
-  embedded_include_directories(PATH "${PLATFORM_DIR}/driver" ABSOLUTE)
-endif()
-
-if (NOT DEFINED BUILD_TARGET_NV_COUNTERS)
-  message(FATAL_ERROR "Configuration variable BUILD_TARGET_NV_COUNTERS (true|false) is undefined!")
-elseif(BUILD_TARGET_NV_COUNTERS)
-  # NOTE: This non-volatile counters implementation is a dummy
-  #       implementation. Platform vendors have to implement the
-  #       API ONLY if the target has non-volatile counters.
-  list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/template/nv_counters.c")
-  set(TARGET_NV_COUNTERS_ENABLE ON)
-  # Sets PS_ROLLBACK_PROTECTION flag to compile in the PS services
-  # rollback protection code as the target supports nv counters.
-  set(PS_ROLLBACK_PROTECTION ON)
-endif()
-
-if (NOT BL2)
-  message(STATUS "WARNING: BL2 is mandatory on target \"${TARGET_PLATFORM}\" Your choice was overriden.")
-  set(BL2 True)
-endif()
-if (${MCUBOOT_SIGNATURE_TYPE} STREQUAL "RSA-2048")
-  add_definitions(-DMCUBOOT_SIGN_RSA_LEN=2048)
-endif()
-if (${MCUBOOT_SIGNATURE_TYPE} STREQUAL "RSA-3072")
-  add_definitions(-DMCUBOOT_SIGN_RSA_LEN=3072)
-endif()
-if (NOT ${MCUBOOT_UPGRADE_STRATEGY} STREQUAL "OVERWRITE_ONLY")
-  message(WARNING "OVERWRITE ONLY upgrade strategy is preferred on target '${TARGET_PLATFORM}'. Your choice was overriden.")
-  set(MCUBOOT_UPGRADE_STRATEGY "OVERWRITE_ONLY")
-endif()
-#install files reuqired for flashing and performing regression
-install(FILES
-        ${PLATFORM_DIR}/target/stm/stm32l5xx/boards/scripts/stm_tool.py
-        ${PLATFORM_DIR}/../../bl2/ext/mcuboot/scripts/macro_parser.py
-        DESTINATION ./scripts/ )
-install(FILES ${PLATFORM_DIR}/target/stm/stm32l5xx/boards/stm32l562e_dk/flash_layout.h
-        ${PLATFORM_DIR}/target/stm/stm32l5xx/boards/stm32l562e_dk/region_defs.h
-        DESTINATION ./ )
-install(FILES ${PLATFORM_DIR}/target/stm/stm32l5xx/boards/scripts/regression.sh
-        ${PLATFORM_DIR}/target/stm/stm32l5xx/boards/scripts/TFM_UPDATE.sh
-        ${PLATFORM_DIR}/target/stm/stm32l5xx/boards/scripts/postbuild.sh
-        ${PREPROCESS_BL2_FILE}
-        PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
-        DESTINATION ./ )
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l562e_dk.cmake b/platform/ext/target/stm/stm32l5xx/stm32l562e_dk.cmake
deleted file mode 100644
index 7c8447a..0000000
--- a/platform/ext/target/stm/stm32l5xx/stm32l562e_dk.cmake
+++ /dev/null
@@ -1,152 +0,0 @@
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-#This file gathers all stm32l562_dk specific files in the application.
-
-#stm  has a Cortex M33 CPU.
-include("Common/CpuM33")
-set(PS_CREATE_FLASH_LAYOUT ON)
-set(ITS_CREATE_FLASH_LAYOUT ON)
-set(ATTEST_INCLUDE_TEST_CODE ON)
-set(MCUBOOT_HW_KEY OFF)
-set(MBEDCRYPTO_DEBUG OFF)
-set(MCUBOOT_IMAGE_NUMBER 2)
-set(TFM_ENABLE_IRQ_TEST OFF)
-set(TFM_ENABLE_PERIPH_ACCESS_TEST OFF)
-set(ITS_RAM_FS ON)
-set(PS_RAM_FS ON)
-add_definitions("-DSTM32L562xx")
-
-# force RDP level 0 usage
-add_definitions("-DTFM_OB_RDP_LEVEL_VALUE=0xAA")
-include ("${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx.cmake")
-#Specify the location of platform specific build dependencies.
-if (COMPILER STREQUAL "GNUARM")
-  set(BL2_SCATTER_FILE_NAME "${PLATFORM_DIR}/target/stm/stm32l5xx/Device/Source/gcc/stm32l5xx_bl2.ld")
-  set(S_SCATTER_FILE_NAME   "${PLATFORM_DIR}/common/gcc/tfm_common_s.ld")
-  set(NS_SCATTER_FILE_NAME  "${PLATFORM_DIR}/target/stm/stm32l5xx/Device/Source/gcc/stm32l5xx_ns.ld")
-  set(PREPROCESS_BL2_FILE "${PLATFORM_DIR}/target/stm/stm32l5xx/boards/scripts/gcc/preprocess.sh")
-  if (DEFINED CMSIS_DIR)
-    # not all project defines CMSIS_DIR, only the ones that use it.
-    set(RTX_LIB_PATH "${CMSIS_DIR}/RTOS2/RTX/Library/GCC/libRTX_V8MMN.a")
-  endif()
-elseif(COMPILER STREQUAL "ARMCLANG")
-  set(S_SCATTER_FILE_NAME   "${PLATFORM_DIR}/common/armclang/tfm_common_s.sct")
-  set(BL2_SCATTER_FILE_NAME "${PLATFORM_DIR}/target/stm/stm32l5xx/Device/Source/armclang/stm32l5xx_bl2.sct")
-  set(NS_SCATTER_FILE_NAME  "${PLATFORM_DIR}/target/stm/stm32l5xx/Device/Source/armclang/stm32l5xx_ns.sct")
-  set(PREPROCESS_BL2_FILE "${PLATFORM_DIR}/target/stm/stm32l5xx/boards/scripts/armclang/preprocess.sh")
-  if (DEFINED CMSIS_DIR)
-    # Not all projects define CMSIS_5_DIR, only the ones that use it.
-    set(RTX_LIB_PATH "${CMSIS_DIR}/RTOS2/RTX/Library/ARM/RTX_V8MMN.lib")
-  endif()
-elseif(COMPILER STREQUAL "IARARM")
-  set(S_SCATTER_FILE_NAME   "${PLATFORM_DIR}/common/iar/tfm_common_s.icf")
-  set(BL2_SCATTER_FILE_NAME "${PLATFORM_DIR}/target/stm/stm32l5xx/Device/Source/iar/stm32l5xx_bl2.icf")
-  set(NS_SCATTER_FILE_NAME  "${PLATFORM_DIR}/target/stm/stm32l5xx/Device/Source/iar/stm32l5xx_flash_ns.icf")
-  set(PREPROCESS_BL2_FILE "${PLATFORM_DIR}/target/stm/stm32l5xx/boards/scripts/iar/preprocess.sh")
-  if (DEFINED CMSIS_DIR)
-    # not all project defines CMSIS_5_DIR, only the ones that use it.
-    set (RTX_LIB_PATH "${CMSIS_DIR}/RTOS2/RTX/Library/IAR/RTX_V8MMN.a")
-  endif()
-else()
-  message(FATAL_ERROR "'${COMPILER}' is not supported.")
-endif()
-if (REGRESSION OR CORE_TEST OR IPC_TEST OR PSA_API_TEST)
-  set(FLASH_LAYOUT          "${PLATFORM_DIR}/target/stm/stm32l5xx/boards/stm32l562e_dk/flash_layout_test.h")
-else()
-  set(FLASH_LAYOUT          "${PLATFORM_DIR}/target/stm/stm32l5xx/boards/stm32l562e_dk/flash_layout.h")
-endif()
-set(PLATFORM_LINK_INCLUDES "${PLATFORM_DIR}/target/stm/stm32l5xx/boards/stm32l562e_dk" "${PLATFORM_DIR}/target/stm/stm32l5xx/Device/include")
-
-if (BL2)
-  set(BL2_LINKER_CONFIG ${BL2_SCATTER_FILE_NAME})
-endif()
-
-embedded_include_directories(PATH "${PLATFORM_DIR}/cmsis" ABSOLUTE)
-embedded_include_directories(PATH "${PLATFORM_DIR}/target/stm/stm32l5xx" ABSOLUTE)
-embedded_include_directories(PATH "${PLATFORM_DIR}/target/stm/stm32l5xx/boards" ABSOLUTE)
-embedded_include_directories(PATH "${PLATFORM_DIR}/target/stm/stm32l5xx/Device/Include" ABSOLUTE)
-embedded_include_directories(PATH "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Inc" ABSOLUTE)
-embedded_include_directories(PATH "${PLATFORM_DIR}/target/stm/stm32l5xx/boards/stm32l562e_dk" ABSOLUTE)
-embedded_include_directories(PATH "${PLATFORM_DIR}/../include" ABSOLUTE)
-
-if (NOT DEFINED BUILD_UART_STDOUT)
-  message(FATAL_ERROR "Configuration variable BUILD_UART_STDOUT (true|false) is undefined!")
-elseif(BUILD_UART_STDOUT)
-  if (NOT DEFINED SECURE_UART1)
-    message(FATAL_ERROR "Configuration variable SECURE_UART1 (true|false) is undefined!")
-  elseif(SECURE_UART1)
-    message(FATAL_ERROR "Configuration SECURE_UART1 TRUE is invalid for this target!")
-  endif()
-  list(APPEND ALL_SRC_C "${PLATFORM_DIR}/common/uart_stdout.c")
-  embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE)
-  set(BUILD_NATIVE_DRIVERS true)
-  set(BUILD_CMSIS_DRIVERS true)
-endif()
-
-
-
-if (NOT DEFINED BUILD_TIME)
-  message(FATAL_ERROR "Configuration variable BUILD_TIME (true|false) is undefined!")
-elseif(BUILD_TIME)
-#fix me add a cmsis_driver for L5
-endif()
-
-if (NOT DEFINED BUILD_FLASH)
-  message(FATAL_ERROR "Configuration variable BUILD_FLASH (true|false) is undefined!")
-elseif(BUILD_FLASH)
-  #list(APPEND ALL_SRC_C "${PLATFORM_DIR}/target/stm/stm32l5xx/CMSIS_Driver/Driver_Flash.c")
-  # As the PS area is going to be in RAM, it is required to set PS_CREATE_FLASH_LAYOUT
-  # to be sure the PS service knows that when it starts the PS area does not contain any
-  # valid PS flash layout and it needs to create one.
-  set(ITS_CREATE_FLASH_LAYOUT ON)
-  set(ITS_RAM_FS OFF)
-  set(PS_CREATE_FLASH_LAYOUT ON)
-  set(PS_RAM_FS OFF)
-  embedded_include_directories(PATH "${PLATFORM_DIR}/driver" ABSOLUTE)
-endif()
-
-if (NOT DEFINED BUILD_TARGET_NV_COUNTERS)
-  message(FATAL_ERROR "Configuration variable BUILD_TARGET_NV_COUNTERS (true|false) is undefined!")
-elseif(BUILD_TARGET_NV_COUNTERS)
-  # NOTE: This non-volatile counters implementation is a dummy
-  #       implementation. Platform vendors have to implement the
-  #       API ONLY if the target has non-volatile counters.
-  list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/template/nv_counters.c")
-  set(TARGET_NV_COUNTERS_ENABLE ON)
-  # Sets PS_ROLLBACK_PROTECTION flag to compile in the PS services
-  # rollback protection code as the target supports nv counters.
-  set(PS_ROLLBACK_PROTECTION ON)
-endif()
-
-if (NOT BL2)
-  message(STATUS "WARNING: BL2 is mandatory on target \"${TARGET_PLATFORM}\" Your choice was override.")
-  set(BL2 True)
-endif()
-if (${MCUBOOT_SIGNATURE_TYPE} STREQUAL "RSA-2048")
-  add_definitions(-DMCUBOOT_SIGN_RSA_LEN=2048)
-endif()
-if (${MCUBOOT_SIGNATURE_TYPE} STREQUAL "RSA-3072")
-  add_definitions(-DMCUBOOT_SIGN_RSA_LEN=3072)
-endif()
-if (NOT ${MCUBOOT_UPGRADE_STRATEGY} STREQUAL "OVERWRITE_ONLY")
-  message(WARNING "OVERWRITE ONLY upgrade strategy is preferred on target '${TARGET_PLATFORM}'. Your choice was overriden.")
-  set(MCUBOOT_UPGRADE_STRATEGY "OVERWRITE_ONLY")
-endif()
-#install files required for flashing and performing regression
-install(FILES
-        ${PLATFORM_DIR}/target/stm/stm32l5xx/boards/scripts/stm_tool.py
-        ${PLATFORM_DIR}/../../bl2/ext/mcuboot/scripts/macro_parser.py
-        DESTINATION ./scripts/ )
-install(FILES ${PLATFORM_DIR}/target/stm/stm32l5xx/boards/stm32l562e_dk/flash_layout.h
-        ${PLATFORM_DIR}/target/stm/stm32l5xx/boards/stm32l562e_dk/region_defs.h
-        DESTINATION ./ )
-install(FILES ${PLATFORM_DIR}/target/stm/stm32l5xx/boards/scripts/regression.sh
-        ${PLATFORM_DIR}/target/stm/stm32l5xx/boards/scripts/TFM_UPDATE.sh
-        ${PLATFORM_DIR}/target/stm/stm32l5xx/boards/scripts/postbuild.sh
-        ${PREPROCESS_BL2_FILE}
-        PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
-        DESTINATION ./ )
diff --git a/platform/ext/target/stm/stm32l5xx/stm32l5xx.cmake b/platform/ext/target/stm/stm32l5xx/stm32l5xx.cmake
deleted file mode 100644
index d8d6914..0000000
--- a/platform/ext/target/stm/stm32l5xx/stm32l5xx.cmake
+++ /dev/null
@@ -1,165 +0,0 @@
-# Copyright (c) 2018, Arm Limited. All rights reserved.
-# Copyright (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-#This file gathers all stm32l5 hal specific files , CMSIS and Native Driver, application file common to all L5 family soc/board
-if (NOT DEFINED BUILD_STARTUP)
-  message(FATAL_ERROR "Configuration variable BUILD_STARTUP (true|false) is undefined!")
-elseif(BUILD_STARTUP)
-    list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/Device/Source/startup_stm32l5xx_bl2.c")
-	list(APPEND ALL_SRC_C_NS "${PLATFORM_DIR}/target/stm/stm32l5xx/Device/Source/startup_stm32l5xx_ns.c")
-	list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/Device/Source/startup_stm32l5xx_s.c")
-endif()
-#hal L5 file
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_uart.c")
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_uart_ex.c")
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_rcc.c")
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_rcc_ex.c")
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_gpio.c")
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_pwr.c")
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_pwr_ex.c")
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_exti.c")
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_gtzc.c")
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal.c")
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_cortex.c")
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_dma.c")
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_flash.c")
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_flash_ex.c")
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_rng.c")
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_rng_ex.c")
-
-    list(APPEND ALL_SRC_C_NS "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_uart.c")
-    list(APPEND ALL_SRC_C_NS "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_uart_ex.c")
-    list(APPEND ALL_SRC_C_NS "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_cortex.c")
-    list(APPEND ALL_SRC_C_NS "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_dma.c")
-    list(APPEND ALL_SRC_C_NS "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_flash.c")
-    list(APPEND ALL_SRC_C_NS "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_flash_ex.c")
-    list(APPEND ALL_SRC_C_NS "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_rcc.c")
-    list(APPEND ALL_SRC_C_NS "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_rcc_ex.c")
-    list(APPEND ALL_SRC_C_NS "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_gpio.c")
-    list(APPEND ALL_SRC_C_NS "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_pwr.c")
-    list(APPEND ALL_SRC_C_NS "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_pwr_ex.c")
-    list(APPEND ALL_SRC_C_NS "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_exti.c")
-    list(APPEND ALL_SRC_C_NS "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_gtzc.c")
-    list(APPEND ALL_SRC_C_NS "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal.c")
-
-    list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_uart.c")
-    list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_uart_ex.c")
-    list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_rcc.c")
-    list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_rcc_ex.c")
-    list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_gpio.c")
-    list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_pwr.c")
-    list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_pwr_ex.c")
-    list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_exti.c")
-    list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_gtzc.c")
-    list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal.c")
-    list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_cortex.c")
-    list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_dma.c")
-    list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_flash.c")
-    list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_flash_ex.c")
-    list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_rng.c")
-    list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/stm32l5xx_hal/Src/stm32l5xx_hal_rng_ex.c")
-#secure file
-if (NOT DEFINED BUILD_TARGET_CFG)
-  message(FATAL_ERROR "Configuration variable BUILD_TARGET_CFG (true|false) is undefined!")
-elseif(BUILD_TARGET_CFG)
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/secure/target_cfg.c")
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/secure/spm_hal.c")
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/Native_Driver/tick.c")
-	if (NOT DEFINED BUILD_TARGET_HARDWARE_KEYS)
-        message(FATAL_ERROR "Configuration variable BUILD_TARGET_HARDWARE_KEYS (true|false) is undefined!")
-	elseif(BUILD_TARGET_HARDWARE_KEYS)
-        list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/template/crypto_keys.c")
-        list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/template/tfm_rotpk.c")
-    endif()
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/template/attest_hal.c")
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/secure/system_stm32l5xx.c")
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/template/tfm_initial_attestation_key_material.c")
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/secure/tfm_platform_system.c")
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_hal_its.c")
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/common/tfm_hal_ps.c")
-  embedded_include_directories(PATH "${PLATFORM_DIR}/common" ABSOLUTE)
-  embedded_include_directories(PATH "${PLATFORM_DIR}/target/stm/stm32l5xx/Native_Driver" ABSOLUTE)
-endif()
-#non secure file
-    list(APPEND ALL_SRC_C_NS "${PLATFORM_DIR}/target/stm/stm32l5xx/Device/Source/Templates/system_stm32l5xx.c")
-#bl2 file
-    list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/bl2/boot_hal.c")
-    list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/common/template/nv_counters.c")
-    list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/bl2/tfm_low_level_security.c")
-    list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/Device/Source/Templates/system_stm32l5xx.c")
-    list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/Native_Driver/tick.c")
-    if (NOT DEFINED BUILD_TARGET_HARDWARE_KEYS)
-        message(FATAL_ERROR "Configuration variable BUILD_TARGET_HARDWARE_KEYS (true|false) is undefined!")
-    elseif(BUILD_TARGET_HARDWARE_KEYS)
-        list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/common/template/crypto_keys.c")
-        list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/common/template/tfm_rotpk.c")
-    endif()
-    list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/common/boot_hal.c")
-
-if (NOT DEFINED BUILD_NATIVE_DRIVERS)
-  message(FATAL_ERROR "Configuration variable BUILD_NATIVE_DRIVERS (true|false) is undefined!")
-elseif(BUILD_NATIVE_DRIVERS)
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/Native_Driver/low_level_rng.c")
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/Native_Driver/tick.c")
-    list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/Native_Driver/mpu_armv8m_drv.c")
-    list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/Native_Driver/mpu_armv8m_drv.c")
-    list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/Native_Driver/low_level_rng.c")
-    list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/Native_Driver/tick.c")
-  embedded_include_directories(PATH "${PLATFORM_DIR}/target/stm/stm32l5xx/Native_Driver" ABSOLUTE)
-  embedded_include_directories(PATH "${PLATFORM_DIR}/target/stm/stm32l5xx/Native_Driver" ABSOLUTE)
-endif()
-
-if (NOT DEFINED BUILD_CMSIS_DRIVERS)
-  message(FATAL_ERROR "Configuration variable BUILD_CMSIS_DRIVERS (true|false) is undefined!")
-elseif(BUILD_CMSIS_DRIVERS)
-  embedded_include_directories(PATH "${PLATFORM_DIR}/driver" ABSOLUTE)
-  embedded_include_directories(PATH "${PLATFORM_DIR}/target/stm/stm32l5xx/CMSIS_Driver" ABSOLUTE)
-  list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/CMSIS_Driver/low_level_com.c")
-  list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/CMSIS_Driver/low_level_flash.c")
-  list(APPEND ALL_SRC_C_BL2 "${PLATFORM_DIR}/target/stm/stm32l5xx/bl2/low_level_device.c")
-  list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/CMSIS_Driver/low_level_com.c")
-  list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/CMSIS_Driver/low_level_flash.c")
-  list(APPEND ALL_SRC_C_S "${PLATFORM_DIR}/target/stm/stm32l5xx/secure/low_level_device.c")
-  list(APPEND ALL_SRC_C_NS "${PLATFORM_DIR}/target/stm/stm32l5xx/CMSIS_Driver/low_level_com.c")
-endif()
-#file used for computing flash addres to update target
-set(CONTENT_FOR_BL2_PREPROCESSING
-    "#include \"${FLASH_LAYOUT}\"\n\n"
-    "enum bl2_image_attributes {\n"
-    "\tRE_IMAGE_FLASH_ADDRESS_SECURE = (FLASH_BASE_ADDRESS+FLASH_AREA_0_OFFSET),\n"
-    "\tRE_IMAGE_FLASH_ADDRESS_NON_SECURE = (FLASH_BASE_ADDRESS+FLASH_AREA_1_OFFSET),\n"
-    "\tRE_BL2_PERSO_ADDRESS = (FLASH_BASE_ADDRESS+FLASH_AREA_BL2_OFFSET),\n"
-    "\tRE_BL2_BOOT_ADDRESS = (FLASH_BASE_ADDRESS+FLASH_AREA_BL2_OFFSET),\n"
-    "\tRE_BL2_WRP_START = (FLASH_AREA_BL2_OFFSET),\n"
-    "\tRE_BL2_WRP_END = (FLASH_AREA_BL2_NOHDP_OFFSET+FLASH_AREA_BL2_NOHDP_SIZE-0x1),\n"
-    "\tRE_BL2_HDP_END = (FLASH_AREA_BL2_NOHDP_OFFSET-0x1),\n"
-   "\tRE_IMAGE_FLASH_SECURE_UPDATE = (FLASH_BASE_ADDRESS+FLASH_AREA_2_OFFSET),\n"
-    "\tRE_IMAGE_FLASH_NON_SECURE_UPDATE = (FLASH_BASE_ADDRESS+FLASH_AREA_3_OFFSET),\n"
-    "\tRE_IMAGE_FLASH_UNUSED = (FLASH_BASE_ADDRESS+FLASH_AREA_3_OFFSET+FLASH_AREA_3_SIZE),\n"
-    "\tRE_IMAGE_FLASH_SCRATCH = (FLASH_BASE_ADDRESS+FLASH_AREA_SCRATCH_OFFSET),\n"
-    "\tRE_IMAGE_FLASH_NV_COUNTERS = (FLASH_BASE_ADDRESS+FLASH_NV_COUNTERS_AREA_OFFSET),\n"
-    "\tRE_IMAGE_FLASH_NV_PS = (FLASH_BASE_ADDRESS+FLASH_PS_AREA_OFFSET),\n"
-    "\tRE_IMAGE_FLASH_NV_ITS = (FLASH_BASE_ADDRESS+FLASH_ITS_AREA_OFFSET)\n}\;"
-)
-if (REGRESSION OR CORE_TEST OR IPC_TEST OR PSA_API_TEST)
-#the define FLASH_LAYOUT_FOR_TEST
-#increase SECURE and NON SECURE IMAGE and modify the  content of  low_level_device.c from BL2 (low_level_flash.c)
-set(FLAGS_FOR_BL2_PREPROCESSING
-    "#define FLASH_LAYOUT_FOR_TEST\n"
-        "#define BL2\n"
-     )
-add_definitions("-DFLASH_LAYOUT_FOR_TEST")
-else()
-set(FLAGS_FOR_BL2_PREPROCESSING
-    "#define BL2\n"
-   )
-endif()
-
-set (BL2_FILE_TO_PREPROCESS ${CMAKE_BINARY_DIR}/image_macros_to_preprocess_bl2.c)
-string(CONCAT BL2_PREPROCESSING ${FLAGS_FOR_BL2_PREPROCESSING}
-       ${CONTENT_FOR_BL2_PREPROCESSING})
-file(WRITE ${BL2_FILE_TO_PREPROCESS} ${BL2_PREPROCESSING})