Hi,

I am observing that the nucleo_l552ze_q platform is producing hex files that overlap
since the 1.5 release. Tested on master and 1.5.

Is there an STM maintainer that could look into this?

Steps to reproduce:

rm -rf cmake_build && cmake -S . -B cmake_build -DTFM_PLATFORM=stm/nucleo_l552ze_q -DTFM_TOOLCHAIN_FILE=toolchain_GNUARM.cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DTEST_S=ON -DTEST_NS=ON && make -C cmake_build install && /usr/bin/python3.8 /home/sebo/ncs/zephyr/scripts/mergehex.py -o merged.hex $(find cmake_build -name "*.hex")


"/usr/bin/python3.8 /home/sebo/ncs/zephyr/scripts/mergehex.py" must be replaced
with the preferred hex file merging tool.

output:

Traceback (most recent call last):
  File "/home/sebo/ncs/zephyr/scripts/mergehex.py", line 28, in merge_hex_files
    ih.merge(to_merge, overlap=overlap)
  File "/home/sebo/.local/lib/python3.8/site-packages/intelhex/__init__.py", line 875, in merge
    raise AddressOverlapError(
intelhex.AddressOverlapError: Data overlapped at address 0xC014400

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/sebo/ncs/zephyr/scripts/mergehex.py", line 56, in <module>
    main()
  File "/home/sebo/ncs/zephyr/scripts/mergehex.py", line 52, in main
    merge_hex_files(args.output, args.input_files, args.overlap)
  File "/home/sebo/ncs/zephyr/scripts/mergehex.py", line 30, in merge_hex_files
    raise AddressOverlapError("{} has merge issues".format(hex_file_path))
intelhex.AddressOverlapError: cmake_build/install/outputs/STM/NUCLEO_L552ZE_Q/tfm_s.hex has merge issues

PS: Depending on the revision tested, it might be necessary to also apply this patch:

modified   platform/ext/target/stm/common/stm32l5xx/CMakeLists.txt
@@ -90,7 +90,7 @@ target_sources(platform_s
         ${CMAKE_CURRENT_SOURCE_DIR}/hal/Src/stm32l5xx_hal_gtzc.c
         ${CMAKE_SOURCE_DIR}/platform/ext/common/tfm_hal_isolation_mpu_v8m.c
         ${CMAKE_SOURCE_DIR}/platform/ext/common/tfm_hal_nvic.c
-        $<$<BOOL:${TFM_PARTITION_PLATFORM}>:${CMAKE_CURRENT_SOURCE_DIR}/secure/tfm_platform_system>
+        $<$<BOOL:${TFM_PARTITION_PLATFORM}>:${CMAKE_CURRENT_SOURCE_DIR}/secure/tfm_platform_system.c>
         ${CMAKE_CURRENT_SOURCE_DIR}/hal/Src/stm32l5xx_hal_rng.c
         ${CMAKE_CURRENT_SOURCE_DIR}/hal/Src/stm32l5xx_hal_rng_ex.c
     PUBLIC