1#-------------------------------------------------------------------------------
2# Copyright (c) 2020-2024, Arm Limited. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8cmake_policy(SET CMP0076 NEW)
9
10set(STM32H573I_DK_DIR ${CMAKE_CURRENT_LIST_DIR})
11set(STM_COMMON_DIR ${STM32H573I_DK_DIR}/../common)
12
13#def for stm32h5xx
14include(${STM_COMMON_DIR}/stm32h5xx/CMakeLists.txt)
15#========================= Platform defs ===============================#
16
17# Specify the location of platform specific build dependencies.
18target_sources(tfm_s
19    PRIVATE
20        ${STM_COMMON_DIR}/stm32h5xx/Device/Source/startup_stm32h5xx_s.c
21)
22
23if(NS)
24    target_sources(tfm_ns
25        PRIVATE
26            ${STM_COMMON_DIR}/stm32h5xx/Device/Source/startup_stm32h5xx_ns.c
27    )
28endif()
29
30if(BL2)
31    target_sources(bl2
32        PRIVATE
33            ${STM_COMMON_DIR}/stm32h5xx/Device/Source/startup_stm32h5xx_bl2.c
34    )
35endif()
36
37install(FILES
38    ${STM32H573I_DK_DIR}/include/flash_layout.h
39    ${STM32H573I_DK_DIR}/include/region_defs.h
40    DESTINATION ${CMAKE_INSTALL_PREFIX}
41)
42set (BL2_FILE_TO_PREPROCESS ${CMAKE_CURRENT_BINARY_DIR}/image_macros_to_preprocess_bl2.c)
43file(WRITE ${BL2_FILE_TO_PREPROCESS} ${BL2_PREPROCESSING})
44
45install(FILES
46    ${BL2_FILE_TO_PREPROCESS}
47    DESTINATION ${CMAKE_INSTALL_PREFIX}
48)
49################# Install platform files for NS build #################
50
51# cpuarch.cmake is used to set things that related to the platform that are both
52install(FILES       ${TARGET_PLATFORM_PATH}/cpuarch.cmake
53        DESTINATION ${INSTALL_PLATFORM_NS_DIR})
54
55install(DIRECTORY   ${TARGET_PLATFORM_PATH}/ns/
56        DESTINATION ${INSTALL_PLATFORM_NS_DIR})
57
58install(DIRECTORY   ${TARGET_PLATFORM_PATH}/include
59        DESTINATION ${INSTALL_PLATFORM_NS_DIR})
60
61install(FILES       ${TARGET_PLATFORM_PATH}/accelerator/crypto_accelerator_config.h
62        DESTINATION ${INSTALL_PLATFORM_NS_DIR}/include)
63
64install(DIRECTORY   ${STM_COMMON_DIR}/hal/accelerator/
65        DESTINATION ${INSTALL_PLATFORM_NS_DIR}/include
66        FILES_MATCHING PATTERN "*.h")
67
68install(DIRECTORY   ${PLATFORM_DIR}/ext/common
69                    ${PLATFORM_DIR}/ext/driver
70        DESTINATION ${INSTALL_PLATFORM_NS_DIR}/ext)
71
72# Install test configs
73install(DIRECTORY   ${TARGET_PLATFORM_PATH}/tests
74        DESTINATION ${INSTALL_PLATFORM_NS_DIR})
75