1#-------------------------------------------------------------------------------
2# Copyright (c) 2020-2022, Arm Limited. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8if (NOT TFM_PARTITION_INTERNAL_TRUSTED_STORAGE)
9    return()
10endif()
11
12cmake_minimum_required(VERSION 3.15)
13cmake_policy(SET CMP0079 NEW)
14
15add_library(tfm_psa_rot_partition_its STATIC)
16
17target_include_directories(tfm_psa_rot_partition_its
18    PRIVATE
19        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
20        ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/internal_trusted_storage
21    PUBLIC
22        # Required for ps_object_defs.h
23        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/../protected_storage
24)
25target_include_directories(tfm_partitions
26    INTERFACE
27        ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/internal_trusted_storage
28)
29
30target_sources(tfm_psa_rot_partition_its
31    PRIVATE
32        tfm_its_req_mngr.c
33        tfm_internal_trusted_storage.c
34        its_utils.c
35        flash/its_flash.c
36        flash/its_flash_nand.c
37        flash/its_flash_nor.c
38        flash/its_flash_ram.c
39        flash_fs/its_flash_fs.c
40        flash_fs/its_flash_fs_dblock.c
41        flash_fs/its_flash_fs_mblock.c
42)
43
44# The generated sources
45target_sources(tfm_psa_rot_partition_its
46    PRIVATE
47        ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/internal_trusted_storage/auto_generated/intermedia_tfm_internal_trusted_storage.c
48)
49target_sources(tfm_partitions
50    INTERFACE
51        ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/internal_trusted_storage/auto_generated/load_info_tfm_internal_trusted_storage.c
52)
53
54target_link_libraries(tfm_psa_rot_partition_its
55    PRIVATE
56        platform_s
57        tfm_config
58        tfm_sprt
59)
60
61target_compile_definitions(tfm_psa_rot_partition_its
62    PUBLIC
63        PS_CRYPTO_AEAD_ALG=${PS_CRYPTO_AEAD_ALG}
64)
65
66################ Display the configuration being applied #######################
67
68include(utils)
69    dump_options("Storage config"
70    "
71        PS_CRYPTO_AEAD_ALG;
72    "
73    )
74
75############################ Partition Defs ####################################
76
77target_link_libraries(tfm_partitions
78    INTERFACE
79        tfm_psa_rot_partition_its
80)
81
82target_compile_definitions(tfm_partition_defs
83    INTERFACE
84        TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
85)
86