aboutsummaryrefslogtreecommitdiff
path: root/secure_fw/partitions/protected_storage/CMakeLists.txt
blob: 79d5d465120fa1b0eac7f1df426c4c30175f92f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#-------------------------------------------------------------------------------
# Copyright (c) 2020-2021, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
#-------------------------------------------------------------------------------

if (NOT TFM_PARTITION_PROTECTED_STORAGE)
    if(TFM_PARTITION_PSA_PROXY)
        add_library(tfm_app_rot_partition_ps INTERFACE)

        target_include_directories(tfm_app_rot_partition_ps
            INTERFACE
                $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
        )
    endif()
    return()
endif()

cmake_minimum_required(VERSION 3.15)
cmake_policy(SET CMP0079 NEW)

add_library(tfm_app_rot_partition_ps STATIC)

target_include_directories(tfm_app_rot_partition_ps
    INTERFACE
        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
    PRIVATE
        ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/protected_storage
)
target_include_directories(tfm_partitions
    INTERFACE
        ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/protected_storage
)

target_sources(tfm_app_rot_partition_ps
    PRIVATE
        tfm_ps_req_mngr.c
        tfm_protected_storage.c
        ps_object_system.c
        ps_object_table.c
        ps_utils.c
        $<$<BOOL:${PS_ENCRYPTION}>:crypto/ps_crypto_interface.c>
        $<$<BOOL:${PS_ENCRYPTION}>:ps_encrypted_object.c>
        # The test_ps_nv_counters.c will be used instead, when secure test is ON
        # and PS_TEST_NV_COUNTERS ON
        $<$<NOT:$<AND:$<BOOL:${TEST_S}>,$<BOOL:${PS_TEST_NV_COUNTERS}>>>:nv_counters/ps_nv_counters.c>
)

# The generated sources
target_sources(tfm_app_rot_partition_ps
    PRIVATE
        $<$<BOOL:${TFM_PSA_API}>:
            ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/protected_storage/auto_generated/intermedia_tfm_protected_storage.c>
)
target_sources(tfm_partitions
    INTERFACE
        $<$<BOOL:${TFM_PSA_API}>:
            ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/protected_storage/auto_generated/load_info_tfm_protected_storage.c>
)

target_link_libraries(tfm_app_rot_partition_ps
    PRIVATE
        tfm_secure_api
        psa_interface
        secure_fw
        platform_s
        tfm_psa_rot_partition_its
)

############################ Secure API ########################################

target_sources(tfm_sprt
    PRIVATE
        ${CMAKE_CURRENT_SOURCE_DIR}/tfm_ps_secure_api.c
)

# The veneers give warnings about not being properly declared so they get hidden
# to not overshadow _real_ warnings.
set_source_files_properties(tfm_ps_secure_api.c
    PROPERTIES
        COMPILE_FLAGS -Wno-implicit-function-declaration
)

############################ Partition Defs ####################################

target_link_libraries(tfm_partitions
    INTERFACE
        tfm_app_rot_partition_ps
)

target_compile_definitions(tfm_partition_defs
    INTERFACE
        TFM_PARTITION_PROTECTED_STORAGE
)