mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			CMake: Add mbed-psa library as a dependency to mbed-core if PSA is used
Include PSA source files only if a given Mbed target needs it. This commit also consolidates CMakeLists.txt files within the platform directorypull/13968/head
							parent
							
								
									0ac503312a
								
							
						
					
					
						commit
						c724d790c0
					
				| 
						 | 
				
			
			@ -108,7 +108,6 @@ add_subdirectory(storage EXCLUDE_FROM_ALL)
 | 
			
		|||
add_subdirectory(drivers/device_key EXCLUDE_FROM_ALL)
 | 
			
		||||
add_subdirectory(drivers/usb EXCLUDE_FROM_ALL)
 | 
			
		||||
add_subdirectory(features EXCLUDE_FROM_ALL)
 | 
			
		||||
add_subdirectory(platform/FEATURE_EXPERIMENTAL_API EXCLUDE_FROM_ALL)
 | 
			
		||||
add_subdirectory(cmsis/CMSIS_5/CMSIS/RTOS2 EXCLUDE_FROM_ALL)
 | 
			
		||||
add_subdirectory(cmsis/device/rtos EXCLUDE_FROM_ALL)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,6 +4,9 @@
 | 
			
		|||
# List of all optional platform libraries available.
 | 
			
		||||
add_library(mbed-psa INTERFACE)
 | 
			
		||||
 | 
			
		||||
if("EXPERIMENTAL_API" IN_LIST MBED_TARGET_LABELS)
 | 
			
		||||
    add_subdirectory(FEATURE_EXPERIMENTAL_API)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
add_subdirectory(cxxsupport)
 | 
			
		||||
add_subdirectory(mbed-trace)
 | 
			
		||||
