aboutsummaryrefslogtreecommitdiff
path: root/platform/CMakeLists.txt
diff options
context:
space:
mode:
authorRaef Coles <raef.coles@arm.com>2020-07-10 09:56:01 +0100
committerTamas Ban <tamas.ban@arm.com>2020-09-24 12:49:54 +0000
commit1cb0ecc33a59c041bf649b71acb264fe1af34c65 (patch)
tree754e7984cb0645ff4db35cc446acd736e6b25319 /platform/CMakeLists.txt
parentabfe81a4839f670c5bdedb3bb840dd6ee1ce3d2a (diff)
downloadtrusted-firmware-m-1cb0ecc33a59c041bf649b71acb264fe1af34c65.tar.gz
Build: Convert platform dir to modern cmake
Rewrite cmake files inside the platform directory. Removed generated files as they are now generated into the build tree. Move Mbed Crypto config files to lib/ext/mbedcrypto. Alter header includes where include paths have changed. WARNING: This change will not build in isolation, it requires _all_ other cmake changes to successfully build. It is split out only for clarity of changes. Change-Id: I54c6ec5e0256032450260a1b0ac9702bc8ca3700 Signed-off-by: Raef Coles <raef.coles@arm.com>
Diffstat (limited to 'platform/CMakeLists.txt')
-rw-r--r--platform/CMakeLists.txt144
1 files changed, 144 insertions, 0 deletions
diff --git a/platform/CMakeLists.txt b/platform/CMakeLists.txt
new file mode 100644
index 0000000000..70c1bcb163
--- /dev/null
+++ b/platform/CMakeLists.txt
@@ -0,0 +1,144 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+cmake_minimum_required(VERSION 3.13)
+cmake_policy(SET CMP0076 NEW)
+cmake_policy(SET CMP0079 NEW)
+
+add_library(platform_s STATIC)
+add_library(platform_region_defs INTERFACE)
+
+# under the multicore topology, NS is declared in the same place as the PSA
+# interface so that it picks up the compiler definitions for the NS CPU
+if(NOT TFM_MULTI_CORE_TOPOLOGY)
+ add_library(platform_ns STATIC)
+endif()
+
+if (BL2)
+ add_library(platform_bl2 STATIC)
+endif()
+
+set(PLATFORM_DIR ${CMAKE_CURRENT_LIST_DIR})
+
+add_subdirectory(ext/target/${TFM_PLATFORM})
+
+#========================= Platform Secure ====================================#
+
+target_include_directories(platform_s
+ PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/ext>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/ext/common>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/ext/driver>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/ext/cmsis>
+ $<$<BOOL:${CRYPTO_HW_ACCELERATOR}>:${CMAKE_CURRENT_SOURCE_DIR}/ext/accelerators/interface>
+)
+
+target_sources(platform_s
+ PRIVATE
+ ext/common/template/attest_hal.c
+ ext/common/tfm_hal_ps.c
+ ext/common/tfm_hal_its.c
+ ext/common/tfm_platform.c
+ ext/common/uart_stdout.c
+ $<$<BOOL:${PLATFORM_DUMMY_ATTEST_HAL}>:ext/common/template/attest_hal.c>
+ $<$<BOOL:${PLATFORM_DUMMY_NV_COUNTERS}>:ext/common/template/nv_counters.c>
+ $<$<BOOL:${PLATFORM_DUMMY_CRYPTO_KEYS}>:ext/common/template/crypto_keys.c>
+ $<$<BOOL:${PLATFORM_DUMMY_IAK}>:ext/common/template/tfm_initial_attestation_key_material.c>
+)
+
+target_link_libraries(platform_s
+ PUBLIC
+ platform_region_defs
+ PRIVATE
+ psa_interface
+ tfm_secure_api
+ $<$<BOOL:${BL2}>:platform_bl2>
+ tfm_arch
+)
+
+target_compile_definitions(platform_s
+ PRIVATE
+ $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION>
+)
+
+#========================= Platform Non-Secure ================================#
+
+target_include_directories(platform_ns
+ PUBLIC
+ ext
+ ext/common
+ ext/driver
+ ext/common
+ include
+ ext/cmsis
+)
+
+target_sources(platform_ns
+ PRIVATE
+ ext/common/uart_stdout.c
+)
+
+target_link_libraries(platform_ns
+ PUBLIC
+ platform_region_defs
+)
+
+#========================= Platform BL2 =======================================#
+if(BL2)
+ #TODO import policy
+ target_include_directories(platform_bl2
+ PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/ext/cmsis>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/ext/driver>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/ext/common>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/ext>
+ $<$<BOOL:${CRYPTO_HW_ACCELERATOR}>:${CMAKE_CURRENT_SOURCE_DIR}/ext/accelerators/interface>
+ )
+
+ target_sources(platform_bl2
+ PRIVATE
+ ext/common/uart_stdout.c
+ ext/common/boot_hal.c
+ $<$<BOOL:${PLATFORM_DUMMY_NV_COUNTERS}>:ext/common/template/nv_counters.c>
+ $<$<BOOL:${PLATFORM_DUMMY_CRYPTO_KEYS}>:ext/common/template/crypto_keys.c>
+ $<$<BOOL:${PLATFORM_DUMMY_ROTPK}>:ext/common/template/tfm_rotpk.c>
+ $<$<BOOL:${PLATFORM_DUMMY_IAK}>:ext/common/template/tfm_initial_attestation_key_material.c>
+ )
+
+ target_link_libraries(platform_bl2
+ PUBLIC
+ platform_region_defs
+ PRIVATE
+ psa_interface
+ bl2_hal
+ tfm_arch
+ )
+
+ target_compile_definitions(platform_bl2
+ PUBLIC
+ BL2
+ MCUBOOT_IMAGE_NUMBER=${MCUBOOT_IMAGE_NUMBER}
+ $<$<STREQUAL:${MCUBOOT_SIGNATURE_TYPE},RSA>:MCUBOOT_SIGN_RSA>
+ $<$<STREQUAL:${MCUBOOT_SIGNATURE_TYPE},RSA>:MCUBOOT_SIGN_RSA_LEN=${MCUBOOT_SIGNATURE_KEY_LEN}>
+ MCUBOOT_${MCUBOOT_UPGRADE_STRATEGY}
+ $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION>
+ $<$<BOOL:${MCUBOOT_HW_KEY}>:MCUBOOT_HW_KEY>
+ )
+endif()
+
+#========================= Platform region defs ===============================#
+
+#TODO maybe just link the other platforms to this
+target_compile_definitions(platform_region_defs
+ INTERFACE
+ $<$<BOOL:${BL2}>:BL2>
+ $<$<BOOL:${SECURE_UART1}>:SECURE_UART1>
+ DAUTH_${DEBUG_AUTHENTICATION}
+ $<$<BOOL:${BL2}>:MCUBOOT_IMAGE_NUMBER=${MCUBOOT_IMAGE_NUMBER}>
+ $<$<STREQUAL:${MCUBOOT_EXECUTION_SLOT},2>:LINK_TO_SECONDARY_PARTITION>
+)