1#-------------------------------------------------------------------------------
2# Copyright (c) 2020, Arm Limited. All rights reserved.
3# Copyright (c) 2021 STMicroelectronics. All rights reserved.
4#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7#-------------------------------------------------------------------------------
8
9cmake_policy(SET CMP0076 NEW)
10
11set(STM32L563E_DK_DIR ${CMAKE_CURRENT_LIST_DIR})
12set(STM_COMMON_DIR ${STM32L563E_DK_DIR}/../common)
13
14#def for stm32l5xx
15include(${STM_COMMON_DIR}/stm32l5xx/CMakeLists.txt)
16#========================= Platform defs ===============================#
17
18# Specify the location of platform specific build dependencies.
19target_sources(tfm_s
20    PRIVATE
21        ${STM_COMMON_DIR}/stm32l5xx/Device/Source/startup_stm32l5xx_s.c
22)
23
24# cpuarch.cmake is used to set things that related to the platform that are both
25install(FILES
26    ${TARGET_PLATFORM_PATH}/cpuarch.cmake
27    DESTINATION ${INSTALL_PLATFORM_NS_DIR}
28)
29
30install(FILES
31    ${STM_COMMON_DIR}/stm32l5xx/Device/Source/startup_stm32l5xx_ns.c
32    DESTINATION ${INSTALL_PLATFORM_NS_DIR}/Device/Source
33)
34
35install(DIRECTORY
36    ${TARGET_PLATFORM_PATH}/ns/
37    DESTINATION ${INSTALL_PLATFORM_NS_DIR}
38)
39
40install(DIRECTORY
41    ${TARGET_PLATFORM_PATH}/include
42    DESTINATION ${INSTALL_PLATFORM_NS_DIR}
43)
44
45install(FILES
46    ${TARGET_PLATFORM_PATH}/accelerator/crypto_accelerator_config.h
47    DESTINATION ${INSTALL_PLATFORM_NS_DIR}/include
48)
49
50install(DIRECTORY
51    ${STM_COMMON_DIR}/hal/accelerator/
52    DESTINATION ${INSTALL_PLATFORM_NS_DIR}/include
53    FILES_MATCHING PATTERN "*.h"
54)
55
56install(FILES
57    ${TARGET_PLATFORM_PATH}/partition/flash_layout.h
58    ${TARGET_PLATFORM_PATH}/partition/region_defs.h
59    DESTINATION ${INSTALL_PLATFORM_NS_DIR}/partition
60)
61
62if(BL2)
63    target_sources(bl2
64        PRIVATE
65            ${STM_COMMON_DIR}/stm32l5xx/Device/Source/startup_stm32l5xx_bl2.c
66            ${STM_COMMON_DIR}/stm32l5xx/bl2/low_level_ospi_device.c
67            ${STM_COMMON_DIR}/hal/CMSIS_Driver/low_level_ospi_flash.c
68            ${STM_COMMON_DIR}/stm32l5xx/hal/Src/stm32l5xx_hal_ospi.c
69            ${STM_COMMON_DIR}/hal/Components/mx25lm51245g/mx25lm51245g.c
70            ${STM32L563E_DK_DIR}/src/stm32l562e_discovery_ospi.c
71    )
72    target_include_directories(bl2
73        PRIVATE
74            ${STM_COMMON_DIR}/Components/mx25lm51245g
75    )
76endif()
77
78install(FILES ${TARGET_PLATFORM_PATH}/partition/flash_layout.h
79              ${TARGET_PLATFORM_PATH}/partition/region_defs.h
80        DESTINATION ${CMAKE_INSTALL_PREFIX} )
81set (BL2_FILE_TO_PREPROCESS ${CMAKE_CURRENT_BINARY_DIR}/image_macros_to_preprocess_bl2.c)
82file(WRITE ${BL2_FILE_TO_PREPROCESS} ${BL2_PREPROCESSING})
83install(FILES
84    ${BL2_FILE_TO_PREPROCESS}
85    DESTINATION ${CMAKE_INSTALL_PREFIX}
86)
87