| 
						 | 
				
			
			@ -16,3 +19,4 @@ target_include_directories(mbed-core
 | 
			
		|||
        include/platform
 | 
			
		||||
        include/platform/internal
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,8 +11,8 @@ endif()
 | 
			
		|||
 | 
			
		||||
target_include_directories(mbed-psa
 | 
			
		||||
    INTERFACE
 | 
			
		||||
        ./inc
 | 
			
		||||
        ./inc/psa
 | 
			
		||||
        inc
 | 
			
		||||
        inc/psa
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_sources(mbed-psa
 | 
			
		||||
| 
						 | 
				
			
			@ -20,11 +20,7 @@ target_sources(mbed-psa
 | 
			
		|||
        src/psa_hrng.c
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_link_libraries(mbed-psa
 | 
			
		||||
target_link_libraries(mbed-core
 | 
			
		||||
    INTERFACE
 | 
			
		||||
        mbed-mbedtls
 | 
			
		||||
        mbed-storage-kvstore
 | 
			
		||||
        mbed-storage-tdbstore
 | 
			
		||||
        mbed-storage-kv-global-api
 | 
			
		||||
        mbed-device_key
 | 
			
		||||
        mbed-psa
 | 
			
		||||
)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,14 +1,22 @@
 | 
			
		|||
# Copyright (c) 2020 ARM Limited. All rights reserved.
 | 
			
		||||
# SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 | 
			
		||||
add_subdirectory(services)
 | 
			
		||||
 | 
			
		||||
target_include_directories(mbed-psa
 | 
			
		||||
    INTERFACE
 | 
			
		||||
        ./inc
 | 
			
		||||
        ./inc/psa
 | 
			
		||||
        ./mbedtls
 | 
			
		||||
        ./pal
 | 
			
		||||
        inc
 | 
			
		||||
        inc/psa
 | 
			
		||||
        mbedtls
 | 
			
		||||
        pal
 | 
			
		||||
        services/platform
 | 
			
		||||
        services/attestation
 | 
			
		||||
        services/attestation/qcbor
 | 
			
		||||
        services/attestation/qcbor/inc
 | 
			
		||||
        services/attestation/qcbor/src
 | 
			
		||||
        services/attestation/tfm_impl
 | 
			
		||||
        services/attestation/tfm_impl/t_cose/inc
 | 
			
		||||
        services/attestation/tfm_impl/t_cose/src
 | 
			
		||||
        services/storage/common
 | 
			
		||||
        services/storage/its
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_sources(mbed-psa
 | 
			
		||||
| 
						 | 
				
			
			@ -26,6 +34,46 @@ target_sources(mbed-psa
 | 
			
		|||
        pal/pal_internal_trusted_storage_intf.c
 | 
			
		||||
        pal/pal_protected_storage_intf.c
 | 
			
		||||
 | 
			
		||||
        services/attestation/attest_boot_status_loader.c
 | 
			
		||||
        services/attestation/attest_crypto.c
 | 
			
		||||
        services/attestation/attest_crypto_keys.c
 | 
			
		||||
        services/attestation/attest_iat_claims_loader.c
 | 
			
		||||
        services/attestation/attestation_bootloader_data.c
 | 
			
		||||
        services/attestation/psa_attest_inject_key.c
 | 
			
		||||
        services/attestation/psa_attestation_stubs.c
 | 
			
		||||
        services/attestation/psa_initial_attestation_api.c
 | 
			
		||||
        services/attestation/psa_inject_attestation_key_impl.c
 | 
			
		||||
 | 
			
		||||
        services/attestation/qcbor/src/UsefulBuf.c
 | 
			
		||||
        services/attestation/qcbor/src/ieee754.c
 | 
			
		||||
        services/attestation/qcbor/src/qcbor_decode.c
 | 
			
		||||
        services/attestation/qcbor/src/qcbor_encode.c
 | 
			
		||||
 | 
			
		||||
        services/attestation/tfm_impl/attest_token.c
 | 
			
		||||
        services/attestation/tfm_impl/attestation_core.c
 | 
			
		||||
 | 
			
		||||
        services/attestation/tfm_impl/t_cose/src/t_cose_sign1_sign.c
 | 
			
		||||
        services/attestation/tfm_impl/t_cose/src/t_cose_util.c
 | 
			
		||||
 | 
			
		||||
        services/platform/platform_emul.c
 | 
			
		||||
        services/platform/platform_srv_impl.c
 | 
			
		||||
 | 
			
		||||
        services/storage/common/psa_storage_common_impl.cpp
 | 
			
		||||
 | 
			
		||||
        services/storage/its/pits_impl.cpp
 | 
			
		||||
        services/storage/its/psa_prot_internal_storage.cpp
 | 
			
		||||
 | 
			
		||||
        services/storage/ps/protected_storage.cpp
 | 
			
		||||
 | 
			
		||||
        src/client.c
 | 
			
		||||
        src/default_random_seed.cpp
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_link_libraries(mbed-psa
 | 
			
		||||
    INTERFACE
 | 
			
		||||
        mbed-mbedtls
 | 
			
		||||
        mbed-storage-kvstore
 | 
			
		||||
        mbed-storage-tdbstore
 | 
			
		||||
        mbed-storage-kv-global-api
 | 
			
		||||
        mbed-device_key
 | 
			
		||||
)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,16 +0,0 @@
 | 
			
		|||
# Copyright (c) 2020 ARM Limited. All rights reserved.
 | 
			
		||||
# SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 | 
			
		||||
add_subdirectory(attestation)
 | 
			
		||||
add_subdirectory(storage)
 | 
			
		||||
 | 
			
		||||
target_include_directories(mbed-psa
 | 
			
		||||
    INTERFACE
 | 
			
		||||
        ./platform
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_sources(mbed-psa
 | 
			
		||||
    INTERFACE
 | 
			
		||||
        platform/platform_emul.c
 | 
			
		||||
        platform/platform_srv_impl.c
 | 
			
		||||
)
 | 
			
		||||
| 
						 | 
				
			
			@ -1,37 +0,0 @@
 | 
			
		|||
# Copyright (c) 2020 ARM Limited. All rights reserved.
 | 
			
		||||
# SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 | 
			
		||||
target_include_directories(mbed-psa
 | 
			
		||||
    INTERFACE
 | 
			
		||||
        .
 | 
			
		||||
        ./qcbor
 | 
			
		||||
        ./qcbor/inc
 | 
			
		||||
        ./qcbor/src
 | 
			
		||||
        ./tfm_impl
 | 
			
		||||
        ./tfm_impl/t_cose/inc
 | 
			
		||||
        ./tfm_impl/t_cose/src
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_sources(mbed-psa
 | 
			
		||||
    INTERFACE
 | 
			
		||||
        attest_boot_status_loader.c
 | 
			
		||||
        attest_crypto.c
 | 
			
		||||
        attest_crypto_keys.c
 | 
			
		||||
        attest_iat_claims_loader.c
 | 
			
		||||
        attestation_bootloader_data.c
 | 
			
		||||
        psa_attest_inject_key.c
 | 
			
		||||
        psa_attestation_stubs.c
 | 
			
		||||
        psa_initial_attestation_api.c
 | 
			
		||||
        psa_inject_attestation_key_impl.c
 | 
			
		||||
 | 
			
		||||
        qcbor/src/UsefulBuf.c
 | 
			
		||||
        qcbor/src/ieee754.c
 | 
			
		||||
        qcbor/src/qcbor_decode.c
 | 
			
		||||
        qcbor/src/qcbor_encode.c
 | 
			
		||||
 | 
			
		||||
        tfm_impl/attest_token.c
 | 
			
		||||
        tfm_impl/attestation_core.c
 | 
			
		||||
 | 
			
		||||
        tfm_impl/t_cose/src/t_cose_sign1_sign.c
 | 
			
		||||
        tfm_impl/t_cose/src/t_cose_util.c
 | 
			
		||||
)
 | 
			
		||||
| 
						 | 
				
			
			@ -1,18 +0,0 @@
 | 
			
		|||
# Copyright (c) 2020 ARM Limited. All rights reserved.
 | 
			
		||||
# SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 | 
			
		||||
target_include_directories(mbed-psa
 | 
			
		||||
    INTERFACE
 | 
			
		||||
        ./common
 | 
			
		||||
        ./its
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_sources(mbed-psa
 | 
			
		||||
    INTERFACE
 | 
			
		||||
        common/psa_storage_common_impl.cpp
 | 
			
		||||
 | 
			
		||||
        its/pits_impl.cpp
 | 
			
		||||
        its/psa_prot_internal_storage.cpp
 | 
			
		||||
 | 
			
		||||
        ps/protected_storage.cpp
 | 
			
		||||
)
 | 
			
		||||
| 
						 | 
				
			
			@ -2,18 +2,32 @@
 | 
			
		|||
# SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 | 
			
		||||
if("TFM_DUALCPU" IN_LIST MBED_TARGET_LABELS)
 | 
			
		||||
    add_subdirectory(TARGET_TFM_DUALCPU)
 | 
			
		||||
    target_sources(mbed-psa
 | 
			
		||||
        INTERFACE
 | 
			
		||||
            TARGET_TFM_DUALCPU/src/platform_multicore.c
 | 
			
		||||
            TARGET_TFM_DUALCPU/src/platform_ns_mailbox.c
 | 
			
		||||
            TARGET_TFM_DUALCPU/src/tfm_mbed_boot.c
 | 
			
		||||
            TARGET_TFM_DUALCPU/src/tfm_multi_core_api.c
 | 
			
		||||
            TARGET_TFM_DUALCPU/src/tfm_multi_core_psa_ns_api.c
 | 
			
		||||
            TARGET_TFM_DUALCPU/src/tfm_ns_mailbox.c
 | 
			
		||||
    )
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if("TFM_V8M" IN_LIST MBED_TARGET_LABELS)
 | 
			
		||||
    add_subdirectory(TARGET_TFM_V8M)
 | 
			
		||||
    target_sources(mbed-psa
 | 
			
		||||
        INTERFACE
 | 
			
		||||
            TARGET_TFM_V8M/src/cmsis_nvic_virtual.c
 | 
			
		||||
            TARGET_TFM_V8M/src/tfm_mbed_boot.c
 | 
			
		||||
            TARGET_TFM_V8M/src/tfm_ns_interface.c
 | 
			
		||||
            TARGET_TFM_V8M/src/tfm_psa_ns_api.c
 | 
			
		||||
    )
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
target_include_directories(mbed-psa
 | 
			
		||||
    INTERFACE
 | 
			
		||||
        ./include
 | 
			
		||||
        ./include/psa
 | 
			
		||||
        ./include/psa_manifest
 | 
			
		||||
        include
 | 
			
		||||
        include/psa
 | 
			
		||||
        include/psa_manifest
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_sources(mbed-psa
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,12 +0,0 @@
 | 
			
		|||
# Copyright (c) 2020 ARM Limited. All rights reserved.
 | 
			
		||||
# SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 | 
			
		||||
target_sources(mbed-psa
 | 
			
		||||
    INTERFACE
 | 
			
		||||
        src/platform_multicore.c
 | 
			
		||||
        src/platform_ns_mailbox.c
 | 
			
		||||
        src/tfm_mbed_boot.c
 | 
			
		||||
        src/tfm_multi_core_api.c
 | 
			
		||||
        src/tfm_multi_core_psa_ns_api.c
 | 
			
		||||
        src/tfm_ns_mailbox.c
 | 
			
		||||
)
 | 
			
		||||
| 
						 | 
				
			
			@ -1,10 +0,0 @@
 | 
			
		|||
# Copyright (c) 2020 ARM Limited. All rights reserved.
 | 
			
		||||
# SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 | 
			
		||||
target_sources(mbed-psa
 | 
			
		||||
    INTERFACE
 | 
			
		||||
        src/cmsis_nvic_virtual.c
 | 
			
		||||
        src/tfm_mbed_boot.c
 | 
			
		||||
        src/tfm_ns_interface.c
 | 
			
		||||
        src/tfm_psa_ns_api.c
 | 
			
		||||
)
 | 
			
		||||
| 
						 | 
				
			
			@ -2,18 +2,32 @@
 | 
			
		|||
# SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 | 
			
		||||
if("TFM_DUALCPU" IN_LIST MBED_TARGET_LABELS)
 | 
			
		||||
    add_subdirectory(TARGET_TFM_DUALCPU)
 | 
			
		||||
    target_sources(mbed-psa
 | 
			
		||||
        INTERFACE
 | 
			
		||||
            TARGET_TFM_DUALCPU/src/platform_multicore.c
 | 
			
		||||
            TARGET_TFM_DUALCPU/src/platform_ns_mailbox.c
 | 
			
		||||
            TARGET_TFM_DUALCPU/src/tfm_mbed_boot.c
 | 
			
		||||
            TARGET_TFM_DUALCPU/src/tfm_multi_core_api.c
 | 
			
		||||
            TARGET_TFM_DUALCPU/src/tfm_multi_core_psa_ns_api.c
 | 
			
		||||
            TARGET_TFM_DUALCPU/src/tfm_ns_mailbox.c
 | 
			
		||||
    )
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if("TFM_V8M" IN_LIST MBED_TARGET_LABELS)
 | 
			
		||||
    add_subdirectory(TARGET_TFM_V8M)
 | 
			
		||||
    target_sources(mbed-psa
 | 
			
		||||
        INTERFACE
 | 
			
		||||
            TARGET_TFM_V8M/src/cmsis_nvic_virtual.c
 | 
			
		||||
            TARGET_TFM_V8M/src/tfm_mbed_boot.c
 | 
			
		||||
            TARGET_TFM_V8M/src/tfm_ns_interface.c
 | 
			
		||||
            TARGET_TFM_V8M/src/tfm_psa_ns_api.c
 | 
			
		||||
    )
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
target_include_directories(mbed-psa
 | 
			
		||||
    INTERFACE
 | 
			
		||||
        ./include
 | 
			
		||||
        ./include/psa
 | 
			
		||||
        ./include/psa_manifest
 | 
			
		||||
        include
 | 
			
		||||
        include/psa
 | 
			
		||||
        include/psa_manifest
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_sources(mbed-psa
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,12 +0,0 @@
 | 
			
		|||
# Copyright (c) 2020 ARM Limited. All rights reserved.
 | 
			
		||||
# SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 | 
			
		||||
target_sources(mbed-psa
 | 
			
		||||
    INTERFACE
 | 
			
		||||
        src/platform_multicore.c
 | 
			
		||||
        src/platform_ns_mailbox.c
 | 
			
		||||
        src/tfm_mbed_boot.c
 | 
			
		||||
        src/tfm_multi_core_api.c
 | 
			
		||||
        src/tfm_multi_core_psa_ns_api.c
 | 
			
		||||
        src/tfm_ns_mailbox.c
 | 
			
		||||
)
 | 
			
		||||
| 
						 | 
				
			
			@ -1,10 +0,0 @@
 | 
			
		|||
# Copyright (c) 2020 ARM Limited. All rights reserved.
 | 
			
		||||
# SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 | 
			
		||||
target_sources(mbed-psa
 | 
			
		||||
    INTERFACE
 | 
			
		||||
        src/cmsis_nvic_virtual.c
 | 
			
		||||
        src/tfm_mbed_boot.c
 | 
			
		||||
        src/tfm_ns_interface.c
 | 
			
		||||
        src/tfm_psa_ns_api.c
 | 
			
		||||
)
 | 
			
		||||
		Loading…
	
		Reference in New Issue