mirror of
https://git.yoctoproject.org/meta-arm
synced 2026-07-16 03:47:19 +00:00
arm-trusted-services: Add recipes for arm trusted services
Signed-off-by: Ben Horgan <ben.horgan@arm.com> Change-Id: I14ac7649ae5899578167efca45d5c19d6248cb8f
This commit is contained in:
committed by
Tushar Khandelwal
parent
5d47d3f9db
commit
cddb08a7a2
@@ -0,0 +1,14 @@
|
||||
SUMMARY = "crypto-sp secure partition"
|
||||
|
||||
require sp.inc
|
||||
|
||||
TS_DEPLOYMENT = "${S}/deployments/crypto/shim/"
|
||||
|
||||
do_install () {
|
||||
install -d -m 755 ${D}/firmware
|
||||
install -m 0644 "${B}/crypto-sp.bin" "${D}/firmware/crypto-sp.bin"
|
||||
install -m 0644 "${S}/deployments/crypto/shim/crypto.dts" \
|
||||
"${D}/firmware/crypto.dts"
|
||||
}
|
||||
|
||||
FILES_${PN} = "/firmware/crypto-sp.bin /firmware/crypto.dts"
|
||||
+13960
File diff suppressed because it is too large
Load Diff
+41
@@ -0,0 +1,41 @@
|
||||
From 5930446f09ab1df10ca70f47a3d1bb21a010effe Mon Sep 17 00:00:00 2001
|
||||
From: Davidson K <davidson.kumaresan@arm.com>
|
||||
Date: Fri, 5 Feb 2021 12:29:37 +0530
|
||||
Subject: [PATCH 02/13] Change instruction access permissions of shared memory
|
||||
|
||||
According to the FFA spec (Section 5.11.3 - Instruction Access Permissions Usage)
|
||||
the instruction access permission of the memory that has to be shared should be
|
||||
set as "Not specified and must be ignored" by the Lender in an invocation of
|
||||
FFA_MEM_SHARE or FFA_MEM_LEND ABIs.
|
||||
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Signed-off-by: Davidson K <davidson.kumaresan@arm.com>
|
||||
Change-Id: I6d84c46da8c648f93673afd7cf06a88cd4de139e
|
||||
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
|
||||
---
|
||||
components/rpc/ffarpc/caller/sp/ffarpc_caller.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/components/rpc/ffarpc/caller/sp/ffarpc_caller.c b/components/rpc/ffarpc/caller/sp/ffarpc_caller.c
|
||||
index 9d98512..269cbd4 100644
|
||||
--- a/components/rpc/ffarpc/caller/sp/ffarpc_caller.c
|
||||
+++ b/components/rpc/ffarpc/caller/sp/ffarpc_caller.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
|
||||
+ * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
@@ -211,7 +211,7 @@ int ffarpc_caller_open(struct ffarpc_caller *s, uint16_t call_ep_id)
|
||||
desc.mem_region_attr.normal_memory.shareability = sp_shareability_inner_shareable;
|
||||
|
||||
acc_desc.data_access = sp_data_access_read_write;
|
||||
- acc_desc.instruction_access = sp_instruction_access_not_executable;
|
||||
+ acc_desc.instruction_access = sp_instruction_access_not_specified;
|
||||
acc_desc.receiver_id = call_ep_id;
|
||||
|
||||
region.address = shared_buffer;
|
||||
--
|
||||
2.29.2
|
||||
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
From 6109a46678f147b6b617edf3805738f2f41b0f19 Mon Sep 17 00:00:00 2001
|
||||
From: Davidson K <davidson.kumaresan@arm.com>
|
||||
Date: Fri, 5 Feb 2021 18:27:05 +0530
|
||||
Subject: [PATCH 03/13] Set in_region_count to 0 during memory retrieve
|
||||
|
||||
in_region_count will be used during the lend, donate and share memory
|
||||
transactions and it is not needed for the retrieve request.
|
||||
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Signed-off-by: Davidson K <davidson.kumaresan@arm.com>
|
||||
Change-Id: Id9f805aa7b9e16878a1114f71cd465dc97cc5dfd
|
||||
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
|
||||
---
|
||||
components/rpc/ffarpc/endpoint/ffarpc_call_ep.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c b/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c
|
||||
index bb40cf3..8109345 100644
|
||||
--- a/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c
|
||||
+++ b/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
|
||||
+ * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
@@ -43,7 +43,7 @@ static void init_shmem_buf(struct ffa_call_ep *call_ep, uint16_t source_id,
|
||||
struct sp_memory_descriptor desc = { };
|
||||
struct sp_memory_access_descriptor acc_desc = { };
|
||||
struct sp_memory_region region = { };
|
||||
- uint32_t in_region_count = 1;
|
||||
+ uint32_t in_region_count = 0;
|
||||
uint32_t out_region_count = 1;
|
||||
uint64_t handle = 0;
|
||||
rpc_status_t rpc_status = TS_RPC_ERROR_INTERNAL;
|
||||
--
|
||||
2.29.2
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
From de8c7b4ba36606067f68799f63b1a6a7de2c1a70 Mon Sep 17 00:00:00 2001
|
||||
From: Davidson K <davidson.kumaresan@arm.com>
|
||||
Date: Fri, 19 Feb 2021 11:34:26 +0530
|
||||
Subject: [PATCH 04/13] Release rx buffer after memory retrieve request
|
||||
|
||||
After the RX buffer is consumed by the SP, the ownership has to be
|
||||
transferred to the SPM so that SPM can own it as a producer and write
|
||||
to it whenever needed.
|
||||
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Signed-off-by: Davidson K <davidson.kumaresan@arm.com>
|
||||
Change-Id: Ib058e1ef8a4f5286d1618394de2a74c3b7431476
|
||||
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
|
||||
---
|
||||
components/rpc/ffarpc/endpoint/ffarpc_call_ep.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c b/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c
|
||||
index 8109345..f65398b 100644
|
||||
--- a/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c
|
||||
+++ b/components/rpc/ffarpc/endpoint/ffarpc_call_ep.c
|
||||
@@ -40,6 +40,7 @@ static void init_shmem_buf(struct ffa_call_ep *call_ep, uint16_t source_id,
|
||||
const uint32_t *req_args, uint32_t *resp_args)
|
||||
{
|
||||
sp_result sp_res = SP_RESULT_INTERNAL_ERROR;
|
||||
+ ffa_result ffa_res;
|
||||
struct sp_memory_descriptor desc = { };
|
||||
struct sp_memory_access_descriptor acc_desc = { };
|
||||
struct sp_memory_region region = { };
|
||||
@@ -68,6 +69,11 @@ static void init_shmem_buf(struct ffa_call_ep *call_ep, uint16_t source_id,
|
||||
EMSG("memory retrieve error: %d", sp_res);
|
||||
}
|
||||
|
||||
+ ffa_res = ffa_rx_release();
|
||||
+ if (ffa_res != FFA_OK) {
|
||||
+ EMSG("ffa_rx_release(): error %"PRId32, ffa_res);
|
||||
+ }
|
||||
+
|
||||
set_mgmt_resp_args(resp_args, req_args[FFA_CALL_ARGS_OPCODE], rpc_status);
|
||||
}
|
||||
|
||||
--
|
||||
2.29.2
|
||||
|
||||
+364
@@ -0,0 +1,364 @@
|
||||
From dfd02cb62a2dad931bb81ff7eeed0a116ccc50be Mon Sep 17 00:00:00 2001
|
||||
From: Davidson K <davidson.kumaresan@arm.com>
|
||||
Date: Tue, 9 Mar 2021 17:53:03 +0530
|
||||
Subject: [PATCH 05/13] crypto-sp: Create a new deployment with the shim
|
||||
environment
|
||||
|
||||
The shim environment provides support for the trusted service to
|
||||
run as secure partition at S-EL0 and a shim layer at S-EL1 with
|
||||
Hafnium as SPMC running at S-EL2.
|
||||
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Signed-off-by: Davidson K <davidson.kumaresan@arm.com>
|
||||
Change-Id: Id3fdf50470e4b9df7388c00e445f75b7bc8362d8
|
||||
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
|
||||
---
|
||||
deployments/crypto/shim/CMakeLists.txt | 121 +++++++++++++++++++++++++
|
||||
deployments/crypto/shim/crypto.dts | 32 +++++++
|
||||
deployments/crypto/shim/crypto_sp.c | 117 ++++++++++++++++++++++++
|
||||
deployments/crypto/shim/crypto_sp.h | 18 ++++
|
||||
deployments/crypto/shim/sp_def.h | 16 ++++
|
||||
5 files changed, 304 insertions(+)
|
||||
create mode 100644 deployments/crypto/shim/CMakeLists.txt
|
||||
create mode 100644 deployments/crypto/shim/crypto.dts
|
||||
create mode 100644 deployments/crypto/shim/crypto_sp.c
|
||||
create mode 100644 deployments/crypto/shim/crypto_sp.h
|
||||
create mode 100644 deployments/crypto/shim/sp_def.h
|
||||
|
||||
diff --git a/deployments/crypto/shim/CMakeLists.txt b/deployments/crypto/shim/CMakeLists.txt
|
||||
new file mode 100644
|
||||
index 0000000..65cc215
|
||||
--- /dev/null
|
||||
+++ b/deployments/crypto/shim/CMakeLists.txt
|
||||
@@ -0,0 +1,121 @@
|
||||
+#-------------------------------------------------------------------------------
|
||||
+# Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
|
||||
+#
|
||||
+# SPDX-License-Identifier: BSD-3-Clause
|
||||
+#
|
||||
+#-------------------------------------------------------------------------------
|
||||
+cmake_minimum_required(VERSION 3.16)
|
||||
+include(../../deployment.cmake REQUIRED)
|
||||
+
|
||||
+#-------------------------------------------------------------------------------
|
||||
+# The CMakeLists.txt for building the crypto deployment with the shim layer
|
||||
+#
|
||||
+# Builds the Crypto service provider for running in an SEL0 secure partition
|
||||
+# with the shim layer in SEL1 hosted by Hafnium in the role of SPM.
|
||||
+#-------------------------------------------------------------------------------
|
||||
+include(${TS_ROOT}/environments/shim/env.cmake)
|
||||
+project(trusted-services LANGUAGES C ASM)
|
||||
+add_executable(crypto-sp)
|
||||
+target_include_directories(crypto-sp PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}")
|
||||
+set(SP_UUID "d9df52d5-16a2-4bb2-9aa4-d26d3b84e8c0")
|
||||
+
|
||||
+
|
||||
+add_components(TARGET "crypto-sp"
|
||||
+ BASE_DIR ${TS_ROOT}
|
||||
+ COMPONENTS
|
||||
+ "components/messaging/ffa/libsp"
|
||||
+ "components/rpc/ffarpc/endpoint"
|
||||
+ "components/rpc/ffarpc/caller/sp"
|
||||
+ "components/rpc/common/caller"
|
||||
+ "components/rpc/common/interface"
|
||||
+ "components/rpc/dummy"
|
||||
+ "components/service/common"
|
||||
+ "components/service/common/serializer/protobuf"
|
||||
+ "components/service/common/provider"
|
||||
+ "components/service/crypto/provider/mbedcrypto"
|
||||
+ "components/service/crypto/provider/mbedcrypto/entropy_source/mock"
|
||||
+ "components/service/crypto/provider/serializer/protobuf"
|
||||
+ "components/service/secure_storage/client/psa"
|
||||
+ "protocols/rpc/common/packed-c"
|
||||
+ "protocols/service/secure_storage/packed-c"
|
||||
+ "protocols/service/crypto/protobuf"
|
||||
+ "environments/shim"
|
||||
+)
|
||||
+
|
||||
+target_sources(crypto-sp PRIVATE
|
||||
+ crypto_sp.c
|
||||
+)
|
||||
+
|
||||
+######################################################## Build protobuf files
|
||||
+include(../../../external/nanopb/nanopb.cmake)
|
||||
+target_link_libraries(crypto-sp PRIVATE nanopb::protobuf-nanopb-static)
|
||||
+protobuf_generate_all(TGT "crypto-sp" NAMESPACE "protobuf" BASE_DIR "${TS_ROOT}/protocols")
|
||||
+
|
||||
+################################################################# mbedcrypto
|
||||
+include(../../../external/mbed-crypto/mbedcrypto.cmake)
|
||||
+target_link_libraries(crypto-sp PRIVATE mbedcrypto)
|
||||
+
|
||||
+if(CMAKE_CROSSCOMPILING)
|
||||
+ target_link_libraries(crypto-sp PRIVATE stdc++ gcc m)
|
||||
+endif()
|
||||
+
|
||||
+#################################################################
|
||||
+
|
||||
+target_compile_definitions(crypto-sp PRIVATE
|
||||
+ ARM64=1
|
||||
+ LOG_LEVEL=30
|
||||
+ CRYPTO=1
|
||||
+)
|
||||
+
|
||||
+target_include_directories(crypto-sp PRIVATE
|
||||
+ ${TS_ROOT}/deployments/crypto/shim
|
||||
+)
|
||||
+
|
||||
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
+ target_compile_options(crypto-sp PRIVATE
|
||||
+ -fdiagnostics-show-option
|
||||
+ -fpic
|
||||
+ -gdwarf-2
|
||||
+ -mstrict-align
|
||||
+ -O0
|
||||
+ -std=gnu99
|
||||
+ -ffreestanding
|
||||
+ -mgeneral-regs-only
|
||||
+ )
|
||||
+
|
||||
+ # Options for GCC that control linking
|
||||
+ target_link_options(crypto-sp PRIVATE
|
||||
+ -fno-lto
|
||||
+ -nostdlib
|
||||
+ -pie
|
||||
+ -zmax-page-size=4096
|
||||
+ )
|
||||
+ # Options directly for LD, these are not understood by GCC
|
||||
+ target_link_options(crypto-sp PRIVATE
|
||||
+ -Wl,--as-needed
|
||||
+ -Wl,--sort-section=alignment
|
||||
+ -T${CMAKE_BINARY_DIR}/crypto-sp.ld
|
||||
+ -Wl,-Map=crypto.map
|
||||
+ )
|
||||
+endif()
|
||||
+
|
||||
+compiler_generate_stripped_elf(TARGET crypto-sp NAME "${SP_UUID}.stripped.elf" RES STRIPPED_ELF)
|
||||
+compiler_generate_binary_output(TARGET crypto-sp RES STRIPPED_ELF)
|
||||
+
|
||||
+######################################## install
|
||||
+if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
+ set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE)
|
||||
+endif()
|
||||
+#TODO: api headers
|
||||
+install(TARGETS crypto-sp
|
||||
+ PUBLIC_HEADER DESTINATION ${TS_ENV}/include
|
||||
+ RUNTIME DESTINATION ${TS_ENV}/bin
|
||||
+ )
|
||||
+install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
|
||||
+
|
||||
+get_property(_PROTO_FILES TARGET crypto-sp PROPERTY PROTOBUF_FILES)
|
||||
+install(FILES ${_PROTO_FILES} DESTINATION ${TS_ENV}/lib/protobuf)
|
||||
+
|
||||
+
|
||||
+set(EXPORT_SP_NAME "crypto")
|
||||
+set(EXPORT_SP_UUID ${SP_UUID})
|
||||
diff --git a/deployments/crypto/shim/crypto.dts b/deployments/crypto/shim/crypto.dts
|
||||
new file mode 100644
|
||||
index 0000000..23bd7a2
|
||||
--- /dev/null
|
||||
+++ b/deployments/crypto/shim/crypto.dts
|
||||
@@ -0,0 +1,32 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2021, Arm Limited. All rights reserved.
|
||||
+ *
|
||||
+ * SPDX-License-Identifier: BSD-3-Clause
|
||||
+ *
|
||||
+ * This file is a Partition Manifest (PM) for Crypto Trusted Service
|
||||
+ * Secure Partition (SP).
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+
|
||||
+/ {
|
||||
+ compatible = "arm,ffa-manifest-1.0";
|
||||
+
|
||||
+ /* Properties */
|
||||
+ description = "crypto";
|
||||
+ ffa-version = <0x00010000>; /* 31:16 - Major, 15:0 - Minor */
|
||||
+ uuid = <0xd9df52d5 0x4bb216a2 0x6dd2a49a 0xc0e8843b>;
|
||||
+ id = <3>;
|
||||
+ execution-ctx-count = <1>;
|
||||
+ exception-level = <2>; /* S-EL1 */
|
||||
+ execution-state = <0>; /* AARCH64 */
|
||||
+ load-address = <0xfec00000>;
|
||||
+ entrypoint-offset = <0x00001000>;
|
||||
+ xlat-granule = <0>; /* 4KiB */
|
||||
+ boot-order = <0>;
|
||||
+ messaging-method = <0>; /* Direct messaging only */
|
||||
+ run-time-model = <1>; /* Run to completion */
|
||||
+
|
||||
+ /* Boot protocol */
|
||||
+ gp-register-num = <0x0>;
|
||||
+};
|
||||
diff --git a/deployments/crypto/shim/crypto_sp.c b/deployments/crypto/shim/crypto_sp.c
|
||||
new file mode 100644
|
||||
index 0000000..8b3eba5
|
||||
--- /dev/null
|
||||
+++ b/deployments/crypto/shim/crypto_sp.c
|
||||
@@ -0,0 +1,117 @@
|
||||
+// SPDX-License-Identifier: BSD-3-Clause
|
||||
+/*
|
||||
+ * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
|
||||
+ */
|
||||
+
|
||||
+#include <rpc/ffarpc/caller/sp/ffarpc_caller.h>
|
||||
+#include <rpc/ffarpc/endpoint/ffarpc_call_ep.h>
|
||||
+#include <rpc/dummy/dummy_caller.h>
|
||||
+#include <service/secure_storage/client/psa/its/its_client.h>
|
||||
+#include <service/crypto/provider/mbedcrypto/crypto_provider.h>
|
||||
+#include <protocols/rpc/common/packed-c/status.h>
|
||||
+#include <ffa_api.h>
|
||||
+#include <sp_api.h>
|
||||
+#include <sp_def.h>
|
||||
+#include <sp_rxtx.h>
|
||||
+#include <trace.h>
|
||||
+#include <malloc.h>
|
||||
+
|
||||
+
|
||||
+#define SP_STORAGE_UUID_BYTES \
|
||||
+ { 0x48, 0xef, 0x1e, 0xdc, 0x7a, 0xb1, 0xcf, 0x4c, \
|
||||
+ 0xac, 0x8b, 0xdf, 0xcf, 0xf7, 0x71, 0x1b, 0x14, }
|
||||
+
|
||||
+uint16_t own_id = 0; /* !!Needs refactoring as parameter to ffarpc_caller_init */
|
||||
+static const uint8_t storage_uuid[] = SP_STORAGE_UUID_BYTES;
|
||||
+
|
||||
+
|
||||
+static int sp_init(uint16_t *own_sp_id);
|
||||
+
|
||||
+uint8_t sp_heap[SP_HEAP_SIZE] __aligned(16);
|
||||
+
|
||||
+void __noreturn sp_main(struct ffa_init_info *init_info)
|
||||
+{
|
||||
+ struct mbed_crypto_provider crypto_provider;
|
||||
+ struct ffa_call_ep ffarpc_call_ep;
|
||||
+ struct call_ep *crypto_ep;
|
||||
+ struct ffarpc_caller ffarpc_caller;
|
||||
+ struct dummy_caller dummy_caller;
|
||||
+ struct rpc_caller *storage_caller;
|
||||
+ struct ffa_direct_msg req_msg;
|
||||
+ uint16_t storage_sp_ids[1];
|
||||
+
|
||||
+ /* Beginning of the boot phase */
|
||||
+ (void) init_info;
|
||||
+
|
||||
+ if (sp_init(&own_id) != 0) goto fatal_error;
|
||||
+
|
||||
+ /* Establish RPC session with secure storage SP */
|
||||
+ storage_caller = ffarpc_caller_init(&ffarpc_caller);
|
||||
+
|
||||
+ if (!ffarpc_caller_discover(storage_uuid, storage_sp_ids, sizeof(storage_sp_ids)/sizeof(storage_sp_ids[0])) ||
|
||||
+ ffarpc_caller_open(&ffarpc_caller, storage_sp_ids[0])) {
|
||||
+ /*
|
||||
+ * Failed to establish session. To allow the crypto service
|
||||
+ * to still be initialized, albeit with no persistent storage,
|
||||
+ * initialise a dummy_caller that will safely
|
||||
+ * handle rpc requests but will report an error.
|
||||
+ */
|
||||
+ storage_caller = dummy_caller_init(&dummy_caller,
|
||||
+ TS_RPC_CALL_ACCEPTED, PSA_ERROR_STORAGE_FAILURE);
|
||||
+ }
|
||||
+
|
||||
+ /* Initialize the crypto service */
|
||||
+ crypto_ep = mbed_crypto_provider_init(&crypto_provider, storage_caller);
|
||||
+ ffa_call_ep_init(&ffarpc_call_ep, crypto_ep);
|
||||
+
|
||||
+ malloc_add_pool(sp_heap, SP_HEAP_SIZE);
|
||||
+
|
||||
+ /* End of boot phase */
|
||||
+ ffa_msg_wait(&req_msg);
|
||||
+
|
||||
+ while (1) {
|
||||
+ if (req_msg.function_id == FFA_MSG_SEND_DIRECT_REQ_32) {
|
||||
+
|
||||
+ struct ffa_direct_msg resp_msg;
|
||||
+
|
||||
+ ffa_call_ep_receive(&ffarpc_call_ep, &req_msg, &resp_msg);
|
||||
+
|
||||
+ ffa_msg_send_direct_resp(req_msg.destination_id,
|
||||
+ req_msg.source_id, resp_msg.args[0], resp_msg.args[1],
|
||||
+ resp_msg.args[2], resp_msg.args[3], resp_msg.args[4],
|
||||
+ &req_msg);
|
||||
+ } else {
|
||||
+ EMSG("Received unexpected request");
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+fatal_error:
|
||||
+ /* SP is not viable */
|
||||
+ EMSG("Crypto SP error");
|
||||
+ while (1) {}
|
||||
+}
|
||||
+
|
||||
+void sp_interrupt_handler(uint32_t interrupt_id)
|
||||
+{
|
||||
+ (void)interrupt_id;
|
||||
+}
|
||||
+
|
||||
+static int sp_init(uint16_t *own_sp_id)
|
||||
+{
|
||||
+ int status = -1;
|
||||
+ sp_result sp_res;
|
||||
+ static uint8_t tx_buffer[4096] __aligned(4096);
|
||||
+ static uint8_t rx_buffer[4096] __aligned(4096);
|
||||
+
|
||||
+ sp_res = sp_rxtx_buffer_map(tx_buffer, rx_buffer, sizeof(rx_buffer));
|
||||
+ if (sp_res == SP_RESULT_OK) {
|
||||
+ ffa_result ffa_res;
|
||||
+ ffa_res = ffa_id_get(own_sp_id);
|
||||
+ if (ffa_res == FFA_OK) {
|
||||
+ status = 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return status;
|
||||
+}
|
||||
diff --git a/deployments/crypto/shim/crypto_sp.h b/deployments/crypto/shim/crypto_sp.h
|
||||
new file mode 100644
|
||||
index 0000000..e3ee0c6
|
||||
--- /dev/null
|
||||
+++ b/deployments/crypto/shim/crypto_sp.h
|
||||
@@ -0,0 +1,18 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
|
||||
+ *
|
||||
+ * SPDX-License-Identifier: BSD-3-Clause
|
||||
+ */
|
||||
+
|
||||
+#ifndef CRYPTO_SP_H
|
||||
+#define CRYPTO_SP_H
|
||||
+
|
||||
+#define CRYPTO_SP_UUID \
|
||||
+ {0xd9df52d5, 0x16a2, 0x4bb2, \
|
||||
+ {0x9a, 0xa4, 0xd2, 0x6d, 0x3b, 0x84, 0xe8, 0xc0}}
|
||||
+
|
||||
+#define CRYPTO_SP_UUID_BYTES \
|
||||
+ {0xd9, 0xdf, 0x52, 0xd5, 0x16, 0xa2, 0x4b, 0xb2, \
|
||||
+ 0x9a, 0xa4, 0xd2, 0x6d, 0x3b, 0x84, 0xe8, 0xc0}
|
||||
+
|
||||
+#endif /* CRYPTO_SP_H */
|
||||
diff --git a/deployments/crypto/shim/sp_def.h b/deployments/crypto/shim/sp_def.h
|
||||
new file mode 100644
|
||||
index 0000000..c4eff67
|
||||
--- /dev/null
|
||||
+++ b/deployments/crypto/shim/sp_def.h
|
||||
@@ -0,0 +1,16 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2021, Arm Limited. All rights reserved.
|
||||
+ *
|
||||
+ * SPDX-License-Identifier: BSD-3-Clause
|
||||
+ */
|
||||
+
|
||||
+#ifndef SP_DEF_H
|
||||
+#define SP_DEF_H
|
||||
+
|
||||
+/* Memory reserved for stacks */
|
||||
+#define SP_STACKS_SIZE (32 * 1024)
|
||||
+
|
||||
+/* Memory for heap */
|
||||
+#define SP_HEAP_SIZE (480 * 1024)
|
||||
+
|
||||
+#endif /* SP_DEF_H */
|
||||
--
|
||||
2.29.2
|
||||
|
||||
+268
@@ -0,0 +1,268 @@
|
||||
From 47bd3e42cc7e33cd2f41c98112ed159b23149023 Mon Sep 17 00:00:00 2001
|
||||
From: Davidson K <davidson.kumaresan@arm.com>
|
||||
Date: Tue, 9 Mar 2021 18:01:05 +0530
|
||||
Subject: [PATCH 06/13] secure-storage: Create a new deployment with the shim
|
||||
environment
|
||||
|
||||
The shim environment provides support for the trusted service to
|
||||
run as secure partition at S-EL0 and a shim layer at S-EL1 with
|
||||
Hafnium as SPMC running at S-EL2.
|
||||
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Signed-off-by: Davidson K <davidson.kumaresan@arm.com>
|
||||
Change-Id: I6fd23a100b5b1ab8d80742ee2f3a81bfb7595a51
|
||||
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
|
||||
---
|
||||
.../secure-storage/shim/CMakeLists.txt | 93 +++++++++++++++++++
|
||||
.../secure-storage/shim/secure-storage.dts | 33 +++++++
|
||||
deployments/secure-storage/shim/sp.c | 74 +++++++++++++++
|
||||
deployments/secure-storage/shim/sp_def.h | 16 ++++
|
||||
4 files changed, 216 insertions(+)
|
||||
create mode 100644 deployments/secure-storage/shim/CMakeLists.txt
|
||||
create mode 100644 deployments/secure-storage/shim/secure-storage.dts
|
||||
create mode 100644 deployments/secure-storage/shim/sp.c
|
||||
create mode 100644 deployments/secure-storage/shim/sp_def.h
|
||||
|
||||
diff --git a/deployments/secure-storage/shim/CMakeLists.txt b/deployments/secure-storage/shim/CMakeLists.txt
|
||||
new file mode 100644
|
||||
index 0000000..bcc3486
|
||||
--- /dev/null
|
||||
+++ b/deployments/secure-storage/shim/CMakeLists.txt
|
||||
@@ -0,0 +1,93 @@
|
||||
+#-------------------------------------------------------------------------------
|
||||
+# Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
|
||||
+#
|
||||
+# SPDX-License-Identifier: BSD-3-Clause
|
||||
+#
|
||||
+#-------------------------------------------------------------------------------
|
||||
+cmake_minimum_required(VERSION 3.16)
|
||||
+include(../../deployment.cmake REQUIRED)
|
||||
+
|
||||
+#-------------------------------------------------------------------------------
|
||||
+# The CMakeLists.txt for building the secure-storage deployment for hafnium
|
||||
+#
|
||||
+# Builds the secure storage service provider for running in an SEL0 secure
|
||||
+# partition with the shim layer in SEL1 hosted by Hafnium in the role of SPM.
|
||||
+#-------------------------------------------------------------------------------
|
||||
+include(${TS_ROOT}/environments/shim/env.cmake)
|
||||
+project(trusted-services LANGUAGES C ASM)
|
||||
+add_executable(secure-storage)
|
||||
+target_include_directories(secure-storage PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}")
|
||||
+set(SP_UUID "dc1eef48-b17a-4ccf-ac8b-dfcff7711b14")
|
||||
+
|
||||
+add_components(TARGET "secure-storage"
|
||||
+ BASE_DIR ${TS_ROOT}
|
||||
+ COMPONENTS
|
||||
+ components/messaging/ffa/libsp
|
||||
+ components/rpc/ffarpc/endpoint
|
||||
+ components/rpc/common/interface
|
||||
+ components/service/common/provider
|
||||
+ components/service/secure_storage/provider/secure_flash_store
|
||||
+ components/service/secure_storage/provider/secure_flash_store/flash_fs
|
||||
+ components/service/secure_storage/provider/secure_flash_store/flash
|
||||
+ protocols/rpc/common/packed-c
|
||||
+ protocols/service/secure_storage/packed-c
|
||||
+ environments/shim
|
||||
+)
|
||||
+
|
||||
+target_sources(secure-storage PRIVATE
|
||||
+ sp.c
|
||||
+)
|
||||
+
|
||||
+target_compile_definitions(secure-storage PRIVATE
|
||||
+ ARM64=1
|
||||
+ LOG_LEVEL=30
|
||||
+ SECURE_STORAGE=1
|
||||
+)
|
||||
+
|
||||
+target_include_directories(secure-storage PRIVATE
|
||||
+ ${TS_ROOT}/deployments/secure-storage/shim
|
||||
+)
|
||||
+
|
||||
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
+ target_compile_options(secure-storage PRIVATE
|
||||
+ -fdiagnostics-show-option
|
||||
+ -fpic
|
||||
+ -gdwarf-2
|
||||
+ -mstrict-align
|
||||
+ -O0
|
||||
+ -std=gnu99
|
||||
+ -ffreestanding
|
||||
+ -mgeneral-regs-only
|
||||
+ )
|
||||
+
|
||||
+ # Options for GCC that control linking
|
||||
+ target_link_options(secure-storage PRIVATE
|
||||
+ -fno-lto
|
||||
+ -nostdlib
|
||||
+ -pie
|
||||
+ -zmax-page-size=4096
|
||||
+ )
|
||||
+ # Options directly for LD, these are not understood by GCC
|
||||
+ target_link_options(secure-storage PRIVATE
|
||||
+ -Wl,--as-needed
|
||||
+ -Wl,--sort-section=alignment
|
||||
+ -T${CMAKE_BINARY_DIR}/secure-storage.ld
|
||||
+ -Wl,-Map=secure-storage.map
|
||||
+ )
|
||||
+endif()
|
||||
+
|
||||
+compiler_generate_stripped_elf(TARGET secure-storage NAME "${SP_UUID}.stripped.elf" RES STRIPPED_ELF)
|
||||
+compiler_generate_binary_output(TARGET secure-storage RES STRIPPED_ELF)
|
||||
+
|
||||
+######################################## install
|
||||
+if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
+ set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE)
|
||||
+endif()
|
||||
+install(TARGETS secure-storage
|
||||
+ PUBLIC_HEADER DESTINATION ${TS_ENV}/include
|
||||
+ RUNTIME DESTINATION ${TS_ENV}/bin
|
||||
+ )
|
||||
+install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
|
||||
+
|
||||
+set(EXPORT_SP_NAME "secure-storage")
|
||||
+set(EXPORT_SP_UUID ${SP_UUID})
|
||||
diff --git a/deployments/secure-storage/shim/secure-storage.dts b/deployments/secure-storage/shim/secure-storage.dts
|
||||
new file mode 100644
|
||||
index 0000000..5df3153
|
||||
--- /dev/null
|
||||
+++ b/deployments/secure-storage/shim/secure-storage.dts
|
||||
@@ -0,0 +1,33 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2021, Arm Limited. All rights reserved.
|
||||
+ *
|
||||
+ * SPDX-License-Identifier: BSD-3-Clause
|
||||
+ *
|
||||
+ * This file is a Partition Manifest (PM) for the secure-storage
|
||||
+ * Secure Partition (SP)
|
||||
+ */
|
||||
+
|
||||
+
|
||||
+/dts-v1/;
|
||||
+
|
||||
+/ {
|
||||
+ compatible = "arm,ffa-manifest-1.0";
|
||||
+
|
||||
+ /* Properties */
|
||||
+ description = "secure-storage";
|
||||
+ ffa-version = <0x00010000>; /* 31:16 - Major, 15:0 - Minor */
|
||||
+ uuid = <0xdc1eef48 0x4ccfb17a 0xcfdf8bac 0x141b71f7>;
|
||||
+ id = <2>;
|
||||
+ execution-ctx-count = <1>;
|
||||
+ exception-level = <2>; /* S-EL1 */
|
||||
+ execution-state = <0>; /* AARCH64 */
|
||||
+ load-address = <0xfee00000>;
|
||||
+ entrypoint-offset = <0x00001000>;
|
||||
+ xlat-granule = <0>; /* 4KiB */
|
||||
+ boot-order = <0>;
|
||||
+ messaging-method = <0>; /* Direct messaging only */
|
||||
+ run-time-model = <1>; /* Run to completion */
|
||||
+
|
||||
+ /* Boot protocol */
|
||||
+ gp-register-num = <0x0>;
|
||||
+};
|
||||
diff --git a/deployments/secure-storage/shim/sp.c b/deployments/secure-storage/shim/sp.c
|
||||
new file mode 100644
|
||||
index 0000000..2baec88
|
||||
--- /dev/null
|
||||
+++ b/deployments/secure-storage/shim/sp.c
|
||||
@@ -0,0 +1,74 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
|
||||
+ *
|
||||
+ * SPDX-License-Identifier: BSD-3-Clause
|
||||
+ */
|
||||
+
|
||||
+#include <ffa_api.h>
|
||||
+#include <components/rpc/common/endpoint/call_ep.h>
|
||||
+#include <components/rpc/ffarpc/endpoint/ffarpc_call_ep.h>
|
||||
+#include <components/service/secure_storage/provider/secure_flash_store/sfs_provider.h>
|
||||
+#include <components/service/common/provider/service_provider.h>
|
||||
+#include <sp_api.h>
|
||||
+#include <sp_def.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <sp_rxtx.h>
|
||||
+#include <trace.h>
|
||||
+#include <malloc.h>
|
||||
+
|
||||
+uint16_t own_id = 0;
|
||||
+static uint8_t tx_buffer[4096] __aligned(4096);
|
||||
+static uint8_t rx_buffer[4096] __aligned(4096);
|
||||
+
|
||||
+uint8_t sp_heap[SP_HEAP_SIZE] __aligned(16);
|
||||
+
|
||||
+void sp_main(struct ffa_init_info *init_info)
|
||||
+{
|
||||
+ ffa_result ffa_res;
|
||||
+ sp_result sp_res;
|
||||
+ struct call_ep *sfs_ep;
|
||||
+ struct ffa_call_ep ffa_call_ep;
|
||||
+ struct ffa_direct_msg req_msg;
|
||||
+ struct sfs_provider sfs_provider;
|
||||
+
|
||||
+ /* Beginning of boot phase */
|
||||
+ (void) init_info;
|
||||
+
|
||||
+ malloc_add_pool(sp_heap, SP_HEAP_SIZE);
|
||||
+
|
||||
+ ffa_res = ffa_id_get(&own_id);
|
||||
+ if (ffa_res != FFA_OK) {
|
||||
+ EMSG("id get error: %d", ffa_res);
|
||||
+ }
|
||||
+
|
||||
+ sp_res = sp_rxtx_buffer_map(tx_buffer, rx_buffer, sizeof(rx_buffer));
|
||||
+ if (sp_res != SP_RESULT_OK) {
|
||||
+ EMSG("rxtx map error: %d", sp_res);
|
||||
+ }
|
||||
+
|
||||
+ sfs_ep = sfs_provider_init(&sfs_provider);
|
||||
+ ffa_call_ep_init(&ffa_call_ep, sfs_ep);
|
||||
+
|
||||
+ /* End of boot phase */
|
||||
+ ffa_msg_wait(&req_msg);
|
||||
+
|
||||
+ while (1) {
|
||||
+ if (req_msg.function_id == FFA_MSG_SEND_DIRECT_REQ_32) {
|
||||
+ struct ffa_direct_msg resp_msg;
|
||||
+ ffa_call_ep_receive(&ffa_call_ep, &req_msg, &resp_msg);
|
||||
+
|
||||
+ ffa_msg_send_direct_resp(req_msg.destination_id,
|
||||
+ req_msg.source_id, resp_msg.args[0], resp_msg.args[1],
|
||||
+ resp_msg.args[2], resp_msg.args[3], resp_msg.args[4],
|
||||
+ &req_msg);
|
||||
+ } else {
|
||||
+ EMSG("Received unexpected request");
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void sp_interrupt_handler(uint32_t interrupt_id)
|
||||
+{
|
||||
+ (void)interrupt_id;
|
||||
+}
|
||||
diff --git a/deployments/secure-storage/shim/sp_def.h b/deployments/secure-storage/shim/sp_def.h
|
||||
new file mode 100644
|
||||
index 0000000..aaf045d
|
||||
--- /dev/null
|
||||
+++ b/deployments/secure-storage/shim/sp_def.h
|
||||
@@ -0,0 +1,16 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2021, Arm Limited. All rights reserved.
|
||||
+ *
|
||||
+ * SPDX-License-Identifier: BSD-3-Clause
|
||||
+ */
|
||||
+
|
||||
+#ifndef SP_DEF_H
|
||||
+#define SP_DEF_H
|
||||
+
|
||||
+/* Memory reserved for stacks */
|
||||
+#define SP_STACKS_SIZE ULL(0xa000)
|
||||
+
|
||||
+/* Memory for heap */
|
||||
+#define SP_HEAP_SIZE (300 * 1024)
|
||||
+
|
||||
+#endif /* SP_DEF_H */
|
||||
--
|
||||
2.29.2
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
From ab7c90b324371e8c0b49fb45b833d521eca3c06d Mon Sep 17 00:00:00 2001
|
||||
From: Ben Horgan <ben.horgan@arm.com>
|
||||
Date: Thu, 8 Apr 2021 09:49:13 +0000
|
||||
Subject: [PATCH 07/13] crypto: shim: Don't link against unrequired libraries
|
||||
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Change-Id: Ia1b5476d8a8d1ede0023092ddd86f079db4beb7d
|
||||
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
|
||||
---
|
||||
deployments/crypto/shim/CMakeLists.txt | 4 ----
|
||||
1 file changed, 4 deletions(-)
|
||||
|
||||
diff --git a/deployments/crypto/shim/CMakeLists.txt b/deployments/crypto/shim/CMakeLists.txt
|
||||
index 65cc215..b401d25 100644
|
||||
--- a/deployments/crypto/shim/CMakeLists.txt
|
||||
+++ b/deployments/crypto/shim/CMakeLists.txt
|
||||
@@ -55,10 +55,6 @@ protobuf_generate_all(TGT "crypto-sp" NAMESPACE "protobuf" BASE_DIR "${TS_ROOT}/
|
||||
include(../../../external/mbed-crypto/mbedcrypto.cmake)
|
||||
target_link_libraries(crypto-sp PRIVATE mbedcrypto)
|
||||
|
||||
-if(CMAKE_CROSSCOMPILING)
|
||||
- target_link_libraries(crypto-sp PRIVATE stdc++ gcc m)
|
||||
-endif()
|
||||
-
|
||||
#################################################################
|
||||
|
||||
target_compile_definitions(crypto-sp PRIVATE
|
||||
--
|
||||
2.29.2
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
From 611050d667ee7e4da0bed578b1a033315bc45ff4 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Horgan <ben.horgan@arm.com>
|
||||
Date: Thu, 8 Apr 2021 09:51:25 +0000
|
||||
Subject: [PATCH 08/13] libts: arm-linux: Add version to libts.so
|
||||
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Change-Id: I6164b05ef49553a39252717d5622dc958ad65be4
|
||||
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
|
||||
---
|
||||
deployments/libts/arm-linux/CMakeLists.txt | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/deployments/libts/arm-linux/CMakeLists.txt b/deployments/libts/arm-linux/CMakeLists.txt
|
||||
index ab512d6..a87ed48 100644
|
||||
--- a/deployments/libts/arm-linux/CMakeLists.txt
|
||||
+++ b/deployments/libts/arm-linux/CMakeLists.txt
|
||||
@@ -1,5 +1,5 @@
|
||||
#-------------------------------------------------------------------------------
|
||||
-# Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
|
||||
+# Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
@@ -45,4 +45,5 @@ include(../libts.cmake REQUIRED)
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
env_set_link_options(TGT ts)
|
||||
-target_link_libraries(ts PRIVATE gcc)
|
||||
\ No newline at end of file
|
||||
+set_target_properties(ts PROPERTIES VERSION 1.0.0 SOVERSION 1)
|
||||
+target_link_libraries(ts PRIVATE gcc)
|
||||
--
|
||||
2.29.2
|
||||
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
From 6eb38e38bc50655b659494b3ca4e53dc727f6c53 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Horgan <ben.horgan@arm.com>
|
||||
Date: Thu, 8 Apr 2021 10:00:37 +0000
|
||||
Subject: [PATCH 09/13] libts: Add option to use installed libts
|
||||
|
||||
Allows using libts as dependency of trusted service tests in yocto
|
||||
Set LIBTS_USE_INSTALLED to use installed libts. The default is
|
||||
unchanged.
|
||||
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Change-Id: Ied743afc80a490238361feea64a37faadacd8dda
|
||||
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
|
||||
---
|
||||
deployments/ts-demo/ts-demo.cmake | 14 ++++++++++++--
|
||||
deployments/ts-service-test/ts-service-test.cmake | 15 +++++++++++++--
|
||||
2 files changed, 25 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/deployments/ts-demo/ts-demo.cmake b/deployments/ts-demo/ts-demo.cmake
|
||||
index 4c85a40..f968612 100644
|
||||
--- a/deployments/ts-demo/ts-demo.cmake
|
||||
+++ b/deployments/ts-demo/ts-demo.cmake
|
||||
@@ -1,5 +1,5 @@
|
||||
#-------------------------------------------------------------------------------
|
||||
-# Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
|
||||
+# Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
@@ -16,7 +16,17 @@
|
||||
# libts will be imported for the enviroment in which service tests are
|
||||
# deployed.
|
||||
#-------------------------------------------------------------------------------
|
||||
-include(${TS_ROOT}/deployments/libts/libts-import.cmake)
|
||||
+
|
||||
+if (NOT LIBTS_USE_INSTALLED)
|
||||
+ include(${TS_ROOT}/deployments/libts/libts-import.cmake)
|
||||
+else()
|
||||
+ find_library(libts_lib ts REQUIRED)
|
||||
+ find_path(libts_inc rpc_status.h REQUIRED)
|
||||
+ add_library(libts SHARED IMPORTED)
|
||||
+ set_property(TARGET libts PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${libts_inc}")
|
||||
+ set_property(TARGET libts PROPERTY IMPORTED_LOCATION "${libts_lib}")
|
||||
+endif()
|
||||
+
|
||||
target_link_libraries(ts-demo PRIVATE libts)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
diff --git a/deployments/ts-service-test/ts-service-test.cmake b/deployments/ts-service-test/ts-service-test.cmake
|
||||
index 1593188..5f78b36 100644
|
||||
--- a/deployments/ts-service-test/ts-service-test.cmake
|
||||
+++ b/deployments/ts-service-test/ts-service-test.cmake
|
||||
@@ -1,5 +1,5 @@
|
||||
#-------------------------------------------------------------------------------
|
||||
-# Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
|
||||
+# Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
@@ -16,7 +16,18 @@
|
||||
# libts will be imported for the enviroment in which service tests are
|
||||
# deployed.
|
||||
#-------------------------------------------------------------------------------
|
||||
-include(${TS_ROOT}/deployments/libts/libts-import.cmake)
|
||||
+
|
||||
+if (NOT LIBTS_USE_INSTALLED)
|
||||
+ include(${TS_ROOT}/deployments/libts/libts-import.cmake)
|
||||
+else()
|
||||
+ find_library(libts_lib ts REQUIRED)
|
||||
+ message("benhor01: ${libts_lib}")
|
||||
+ find_path(libts_inc rpc_status.h REQUIRED)
|
||||
+ add_library(libts SHARED IMPORTED)
|
||||
+ set_property(TARGET libts PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${libts_inc}")
|
||||
+ set_property(TARGET libts PROPERTY IMPORTED_LOCATION "${libts_lib}")
|
||||
+endif()
|
||||
+
|
||||
target_link_libraries(ts-service-test PRIVATE libts)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
--
|
||||
2.29.2
|
||||
|
||||
+599
@@ -0,0 +1,599 @@
|
||||
From 10b56be594b945c70af428116ae734660d8e11bb Mon Sep 17 00:00:00 2001
|
||||
From: Ben Horgan <ben.horgan@arm.com>
|
||||
Date: Thu, 8 Apr 2021 10:07:13 +0000
|
||||
Subject: [PATCH 10/13] external: Add option to use local source or installed
|
||||
libs
|
||||
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Change-Id: I6bd466af8518a928f402f0d6474e607092c7340a
|
||||
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
|
||||
---
|
||||
external/CppUTest/CppUTest.cmake | 138 +++++++++---------
|
||||
external/mbed-crypto/mbedcrypto.cmake | 131 ++++++++++-------
|
||||
external/nanopb/nanopb.cmake | 200 +++++++++++++++-----------
|
||||
3 files changed, 264 insertions(+), 205 deletions(-)
|
||||
|
||||
diff --git a/external/CppUTest/CppUTest.cmake b/external/CppUTest/CppUTest.cmake
|
||||
index c18f3e3..9b65ae5 100644
|
||||
--- a/external/CppUTest/CppUTest.cmake
|
||||
+++ b/external/CppUTest/CppUTest.cmake
|
||||
@@ -1,44 +1,47 @@
|
||||
#-------------------------------------------------------------------------------
|
||||
-# Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
|
||||
+# Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
-set(CPPUTEST_URL "https://github.com/cpputest/cpputest.git" CACHE STRING "CppUTest repository URL")
|
||||
-set(CPPUTEST_REFSPEC "v3.8" CACHE STRING "CppUTest git refspec")
|
||||
-set(CPPUTEST_INSTALL_PATH ${CMAKE_CURRENT_BINARY_DIR}/CppUTest_install CACHE PATH "CppUTest installation directory")
|
||||
|
||||
-include(FetchContent)
|
||||
+if (NOT CPPUTEST_USE_INSTALLED)
|
||||
|
||||
-# Checking git
|
||||
-find_program(GIT_COMMAND "git")
|
||||
-if (NOT GIT_COMMAND)
|
||||
- message(FATAL_ERROR "Please install git")
|
||||
-endif()
|
||||
+ set(CPPUTEST_URL "https://github.com/cpputest/cpputest.git" CACHE STRING "CppUTest repository URL")
|
||||
+ set(CPPUTEST_REFSPEC "v3.8" CACHE STRING "CppUTest git refspec")
|
||||
+ set(CPPUTEST_INSTALL_PATH ${CMAKE_CURRENT_BINARY_DIR}/CppUTest_install CACHE PATH "CppUTest installation directory")
|
||||
+
|
||||
+ include(FetchContent)
|
||||
+
|
||||
+ # Checking git
|
||||
+ find_program(GIT_COMMAND "git")
|
||||
+ if (NOT GIT_COMMAND)
|
||||
+ message(FATAL_ERROR "Please install git")
|
||||
+ endif()
|
||||
|
||||
-# Fetching CppUTest
|
||||
-FetchContent_Declare(
|
||||
- cpputest
|
||||
- GIT_REPOSITORY ${CPPUTEST_URL}
|
||||
- GIT_TAG ${CPPUTEST_REFSPEC}
|
||||
- GIT_SHALLOW TRUE
|
||||
- PATCH_COMMAND git stash
|
||||
+ # Fetching CppUTest
|
||||
+ FetchContent_Declare(
|
||||
+ cpputest
|
||||
+ GIT_REPOSITORY ${CPPUTEST_URL}
|
||||
+ GIT_TAG ${CPPUTEST_REFSPEC}
|
||||
+ GIT_SHALLOW TRUE
|
||||
+ PATCH_COMMAND git stash
|
||||
COMMAND git apply ${CMAKE_CURRENT_LIST_DIR}/cpputest-cmake-fix.patch
|
||||
-)
|
||||
+ )
|
||||
|
||||
-# FetchContent_GetProperties exports cpputest_SOURCE_DIR and cpputest_BINARY_DIR variables
|
||||
-FetchContent_GetProperties(cpputest)
|
||||
-if(NOT cpputest_POPULATED)
|
||||
- message(STATUS "Fetching CppUTest")
|
||||
- FetchContent_Populate(cpputest)
|
||||
-endif()
|
||||
+ # FetchContent_GetProperties exports cpputest_SOURCE_DIR and cpputest_BINARY_DIR variables
|
||||
+ FetchContent_GetProperties(cpputest)
|
||||
+ if(NOT cpputest_POPULATED)
|
||||
+ message(STATUS "Fetching CppUTest")
|
||||
+ FetchContent_Populate(cpputest)
|
||||
+ endif()
|
||||
|
||||
-# Build and install CppUTest configuration time. This makes us able to use CppUTest as a CMake package.
|
||||
-# Memory leak detection is turned off to avoid conflict with memcheck.
|
||||
-if(NOT CMAKE_CROSSCOMPILING)
|
||||
- execute_process(COMMAND
|
||||
- ${CMAKE_COMMAND}
|
||||
+ # Build and install CppUTest configuration time. This makes us able to use CppUTest as a CMake package.
|
||||
+ # Memory leak detection is turned off to avoid conflict with memcheck.
|
||||
+ if(NOT CMAKE_CROSSCOMPILING)
|
||||
+ execute_process(COMMAND
|
||||
+ ${CMAKE_COMMAND}
|
||||
-DMEMORY_LEAK_DETECTION=OFF
|
||||
-DLONGLONG=ON
|
||||
-DC++11=ON
|
||||
@@ -48,47 +51,54 @@ if(NOT CMAKE_CROSSCOMPILING)
|
||||
${cpputest_SOURCE_DIR}
|
||||
WORKING_DIRECTORY
|
||||
${cpputest_BINARY_DIR}
|
||||
- RESULT_VARIABLE
|
||||
- _exec_error
|
||||
- )
|
||||
-else()
|
||||
+ RESULT_VARIABLE
|
||||
+ _exec_error
|
||||
+ )
|
||||
+ else()
|
||||
+ execute_process(COMMAND
|
||||
+ ${CMAKE_COMMAND}
|
||||
+ -DMEMORY_LEAK_DETECTION=OFF
|
||||
+ -DLONGLONG=ON
|
||||
+ -DC++11=ON
|
||||
+ -DCMAKE_INSTALL_PREFIX=${CPPUTEST_INSTALL_PATH}
|
||||
+ -DCMAKE_TOOLCHAIN_FILE=${TS_EXTERNAL_LIB_TOOLCHAIN_FILE}
|
||||
+ -DTESTS=OFF
|
||||
+ -DEXTENSIONS=OFF
|
||||
+ -DHAVE_FORK=OFF
|
||||
+ -DCPP_PLATFORM=armcc
|
||||
+ -DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY
|
||||
+ -G${CMAKE_GENERATOR}
|
||||
+ ${cpputest_SOURCE_DIR}
|
||||
+ WORKING_DIRECTORY
|
||||
+ ${cpputest_BINARY_DIR}
|
||||
+ RESULT_VARIABLE
|
||||
+ _exec_error
|
||||
+ )
|
||||
+ endif()
|
||||
+ if (NOT _exec_error EQUAL 0)
|
||||
+ message(FATAL_ERROR "Configuriong CppUTest build failed.")
|
||||
+ endif()
|
||||
execute_process(COMMAND
|
||||
- ${CMAKE_COMMAND}
|
||||
- -DMEMORY_LEAK_DETECTION=OFF
|
||||
- -DLONGLONG=ON
|
||||
- -DC++11=ON
|
||||
- -DCMAKE_INSTALL_PREFIX=${CPPUTEST_INSTALL_PATH}
|
||||
- -DCMAKE_TOOLCHAIN_FILE=${TS_EXTERNAL_LIB_TOOLCHAIN_FILE}
|
||||
- -DTESTS=OFF
|
||||
- -DEXTENSIONS=OFF
|
||||
- -DHAVE_FORK=OFF
|
||||
- -DCPP_PLATFORM=armcc
|
||||
- -DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY
|
||||
- -G${CMAKE_GENERATOR}
|
||||
- ${cpputest_SOURCE_DIR}
|
||||
- WORKING_DIRECTORY
|
||||
- ${cpputest_BINARY_DIR}
|
||||
- RESULT_VARIABLE
|
||||
- _exec_error
|
||||
- )
|
||||
-endif()
|
||||
-if (NOT _exec_error EQUAL 0)
|
||||
- message(FATAL_ERROR "Configuriong CppUTest build failed.")
|
||||
-endif()
|
||||
-execute_process(COMMAND
|
||||
- ${CMAKE_COMMAND}
|
||||
+ ${CMAKE_COMMAND}
|
||||
--build ${cpputest_BINARY_DIR}
|
||||
-- install -j8
|
||||
- RESULT_VARIABLE
|
||||
+ RESULT_VARIABLE
|
||||
_exec_error
|
||||
- )
|
||||
-if (NOT _exec_error EQUAL 0)
|
||||
- message(FATAL_ERROR "Building CppUTest failed.")
|
||||
+ )
|
||||
+ if (NOT _exec_error EQUAL 0)
|
||||
+ message(FATAL_ERROR "Building CppUTest failed.")
|
||||
+ endif()
|
||||
+
|
||||
+ # Finding CppUTest package. CMake will check [package name]_DIR variable.
|
||||
+ set(CppUTest_DIR ${CPPUTEST_INSTALL_PATH}/lib/CppUTest/cmake CACHE PATH "CppUTest package location" FORCE)
|
||||
+ find_package(CppUTest CONFIG REQUIRED NO_DEFAULT_PATH PATHS ${CppUTest_DIR})
|
||||
+
|
||||
+else()
|
||||
+
|
||||
+ find_package(CppUTest REQUIRED)
|
||||
+
|
||||
endif()
|
||||
|
||||
-# Finding CppUTest package. CMake will check [package name]_DIR variable.
|
||||
-set(CppUTest_DIR ${CPPUTEST_INSTALL_PATH}/lib/CppUTest/cmake CACHE PATH "CppUTest package location" FORCE)
|
||||
-find_package(CppUTest CONFIG REQUIRED NO_DEFAULT_PATH PATHS ${CppUTest_DIR})
|
||||
# CppUTest package files do not set include path properties on the targets.
|
||||
# Fix this here.
|
||||
foreach(_cpputest_target IN LISTS CppUTest_LIBRARIES)
|
||||
diff --git a/external/mbed-crypto/mbedcrypto.cmake b/external/mbed-crypto/mbedcrypto.cmake
|
||||
index bf00588..f681e74 100644
|
||||
--- a/external/mbed-crypto/mbedcrypto.cmake
|
||||
+++ b/external/mbed-crypto/mbedcrypto.cmake
|
||||
@@ -1,46 +1,59 @@
|
||||
#-------------------------------------------------------------------------------
|
||||
-# Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
|
||||
+# Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
-set(MBEDCRYPTO_URL "https://github.com/ARMmbed/mbed-crypto.git" CACHE STRING "mbedcrypto repository URL")
|
||||
-set(MBEDCRYPTO_REFSPEC "mbedcrypto-3.1.0" CACHE STRING "mbedcrypto git refspec")
|
||||
-set(MBEDCRYPTO_INSTALL_PATH "${CMAKE_CURRENT_BINARY_DIR}/mbedcrypto_install" CACHE PATH "mbedcrypto installation directory")
|
||||
-set(MBEDCRYPTO_PACKAGE_PATH "${MBEDCRYPTO_INSTALL_PATH}/lib/mbedcrypto/cmake" CACHE PATH "mbedcrypto CMake package directory")
|
||||
+if(NOT MBEDCRYPTO_USE_INSTALLED)
|
||||
|
||||
-include(FetchContent)
|
||||
+ include(FetchContent)
|
||||
|
||||
-# Checking git
|
||||
-find_program(GIT_COMMAND "git")
|
||||
-if (NOT GIT_COMMAND)
|
||||
- message(FATAL_ERROR "Please install git")
|
||||
-endif()
|
||||
+ if (NOT MBEDCRYPTO_SOURCE_PATH)
|
||||
|
||||
-# Fetching mbedcrypto
|
||||
-FetchContent_Declare(
|
||||
- mbedcrypto
|
||||
- GIT_REPOSITORY ${MBEDCRYPTO_URL}
|
||||
- GIT_TAG ${MBEDCRYPTO_REFSPEC}
|
||||
- GIT_SHALLOW TRUE
|
||||
-)
|
||||
-
|
||||
-# FetchContent_GetProperties exports mbedcrypto_SOURCE_DIR and mbedcrypto_BINARY_DIR variables
|
||||
-FetchContent_GetProperties(mbedcrypto)
|
||||
-if(NOT mbedcrypto_POPULATED)
|
||||
- message(STATUS "Fetching mbedcrypto")
|
||||
- FetchContent_Populate(mbedcrypto)
|
||||
-endif()
|
||||
+ set(MBEDCRYPTO_URL "https://github.com/ARMmbed/mbed-crypto.git" CACHE STRING "mbedcrypto repository URL")
|
||||
+ set(MBEDCRYPTO_REFSPEC "mbedcrypto-3.1.0" CACHE STRING "mbedcrypto git refspec")
|
||||
|
||||
-# Convert the include path list to a string. Needed to make parameter passing to
|
||||
-# mbedcrypto build work fine.
|
||||
-string(REPLACE ";" "\\;" MBEDCRYPTO_EXTRA_INCLUDES "${MBEDCRYPTO_EXTRA_INCLUDES}")
|
||||
+ # Checking git
|
||||
+ find_program(GIT_COMMAND "git")
|
||||
+ if (NOT GIT_COMMAND)
|
||||
+ message(FATAL_ERROR "Please install git")
|
||||
+ endif()
|
||||
|
||||
-#Configure the library
|
||||
-if(NOT CMAKE_CROSSCOMPILING)
|
||||
- execute_process(COMMAND
|
||||
- ${CMAKE_COMMAND}
|
||||
+ # Fetching mbedcrypto
|
||||
+ FetchContent_Declare(
|
||||
+ mbedcrypto
|
||||
+ GIT_REPOSITORY ${MBEDCRYPTO_URL}
|
||||
+ GIT_TAG ${MBEDCRYPTO_REFSPEC}
|
||||
+ GIT_SHALLOW TRUE
|
||||
+ )
|
||||
+
|
||||
+ else()
|
||||
+
|
||||
+ FetchContent_Declare(
|
||||
+ mbedcrypto
|
||||
+ SOURCE_DIR ${MBEDCRYPTO_SOURCE_PATH}
|
||||
+ )
|
||||
+
|
||||
+ endif()
|
||||
+
|
||||
+ # FetchContent_GetProperties exports mbedcrypto_SOURCE_DIR and mbedcrypto_BINARY_DIR variables
|
||||
+ FetchContent_GetProperties(mbedcrypto)
|
||||
+
|
||||
+ if(NOT mbedcrypto_POPULATED)
|
||||
+ message(STATUS "Fetching mbedcrypto")
|
||||
+ FetchContent_Populate(mbedcrypto)
|
||||
+ endif()
|
||||
+
|
||||
+ set(MBEDCRYPTO_INSTALL_PATH "${CMAKE_CURRENT_BINARY_DIR}/mbedcrypto_install" CACHE PATH "mbedcrypto installation directory")
|
||||
+ set(MBEDCRYPTO_PACKAGE_PATH "${MBEDCRYPTO_INSTALL_PATH}/lib/mbedcrypto/cmake" CACHE PATH "mbedcrypto CMake package directory")
|
||||
+ # Convert the include path list to a string. Needed to make parameter passing to
|
||||
+ # mbedcrypto build work fine.
|
||||
+ string(REPLACE ";" "\\;" MBEDCRYPTO_EXTRA_INCLUDES "${MBEDCRYPTO_EXTRA_INCLUDES}")
|
||||
+ #Configure the library
|
||||
+ if(NOT CMAKE_CROSSCOMPILING)
|
||||
+ execute_process(COMMAND
|
||||
+ ${CMAKE_COMMAND}
|
||||
-DENABLE_PROGRAMS=OFF
|
||||
-DENABLE_TESTING=OFF
|
||||
-DCMAKE_INSTALL_PREFIX=${MBEDCRYPTO_INSTALL_PATH}
|
||||
@@ -49,12 +62,12 @@ if(NOT CMAKE_CROSSCOMPILING)
|
||||
-Dthirdparty_inc=${MBEDCRYPTO_EXTRA_INCLUDES}
|
||||
-GUnix\ Makefiles
|
||||
${mbedcrypto_SOURCE_DIR}
|
||||
- WORKING_DIRECTORY
|
||||
+ WORKING_DIRECTORY
|
||||
${mbedcrypto_BINARY_DIR}
|
||||
- )
|
||||
-else()
|
||||
- execute_process(COMMAND
|
||||
- ${CMAKE_COMMAND}
|
||||
+ )
|
||||
+ else()
|
||||
+ execute_process(COMMAND
|
||||
+ ${CMAKE_COMMAND}
|
||||
-DENABLE_PROGRAMS=OFF
|
||||
-DENABLE_TESTING=OFF
|
||||
-DCMAKE_INSTALL_PREFIX=${MBEDCRYPTO_INSTALL_PATH}
|
||||
@@ -64,30 +77,38 @@ else()
|
||||
-Dthirdparty_inc=${MBEDCRYPTO_EXTRA_INCLUDES}
|
||||
-GUnix\ Makefiles
|
||||
${mbedcrypto_SOURCE_DIR}
|
||||
- WORKING_DIRECTORY
|
||||
+ WORKING_DIRECTORY
|
||||
${mbedcrypto_BINARY_DIR}
|
||||
- RESULT_VARIABLE _exec_error
|
||||
- )
|
||||
+ RESULT_VARIABLE _exec_error
|
||||
+ )
|
||||
|
||||
- if (_exec_error)
|
||||
- message(FATAL_ERROR "Configuration step of mbedcrypto failed with ${_exec_error}.")
|
||||
+ if (_exec_error)
|
||||
+ message(FATAL_ERROR "Configuration step of mbedcrypto failed with ${_exec_error}.")
|
||||
+ endif()
|
||||
endif()
|
||||
-endif()
|
||||
|
||||
-#TODO: add dependnecy to generated project on this file!
|
||||
-#TODO: add custom target to rebuild mbedcrypto
|
||||
+ #TODO: add dependnecy to generated project on this file!
|
||||
+ #TODO: add custom target to rebuild mbedcrypto
|
||||
|
||||
-#Build the library
|
||||
-execute_process(COMMAND
|
||||
+ #Build the library
|
||||
+ execute_process(COMMAND
|
||||
${CMAKE_COMMAND} --build ${mbedcrypto_BINARY_DIR} -- install -j8
|
||||
RESULT_VARIABLE _exec_error
|
||||
- )
|
||||
-if (_exec_error)
|
||||
- message(FATAL_ERROR "Build step of mbedcrypto failed with ${_exec_error}.")
|
||||
-endif()
|
||||
+ )
|
||||
+ if (_exec_error)
|
||||
+ message(FATAL_ERROR "Build step of mbedcrypto failed with ${_exec_error}.")
|
||||
+ endif()
|
||||
+
|
||||
+ add_library(mbedcrypto STATIC IMPORTED)
|
||||
+ set_property(TARGET mbedcrypto PROPERTY IMPORTED_LOCATION "${MBEDCRYPTO_INSTALL_PATH}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}mbedcrypto${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
+ set_property(TARGET mbedcrypto PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${MBEDCRYPTO_INSTALL_PATH}/include")
|
||||
|
||||
-#Create an imported target to have clean abstraction in the build-system.
|
||||
-add_library(mbedcrypto STATIC IMPORTED)
|
||||
-set_property(TARGET mbedcrypto PROPERTY IMPORTED_LOCATION "${MBEDCRYPTO_INSTALL_PATH}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}mbedcrypto${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
-set_property(TARGET mbedcrypto PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${MBEDCRYPTO_INSTALL_PATH}/include")
|
||||
+else()
|
||||
+
|
||||
+ find_library(mbedcrypto_lib mbedcrypto REQUIRED)
|
||||
+ find_path(mbedcrypto_inc mbedtls/version.h REQUIRED)
|
||||
+ add_library(mbedcrypto STATIC IMPORTED)
|
||||
+ set_property(TARGET mbedcrypto PROPERTY IMPORTED_LOCATION "${mbedcrypto_lib}")
|
||||
+ set_property(TARGET mbedcrypto PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${mbedcrypto_inc}")
|
||||
|
||||
+endif()
|
||||
diff --git a/external/nanopb/nanopb.cmake b/external/nanopb/nanopb.cmake
|
||||
index eda00e4..f6ac047 100644
|
||||
--- a/external/nanopb/nanopb.cmake
|
||||
+++ b/external/nanopb/nanopb.cmake
|
||||
@@ -1,12 +1,12 @@
|
||||
#-------------------------------------------------------------------------------
|
||||
-# Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
|
||||
+# Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
#[===[.rst:
|
||||
-NonoPB integration for cmake
|
||||
+NanoPB integration for cmake
|
||||
----------------------------
|
||||
|
||||
This module will:
|
||||
@@ -26,107 +26,135 @@ running this module.
|
||||
|
||||
#### Get the dependency
|
||||
|
||||
-set(NANOPB_URL "https://github.com/nanopb/nanopb.git" CACHE STRING "nanopb repository URL")
|
||||
-set(NANOPB_REFSPEC "nanopb-0.4.2" CACHE STRING "nanopb git refspec")
|
||||
-set(NANOPB_INSTALL_PATH "${CMAKE_CURRENT_BINARY_DIR}/nanopb_install" CACHE PATH "nanopb installation directory")
|
||||
-set(NANOPB_PACKAGE_PATH "${NANOPB_INSTALL_PATH}/libnanopb/cmake" CACHE PATH "nanopb CMake package directory")
|
||||
+if (NOT NANOPB_USE_INSTALLED)
|
||||
|
||||
-include(FetchContent)
|
||||
+ include(FetchContent)
|
||||
|
||||
-# Checking git
|
||||
-find_program(GIT_COMMAND "git")
|
||||
-if (NOT GIT_COMMAND)
|
||||
- message(FATAL_ERROR "Please install git")
|
||||
-endif()
|
||||
+ set(NANOPB_INSTALL_PATH "${CMAKE_CURRENT_BINARY_DIR}/nanopb_install" CACHE PATH "nanopb installation directory")
|
||||
+ set(NANOPB_PACKAGE_PATH "${NANOPB_INSTALL_PATH}/libnanopb/cmake" CACHE PATH "nanopb CMake package directory")
|
||||
|
||||
-# Fetching nanopb
|
||||
-FetchContent_Declare(
|
||||
- nanopb
|
||||
- GIT_REPOSITORY ${NANOPB_URL}
|
||||
- GIT_TAG ${NANOPB_REFSPEC}
|
||||
- GIT_SHALLOW TRUE
|
||||
- #See the .patch file for details on why it is needed.
|
||||
- PATCH_COMMAND git stash
|
||||
- COMMAND git apply ${CMAKE_CURRENT_LIST_DIR}/fix-pyhon-name.patch
|
||||
-)
|
||||
-
|
||||
-# FetchContent_GetProperties exports nanopb_SOURCE_DIR and nanopb_BINARY_DIR variables
|
||||
-FetchContent_GetProperties(nanopb)
|
||||
-if(NOT nanopb_POPULATED)
|
||||
- message(STATUS "Fetching nanopb")
|
||||
- FetchContent_Populate(nanopb)
|
||||
-endif()
|
||||
+ if (NOT NANOPB_SOURCE_PATH)
|
||||
|
||||
-#### Build the runtime and the generator.
|
||||
-if( NOT CMAKE_CROSSCOMPILING)
|
||||
- execute_process(COMMAND
|
||||
- ${CMAKE_COMMAND}
|
||||
- -DBUILD_SHARED_LIBS=Off
|
||||
- -DBUILD_STATIC_LIBS=On
|
||||
- -Dnanopb_BUILD_RUNTIME=On
|
||||
- -Dnanopb_BUILD_GENERATOR=On
|
||||
- -Dnanopb_PROTOC_PATH=${nanopb_SOURCE_DIR}/generator/protoc
|
||||
- -Dnanopb_MSVC_STATIC_RUNTIME=Off
|
||||
- -DCMAKE_INSTALL_PREFIX=${NANOPB_INSTALL_PATH}
|
||||
- -DCMAKE_TOOLCHAIN_FILE=${TS_EXTERNAL_LIB_TOOLCHAIN_FILE}
|
||||
- -GUnix\ Makefiles
|
||||
- ${nanopb_SOURCE_DIR}
|
||||
- WORKING_DIRECTORY
|
||||
- ${nanopb_BINARY_DIR}
|
||||
- RESULT_VARIABLE _exec_error
|
||||
- )
|
||||
-else()
|
||||
- execute_process(COMMAND
|
||||
- ${CMAKE_COMMAND}
|
||||
- -DBUILD_SHARED_LIBS=Off
|
||||
- -DBUILD_STATIC_LIBS=On
|
||||
- -Dnanopb_BUILD_RUNTIME=On
|
||||
- -Dnanopb_BUILD_GENERATOR=On
|
||||
- -Dnanopb_PROTOC_PATH=${nanopb_SOURCE_DIR}/generator/protoc
|
||||
- -Dnanopb_MSVC_STATIC_RUNTIME=Off
|
||||
- -DCMAKE_INSTALL_PREFIX=${NANOPB_INSTALL_PATH}
|
||||
- -DCMAKE_TOOLCHAIN_FILE=${TS_EXTERNAL_LIB_TOOLCHAIN_FILE}
|
||||
- -DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY
|
||||
- -GUnix\ Makefiles
|
||||
- ${nanopb_SOURCE_DIR}
|
||||
- WORKING_DIRECTORY
|
||||
- ${nanopb_BINARY_DIR}
|
||||
- RESULT_VARIABLE _exec_error
|
||||
- )
|
||||
-endif()
|
||||
+ set(NANOPB_URL "https://github.com/nanopb/nanopb.git" CACHE STRING "nanopb repository URL")
|
||||
+ set(NANOPB_REFSPEC "nanopb-0.4.2" CACHE STRING "nanopb git refspec")
|
||||
|
||||
-if (_exec_error)
|
||||
- message(FATAL_ERROR "Configuration step of nanopb runtime failed with ${_exec_error}.")
|
||||
-endif()
|
||||
+ # Checking git
|
||||
+ find_program(GIT_COMMAND "git")
|
||||
+ if (NOT GIT_COMMAND)
|
||||
+ message(FATAL_ERROR "Please install git")
|
||||
+ endif()
|
||||
+
|
||||
+ # Fetching nanopb
|
||||
+ FetchContent_Declare(
|
||||
+ nanopb
|
||||
+ GIT_REPOSITORY ${NANOPB_URL}
|
||||
+ GIT_TAG ${NANOPB_REFSPEC}
|
||||
+ GIT_SHALLOW TRUE
|
||||
+ #See the .patch file for details on why it is needed.
|
||||
+ PATCH_COMMAND git stash
|
||||
+ COMMAND git apply ${CMAKE_CURRENT_LIST_DIR}/fix-pyhon-name.patch
|
||||
+ )
|
||||
+
|
||||
+ else()
|
||||
|
||||
-execute_process(COMMAND
|
||||
+ FetchContent_Declare(
|
||||
+ nanopb
|
||||
+ SOURCE_DIR ${NANOPB_SOURCE_PATH}
|
||||
+ )
|
||||
+
|
||||
+ endif()
|
||||
+
|
||||
+ # FetchContent_GetProperties exports nanopb_SOURCE_DIR and nanopb_BINARY_DIR variables
|
||||
+ FetchContent_GetProperties(nanopb)
|
||||
+ if(NOT nanopb_POPULATED)
|
||||
+ message(STATUS "Fetching nanopb")
|
||||
+ FetchContent_Populate(nanopb)
|
||||
+ endif()
|
||||
+
|
||||
+ #### Build the runtime and the generator.
|
||||
+ if( NOT CMAKE_CROSSCOMPILING)
|
||||
+ execute_process(COMMAND
|
||||
+ ${CMAKE_COMMAND}
|
||||
+ -DBUILD_SHARED_LIBS=Off
|
||||
+ -DBUILD_STATIC_LIBS=On
|
||||
+ -Dnanopb_BUILD_RUNTIME=On
|
||||
+ -Dnanopb_BUILD_GENERATOR=On
|
||||
+ -Dnanopb_PROTOC_PATH=${nanopb_SOURCE_DIR}/generator/protoc
|
||||
+ -Dnanopb_MSVC_STATIC_RUNTIME=Off
|
||||
+ -DCMAKE_INSTALL_PREFIX=${NANOPB_INSTALL_PATH}
|
||||
+ -DCMAKE_TOOLCHAIN_FILE=${TS_EXTERNAL_LIB_TOOLCHAIN_FILE}
|
||||
+ -GUnix\ Makefiles
|
||||
+ ${nanopb_SOURCE_DIR}
|
||||
+ WORKING_DIRECTORY
|
||||
+ ${nanopb_BINARY_DIR}
|
||||
+ RESULT_VARIABLE _exec_error
|
||||
+ )
|
||||
+ else()
|
||||
+ execute_process(COMMAND
|
||||
+ ${CMAKE_COMMAND}
|
||||
+ -DBUILD_SHARED_LIBS=Off
|
||||
+ -DBUILD_STATIC_LIBS=On
|
||||
+ -Dnanopb_BUILD_RUNTIME=On
|
||||
+ -Dnanopb_BUILD_GENERATOR=On
|
||||
+ -Dnanopb_PROTOC_PATH=${nanopb_SOURCE_DIR}/generator/protoc
|
||||
+ -Dnanopb_MSVC_STATIC_RUNTIME=Off
|
||||
+ -DCMAKE_INSTALL_PREFIX=${NANOPB_INSTALL_PATH}
|
||||
+ -DCMAKE_TOOLCHAIN_FILE=${TS_EXTERNAL_LIB_TOOLCHAIN_FILE}
|
||||
+ -DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY
|
||||
+ -GUnix\ Makefiles
|
||||
+ ${nanopb_SOURCE_DIR}
|
||||
+ WORKING_DIRECTORY
|
||||
+ ${nanopb_BINARY_DIR}
|
||||
+ RESULT_VARIABLE _exec_error
|
||||
+ )
|
||||
+ endif()
|
||||
+
|
||||
+ if (_exec_error)
|
||||
+ message(FATAL_ERROR "Configuration step of nanopb runtime failed with ${_exec_error}.")
|
||||
+ endif()
|
||||
+
|
||||
+ execute_process(COMMAND
|
||||
${CMAKE_COMMAND} --build ${nanopb_BINARY_DIR} -- install -j8
|
||||
RESULT_VARIABLE _exec_error
|
||||
- )
|
||||
-if (_exec_error)
|
||||
- message(FATAL_ERROR "Build step of nanopb runtime failed with ${_exec_error}.")
|
||||
-endif()
|
||||
+ )
|
||||
+ if (_exec_error)
|
||||
+ message(FATAL_ERROR "Build step of nanopb runtime failed with ${_exec_error}.")
|
||||
+ endif()
|
||||
|
||||
-#### Include Nanopb runtime in the build.
|
||||
-find_package(Nanopb
|
||||
- PATHS "${NANOPB_INSTALL_PATH}"
|
||||
- NO_DEFAULT_PATH
|
||||
+ #### Include Nanopb runtime in the build.
|
||||
+ find_package(Nanopb
|
||||
+ PATHS "${NANOPB_INSTALL_PATH}"
|
||||
+ NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
-#### Build access to the protobuf compiler
|
||||
-#TODO: verify protoc dependencies: python3-protobuf
|
||||
-find_package(Python3 COMPONENTS Interpreter)
|
||||
+else()
|
||||
+
|
||||
+ #### Build access to the protobuf compiler
|
||||
+ #TODO: verify protoc dependencies: python3-protobuf
|
||||
+ find_package(Nanopb REQUIRED)
|
||||
+
|
||||
+endif()
|
||||
|
||||
+find_package(Python3 COMPONENTS Interpreter)
|
||||
if (NOT Python3_Interpreter_FOUND)
|
||||
message(FATAL_ERROR "Failed to find python3 interpreter.")
|
||||
endif()
|
||||
|
||||
-find_file(NANOPB_GENERATOR_PATH
|
||||
- NAMES nanopb_generator.py
|
||||
- PATHS ${nanopb_SOURCE_DIR}/generator
|
||||
- DOC "nanopb protobuf compiler"
|
||||
- NO_DEFAULT_PATH
|
||||
+if (NOT NANOPB_USE_INSTALLED)
|
||||
+ find_file(NANOPB_GENERATOR_PATH
|
||||
+ NAMES nanopb_generator.py
|
||||
+ PATHS "${nanopb_SOURCE_DIR}/generator"
|
||||
+ DOC "nanopb protobuf compiler"
|
||||
+ REQUIRED
|
||||
+ NO_DEFAULT_PATH
|
||||
+ )
|
||||
+else()
|
||||
+ find_file(NANOPB_GENERATOR_PATH
|
||||
+ NAMES nanopb_generator.py
|
||||
+ DOC "nanopb protobuf compiler"
|
||||
+ REQUIRED
|
||||
)
|
||||
+endif()
|
||||
|
||||
if (NOT NANOPB_GENERATOR_PATH)
|
||||
message(FATAL_ERROR "Nanopb generator was not found!")
|
||||
--
|
||||
2.29.2
|
||||
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
From 0075dc6cf30df6a2d91ab3870dabed4ac220a468 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Horgan <ben.horgan@arm.com>
|
||||
Date: Mon, 22 Mar 2021 11:00:40 +0000
|
||||
Subject: [PATCH 11/13] aarch64: Allow the stack to be further than 1MB from
|
||||
where it is set up
|
||||
|
||||
Trusted-services crypto was previously building with the linaro 7.5
|
||||
aarch64-linux-gnu but not with arm 10.2 aarch64-none-linux-gnu.
|
||||
Build error was:
|
||||
aarch64/sp_entrypoint.S:22:(.text.sp_entrypoint+0x0):
|
||||
relocation truncated to fit: R_AARCH64_ADR_PREL_LO21 against `.bss.stacks'
|
||||
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
|
||||
Change-Id: Ia422722c986bce50543f026ccbad728e6938f2b0
|
||||
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
|
||||
---
|
||||
environments/shim/aarch64/sp_entrypoint.S | 7 ++++---
|
||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/environments/shim/aarch64/sp_entrypoint.S b/environments/shim/aarch64/sp_entrypoint.S
|
||||
index 8ef330b..ee7f84d 100644
|
||||
--- a/environments/shim/aarch64/sp_entrypoint.S
|
||||
+++ b/environments/shim/aarch64/sp_entrypoint.S
|
||||
@@ -12,17 +12,18 @@
|
||||
.globl sp_entrypoint
|
||||
|
||||
.section .bss.stacks
|
||||
- .balign CACHE_WRITEBACK_GRANULE
|
||||
+ .balign CACHE_WRITEBACK_GRANULE
|
||||
.fill SP_STACKS_SIZE
|
||||
stacks_end:
|
||||
|
||||
func sp_entrypoint
|
||||
|
||||
/* Setup the stack pointer. */
|
||||
- adr x0, stacks_end
|
||||
+ adrp x0, stacks_end
|
||||
+ add x0, x0, :lo12:stacks_end
|
||||
mov sp, x0
|
||||
/* Mask FIQs */
|
||||
- msr daifset, #DAIF_FIQ_BIT
|
||||
+ msr daifset, #DAIF_FIQ_BIT
|
||||
isb
|
||||
|
||||
/* And jump to the C entrypoint. */
|
||||
--
|
||||
2.29.2
|
||||
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
From 78ddf721076d2baca395f418973d5eb5d19ec4ab Mon Sep 17 00:00:00 2001
|
||||
From: Ben Horgan <ben.horgan@arm.com>
|
||||
Date: Tue, 30 Mar 2021 13:15:54 +0000
|
||||
Subject: [PATCH 12/13] libc: Add missing libc function declarations
|
||||
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Change-Id: I00e54db41b3226cc60a89bf4a81edea0a6fbb2a5
|
||||
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
|
||||
---
|
||||
environments/shim/include/lib/libc/assert.h | 4 +---
|
||||
environments/shim/include/lib/libc/memory.h | 7 +++++++
|
||||
environments/shim/include/lib/libc/stdint.h | 18 +++++++++---------
|
||||
environments/shim/include/lib/libc/stdlib.h | 2 ++
|
||||
4 files changed, 19 insertions(+), 12 deletions(-)
|
||||
create mode 100644 environments/shim/include/lib/libc/memory.h
|
||||
|
||||
diff --git a/environments/shim/include/lib/libc/assert.h b/environments/shim/include/lib/libc/assert.h
|
||||
index ec28c26..e32259b 100644
|
||||
--- a/environments/shim/include/lib/libc/assert.h
|
||||
+++ b/environments/shim/include/lib/libc/assert.h
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
- * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
|
||||
+ * Copyright (c) 2018 - 2021, ARM Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
#include <cdefs.h>
|
||||
|
||||
-#include <common/debug.h>
|
||||
-
|
||||
#if ENABLE_ASSERTIONS
|
||||
#define assert(e) ((e) ? (void)0 : __assert(__FILE__, __LINE__, #e))
|
||||
#else
|
||||
diff --git a/environments/shim/include/lib/libc/memory.h b/environments/shim/include/lib/libc/memory.h
|
||||
new file mode 100644
|
||||
index 0000000..823bf26
|
||||
--- /dev/null
|
||||
+++ b/environments/shim/include/lib/libc/memory.h
|
||||
@@ -0,0 +1,7 @@
|
||||
+/*
|
||||
+ * Copyright (c) 2021, ARM Limited and Contributors. All rights reserved.
|
||||
+ *
|
||||
+ * SPDX-License-Identifier: BSD-3-Clause
|
||||
+ */
|
||||
+
|
||||
+#include <string.h>
|
||||
diff --git a/environments/shim/include/lib/libc/stdint.h b/environments/shim/include/lib/libc/stdint.h
|
||||
index d5dbfc4..b636299 100644
|
||||
--- a/environments/shim/include/lib/libc/stdint.h
|
||||
+++ b/environments/shim/include/lib/libc/stdint.h
|
||||
@@ -107,15 +107,15 @@ typedef unsigned short uint16_least_t;
|
||||
typedef unsigned int uint32_least_t;
|
||||
typedef unsigned long long uint64_least_t;
|
||||
|
||||
-typedef int int8_fast_t;
|
||||
-typedef int int16_fast_t;
|
||||
-typedef int int32_fast_t;
|
||||
-typedef long long int64_fast_t;
|
||||
-
|
||||
-typedef unsigned int uint8_fast_t;
|
||||
-typedef unsigned int uint16_fast_t;
|
||||
-typedef unsigned int uint32_fast_t;
|
||||
-typedef unsigned long long uint64_fast_t;
|
||||
+typedef int int_fast8_t;
|
||||
+typedef int int_fast16_t;
|
||||
+typedef int int_fast32_t;
|
||||
+typedef long long int_fast64_t;
|
||||
+
|
||||
+typedef unsigned int uint_fast8_t;
|
||||
+typedef unsigned int uint_fast16_t;
|
||||
+typedef unsigned int uint_fast32_t;
|
||||
+typedef unsigned long long uint_fast64_t;
|
||||
|
||||
typedef long intptr_t;
|
||||
typedef unsigned long uintptr_t;
|
||||
diff --git a/environments/shim/include/lib/libc/stdlib.h b/environments/shim/include/lib/libc/stdlib.h
|
||||
index bbd6889..7f01cfb 100644
|
||||
--- a/environments/shim/include/lib/libc/stdlib.h
|
||||
+++ b/environments/shim/include/lib/libc/stdlib.h
|
||||
@@ -30,5 +30,7 @@ void srand(unsigned int seed);
|
||||
void malloc_add_pool(void *buf, size_t len);
|
||||
void *malloc(size_t size);
|
||||
void free(void *ptr);
|
||||
+void *calloc(size_t nmemb, size_t size);
|
||||
+void *realloc(void *ptr, size_t size);
|
||||
|
||||
#endif /* STDLIB_H */
|
||||
--
|
||||
2.29.2
|
||||
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
From 8603e07c95ec9c543c38181f60d0a3ead4a5f237 Mon Sep 17 00:00:00 2001
|
||||
From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
|
||||
Date: Mon, 12 Apr 2021 13:12:41 +0100
|
||||
Subject: [PATCH 13/13] libsp: modify FFA ABIs with supported convention
|
||||
|
||||
SPMC at SEL2 (hafnium) only supports 64-bit variant of FFA_RXTX_MAP
|
||||
|
||||
Upstream-Status: Pending [Not submitted to upstream yet]
|
||||
Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
|
||||
Change-Id: I17ba68bc298fd5d26dbead23dd0750b84319d9c6
|
||||
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
|
||||
---
|
||||
components/messaging/ffa/libsp/ffa.c | 6 +++---
|
||||
components/messaging/ffa/libsp/sp_rxtx.c | 4 ++--
|
||||
2 files changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/components/messaging/ffa/libsp/ffa.c b/components/messaging/ffa/libsp/ffa.c
|
||||
index 648d3c8..2bdd31b 100644
|
||||
--- a/components/messaging/ffa/libsp/ffa.c
|
||||
+++ b/components/messaging/ffa/libsp/ffa.c
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
/*
|
||||
- * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
|
||||
+ * Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <assert.h> // for assert
|
||||
@@ -133,14 +133,14 @@ ffa_result ffa_rxtx_map(const void *tx_buffer, const void *rx_buffer,
|
||||
page_count = SHIFT_U32(page_count & FFA_RXTX_MAP_PAGE_COUNT_MASK,
|
||||
FFA_RXTX_MAP_PAGE_COUNT_SHIFT);
|
||||
|
||||
- ffa_svc(FFA_RXTX_MAP_32, (uintptr_t)tx_buffer, (uintptr_t)rx_buffer,
|
||||
+ ffa_svc(FFA_RXTX_MAP_64, (uintptr_t)tx_buffer, (uintptr_t)rx_buffer,
|
||||
page_count, FFA_PARAM_MBZ, FFA_PARAM_MBZ, FFA_PARAM_MBZ,
|
||||
FFA_PARAM_MBZ, &result);
|
||||
|
||||
if (result.a0 == FFA_ERROR)
|
||||
return ffa_get_errorcode(&result);
|
||||
|
||||
- assert(result.a0 == FFA_SUCCESS_32);
|
||||
+ assert(result.a0 == FFA_SUCCESS_64);
|
||||
return FFA_OK;
|
||||
}
|
||||
|
||||
diff --git a/components/messaging/ffa/libsp/sp_rxtx.c b/components/messaging/ffa/libsp/sp_rxtx.c
|
||||
index a3de270..9468d83 100644
|
||||
--- a/components/messaging/ffa/libsp/sp_rxtx.c
|
||||
+++ b/components/messaging/ffa/libsp/sp_rxtx.c
|
||||
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
/*
|
||||
- * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
|
||||
+ * Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "sp_rxtx.h"
|
||||
@@ -99,7 +99,7 @@ sp_result sp_rxtx_buffer_alignment_boundary_get(uintptr_t *alignment)
|
||||
return SP_RESULT_INVALID_PARAMETERS;
|
||||
|
||||
/* Querying FFX_RXTX_MAP features */
|
||||
- result = ffa_features(FFA_RXTX_MAP_32, &interface_props);
|
||||
+ result = ffa_features(FFA_RXTX_MAP_64, &interface_props);
|
||||
if (result != FFA_OK) {
|
||||
*alignment = 0;
|
||||
return SP_RESULT_FFA(result);
|
||||
--
|
||||
2.29.2
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
SUMMARY = "Trusted services linux library"
|
||||
HOMEPAGE = "https://trusted-services.readthedocs.io/en/latest/index.html"
|
||||
|
||||
LICENSE = "BSD-3-Clause"
|
||||
LIC_FILES_CHKSUM = "file://license.rst;md5=ea160bac7f690a069c608516b17997f4"
|
||||
|
||||
SRC_URI = "git://git.trustedfirmware.org/TS/trusted-services.git;protocol=https;branch=integration \
|
||||
file://0001-Add-a-new-environment-to-run-TS-with-a-shim-layer-in.patch \
|
||||
file://0002-Change-instruction-access-permissions-of-shared-memo.patch \
|
||||
file://0003-Set-in_region_count-to-0-during-memory-retrieve.patch \
|
||||
file://0004-Release-rx-buffer-after-memory-retrieve-request.patch \
|
||||
file://0005-crypto-sp-Create-a-new-deployment-with-the-shim-envi.patch \
|
||||
file://0006-secure-storage-Create-a-new-deployment-with-the-shim.patch \
|
||||
file://0007-crypto-shim-Don-t-link-against-unrequired-libraries.patch \
|
||||
file://0008-libts-arm-linux-Add-version-to-libts.so.patch \
|
||||
file://0009-libts-Add-option-to-use-installed-libts.patch \
|
||||
file://0010-external-Add-option-to-use-local-source-or-installed.patch \
|
||||
file://0011-aarch64-Allow-the-stack-to-be-further-than-1MB-from-.patch \
|
||||
file://0012-libc-Add-missing-libc-function-declarations.patch \
|
||||
file://0013-libsp-modify-FFA-ABIs-with-supported-convention.patch \
|
||||
"
|
||||
|
||||
PV = "1.0+git${SRCPV}"
|
||||
SRCREV = "eff4b28b6ae461defb2d8c0f614965439ed19386"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
inherit python3native cmake
|
||||
|
||||
DEPENDS = "python3-pycryptodome-native python3-pycryptodomex-native \
|
||||
python3-pyelftools-native python3-grpcio-tools-native \
|
||||
python3-protobuf-native protobuf-native nanopb-native \
|
||||
ts-mbedcrypto \
|
||||
"
|
||||
|
||||
OECMAKE_SOURCEPATH = "${S}/deployments/libts/arm-linux"
|
||||
OECMAKE_GENERATOR = "Unix Makefiles"
|
||||
EXTRA_OECMAKE = "-DCMAKE_POSITION_INDEPENDENT_CODE=True \
|
||||
-DCMAKE_SYSTEM_NAME=Linux \
|
||||
-DCMAKE_SYSTEM_PROCESSOR=arm \
|
||||
"
|
||||
@@ -0,0 +1,14 @@
|
||||
SUMMARY = "Secure storage secure partition"
|
||||
|
||||
require sp.inc
|
||||
|
||||
TS_DEPLOYMENT = "${S}/deployments/secure-storage/shim"
|
||||
|
||||
do_install () {
|
||||
install -d -m 755 ${D}/firmware
|
||||
install -m 0644 "${B}/secure-storage.bin" "${D}/firmware/secure-storage.bin"
|
||||
install -m 0644 "${S}/deployments/secure-storage/shim/secure-storage.dts" \
|
||||
"${D}/firmware/secure-storage.dts"
|
||||
}
|
||||
|
||||
FILES_${PN} = "/firmware/secure-storage.bin /firmware/secure-storage.dts"
|
||||
@@ -0,0 +1,68 @@
|
||||
HOMEPAGE = "https://trusted-services.readthedocs.io/en/latest/index.html"
|
||||
|
||||
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
||||
|
||||
LICENSE = "Apache-2.0 & BSD-3-Clause & Zlib"
|
||||
LIC_FILES_CHKSUM = "file://license.rst;md5=ea160bac7f690a069c608516b17997f4 \
|
||||
file://mbedcrypto/LICENSE;md5=302d50a6369f5f22efdb674db908167a \
|
||||
file://nanopb/LICENSE.txt;md5=9db4b73a55a3994384112efcdb37c01f \
|
||||
"
|
||||
SRC_URI = "git://git.trustedfirmware.org/TS/trusted-services.git;protocol=https;branch=main;name=ts;destsuffix=git \
|
||||
git://github.com/ARMmbed/mbed-crypto.git;protocol=git;branch=development;name=mbed;destsuffix=git/mbedcrypto \
|
||||
git://github.com/nanopb/nanopb.git;name=nanopb;branch=master;destsuffix=git/nanopb \
|
||||
file://0001-Add-a-new-environment-to-run-TS-with-a-shim-layer-in.patch \
|
||||
file://0002-Change-instruction-access-permissions-of-shared-memo.patch \
|
||||
file://0003-Set-in_region_count-to-0-during-memory-retrieve.patch \
|
||||
file://0004-Release-rx-buffer-after-memory-retrieve-request.patch \
|
||||
file://0005-crypto-sp-Create-a-new-deployment-with-the-shim-envi.patch \
|
||||
file://0006-secure-storage-Create-a-new-deployment-with-the-shim.patch \
|
||||
file://0007-crypto-shim-Don-t-link-against-unrequired-libraries.patch \
|
||||
file://0008-libts-arm-linux-Add-version-to-libts.so.patch \
|
||||
file://0009-libts-Add-option-to-use-installed-libts.patch \
|
||||
file://0010-external-Add-option-to-use-local-source-or-installed.patch \
|
||||
file://0011-aarch64-Allow-the-stack-to-be-further-than-1MB-from-.patch \
|
||||
file://0012-libc-Add-missing-libc-function-declarations.patch \
|
||||
file://0013-libsp-modify-FFA-ABIs-with-supported-convention.patch \
|
||||
"
|
||||
|
||||
PV = "1.0+git${SRCPV}"
|
||||
|
||||
SRCREV_FORMAT = "ts"
|
||||
SRCREV_ts = "eff4b28b6ae461defb2d8c0f614965439ed19386"
|
||||
SRCREV_mbed = "cf4a40ba0a3086cabb5a8227245191161fd26383"
|
||||
SRCREV_nanopb = "df0e92f474f9cca704fe2b31483f0b4d1b1715a4"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
TS_DEPLOYMENTS_DIR := "${S}/deployments/"
|
||||
|
||||
inherit deploy python3native
|
||||
|
||||
DEPENDS = "python3-pycryptodome-native python3-pycryptodomex-native \
|
||||
python3-pyelftools-native python3-grpcio-tools-native \
|
||||
python3-protobuf-native protobuf-native cmake-native \
|
||||
"
|
||||
|
||||
# Baremetal, just need a compiler
|
||||
DEPENDS_remove = "virtual/${TARGET_PREFIX}compilerlibs virtual/libc"
|
||||
|
||||
export CROSS_COMPILE = "${TARGET_PREFIX}"
|
||||
|
||||
B = "${WORKDIR}/build"
|
||||
|
||||
do_configure() {
|
||||
cmake \
|
||||
-DMBEDCRYPTO_SOURCE_PATH=${S}/mbedcrypto \
|
||||
-DNANOPB_SOURCE_PATH=${S}/nanopb \
|
||||
-S ${TS_DEPLOYMENT} -B ${B}
|
||||
}
|
||||
|
||||
do_compile() {
|
||||
cmake --build ${B}
|
||||
}
|
||||
|
||||
SYSROOT_DIRS = "/firmware"
|
||||
|
||||
do_deploy() {
|
||||
cp -rf ${D}/firmware/* ${DEPLOYDIR}/
|
||||
}
|
||||
addtask deploy after do_install
|
||||
@@ -0,0 +1,59 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index b1900bb..d9ca865 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -116,8 +116,13 @@ if(PkgHelpers_AVAILABLE)
|
||||
${CMAKE_CURRENT_BINARY_DIR}/CppUTestConfig.cmake
|
||||
INSTALL_DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
|
||||
PATH_VARS INCLUDE_DIR CMAKE_CURRENT_BINARY_DIR)
|
||||
- export(TARGETS CppUTest CppUTestExt
|
||||
+ if(TARGET CppUTestExt)
|
||||
+ export(TARGETS CppUTest
|
||||
FILE "${CMAKE_CURRENT_BINARY_DIR}/CppUTestTargets.cmake")
|
||||
+ else()
|
||||
+ export(TARGETS CppUTest
|
||||
+ FILE "${CMAKE_CURRENT_BINARY_DIR}/CppUTestTargets.cmake")
|
||||
+ endif()
|
||||
write_basic_package_version_file(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/CppUTestConfigVersion.cmake
|
||||
VERSION ${CppUTest_version_major}.${CppUTest_version_minor}
|
||||
diff --git a/cmake/Modules/CppUTestConfigurationOptions.cmake b/cmake/Modules/CppUTestConfigurationOptions.cmake
|
||||
index 634482c..a00b5eb 100644
|
||||
--- a/cmake/Modules/CppUTestConfigurationOptions.cmake
|
||||
+++ b/cmake/Modules/CppUTestConfigurationOptions.cmake
|
||||
@@ -1,19 +1,19 @@
|
||||
if (MSVC)
|
||||
- set(CPP_PLATFORM VisualCpp)
|
||||
+ set(CPP_PLATFORM VisualCpp CACHE STRING "CppUTest platform.")
|
||||
include_directories(${CppUTestRootDirectory}/include/Platforms/${CPP_PLATFORM})
|
||||
option(STDC_WANT_SECURE_LIB "Use MSVC safe functions" ON)
|
||||
if(STDC_WANT_SECURE_LIB)
|
||||
ADD_DEFINITIONS(-DSTDC_WANT_SECURE_LIB)
|
||||
endif(STDC_WANT_SECURE_LIB)
|
||||
elseif (STD_C)
|
||||
- set(CPP_PLATFORM Gcc)
|
||||
+ set(CPP_PLATFORM Gcc CACHE STRING "CppUTest platform.")
|
||||
else (MSVC)
|
||||
set(STD_CPP False)
|
||||
set(MEMORY_LEAK_DETECTION False)
|
||||
set(CPPUTEST_CXX_FLAGS "${CPPUTEST_CXX_FLAGS} -nostdinc")
|
||||
set(CPPUTEST_LD_FLAGS "${CPPUTEST_LD_FLAGS} -nostdinc")
|
||||
set(CPPUTEST_STD_C_LIB_DISABLED 1)
|
||||
- set(CPP_PLATFORM GccNoStdC)
|
||||
+ set(CPP_PLATFORM GccNoStdC CACHE STRING "CppUTest platform.")
|
||||
endif (MSVC)
|
||||
|
||||
include("${CppUTestRootDirectory}/cmake/Modules/CppUTestWarningFlags.cmake")
|
||||
diff --git a/src/CppUTest/CMakeLists.txt b/src/CppUTest/CMakeLists.txt
|
||||
index 736777f..d9a592f 100644
|
||||
--- a/src/CppUTest/CMakeLists.txt
|
||||
+++ b/src/CppUTest/CMakeLists.txt
|
||||
@@ -50,7 +50,7 @@ set(CppUTest_headers
|
||||
|
||||
add_library(CppUTest STATIC ${CppUTest_src} ${CppUTest_headers})
|
||||
if (WIN32)
|
||||
- target_link_libraries(CppUTest winmm.lib)
|
||||
+ target_link_libraries(CppUTest winmm)
|
||||
endif (WIN32)
|
||||
install(FILES ${CppUTest_headers} DESTINATION include/CppUTest)
|
||||
install(TARGETS CppUTest
|
||||
@@ -0,0 +1,30 @@
|
||||
SUMMARY = "CppUTest for trusted services"
|
||||
DESCRIPTION = "CppUTest unit testing and mocking framework for C/C++"
|
||||
HOMEPAGE = "http://cpputest.github.io/"
|
||||
|
||||
LICENSE = "BSD-3-Clause"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=ce5d5f1fe02bcd1343ced64a06fd4177"
|
||||
|
||||
SRC_URI = "git://github.com/cpputest/cpputest.git \
|
||||
file://cpputest-cmake-fix.patch \
|
||||
"
|
||||
SRCREV = "e25097614e1c4856036366877a02346c4b36bb5b"
|
||||
|
||||
PV = "3.8+git${SRCPV}"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
inherit cmake
|
||||
|
||||
OECMAKE_GENERATOR = "Unix Makefiles"
|
||||
EXTRA_OECMAKE = "-DCMAKE_POSITION_INDEPENDENT_CODE=True \
|
||||
-DMEMORY_LEAK_DETECTION=OFF \
|
||||
-DLONGLONG=ON \
|
||||
-DC++11=ON \
|
||||
-DTESTS=OFF \
|
||||
-DEXTENSIONS=OFF \
|
||||
-DHAVE_FORK=OFF \
|
||||
-DCPP_PLATFORM=armcc \
|
||||
-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY \
|
||||
"
|
||||
FILES_${PN} += "/usr/lib/CppUTest/* /usr/lib/CppUTest/cmake/*"
|
||||
@@ -0,0 +1,42 @@
|
||||
SUMMARY = "Trusted Services test application"
|
||||
HOMEPAGE = "https://trusted-services.readthedocs.io/en/latest/index.html"
|
||||
|
||||
LICENSE = "BSD-3-Clause"
|
||||
LIC_FILES_CHKSUM = "file://license.rst;md5=ea160bac7f690a069c608516b17997f4"
|
||||
|
||||
SRC_URI = "git://git.trustedfirmware.org/TS/trusted-services.git;protocol=ssh;branch=main \
|
||||
file://0001-Add-a-new-environment-to-run-TS-with-a-shim-layer-in.patch \
|
||||
file://0002-Change-instruction-access-permissions-of-shared-memo.patch \
|
||||
file://0003-Set-in_region_count-to-0-during-memory-retrieve.patch \
|
||||
file://0004-Release-rx-buffer-after-memory-retrieve-request.patch \
|
||||
file://0005-crypto-sp-Create-a-new-deployment-with-the-shim-envi.patch \
|
||||
file://0006-secure-storage-Create-a-new-deployment-with-the-shim.patch \
|
||||
file://0007-crypto-shim-Don-t-link-against-unrequired-libraries.patch \
|
||||
file://0008-libts-arm-linux-Add-version-to-libts.so.patch \
|
||||
file://0009-libts-Add-option-to-use-installed-libts.patch \
|
||||
file://0010-external-Add-option-to-use-local-source-or-installed.patch \
|
||||
file://0011-aarch64-Allow-the-stack-to-be-further-than-1MB-from-.patch \
|
||||
file://0012-libc-Add-missing-libc-function-declarations.patch \
|
||||
file://0013-libsp-modify-FFA-ABIs-with-supported-convention.patch \
|
||||
"
|
||||
|
||||
PV = "1.0+git${SRCPV}"
|
||||
SRCREV = "eff4b28b6ae461defb2d8c0f614965439ed19386"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
inherit python3native cmake
|
||||
|
||||
DEPENDS = "python3-pycryptodome-native python3-pycryptodomex-native \
|
||||
python3-pyelftools-native python3-grpcio-tools-native \
|
||||
python3-protobuf-native protobuf-native nanopb nanopb-native \
|
||||
ts-mbedcrypto libts \
|
||||
"
|
||||
|
||||
OECMAKE_SOURCEPATH = "${S}/deployments/ts-demo/arm-linux"
|
||||
OECMAKE_GENERATOR = "Unix Makefiles"
|
||||
EXTRA_OECMAKE = "-DCMAKE_POSITION_INDEPENDENT_CODE=True \
|
||||
-DMBEDCRYPTO_USE_INSTALLED=True \
|
||||
-DNANOPB_USE_INSTALLED=True \
|
||||
-DLIBTS_USE_INSTALLED=True \
|
||||
"
|
||||
@@ -0,0 +1,46 @@
|
||||
SUMMARY = "Mbedcrypto for trusted services"
|
||||
DESCRIPTION = "A reference implementation of the cryptography \
|
||||
interface of the Arm Platform Security Architecture (PSA). Compiled \
|
||||
with the configuration for trusted services."
|
||||
HOMEPAGE = "https://github.com/ARMmbed/mbed-crypto"
|
||||
|
||||
LICENSE = "Apache-2.0 & BSD-3-Clause"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=302d50a6369f5f22efdb674db908167a \
|
||||
file://ts/license.rst;md5=ea160bac7f690a069c608516b17997f4 \
|
||||
"
|
||||
SRC_URI = "git://github.com/ARMmbed/mbed-crypto.git;protocol=git;branch=development;name=mbed;destsuffix=git \
|
||||
git://git.trustedfirmware.org/TS/trusted-services.git;protocol=https;branch=main;name=ts;destsuffix=git/ts \
|
||||
file://0001-Add-a-new-environment-to-run-TS-with-a-shim-layer-in.patch;patchdir=${S}/ts \
|
||||
file://0002-Change-instruction-access-permissions-of-shared-memo.patch;patchdir=${S}/ts \
|
||||
file://0003-Set-in_region_count-to-0-during-memory-retrieve.patch;patchdir=${S}/ts \
|
||||
file://0004-Release-rx-buffer-after-memory-retrieve-request.patch;patchdir=${S}/ts \
|
||||
file://0005-crypto-sp-Create-a-new-deployment-with-the-shim-envi.patch;patchdir=${S}/ts \
|
||||
file://0006-secure-storage-Create-a-new-deployment-with-the-shim.patch;patchdir=${S}/ts \
|
||||
file://0007-crypto-shim-Don-t-link-against-unrequired-libraries.patch;patchdir=${S}/ts \
|
||||
file://0008-libts-arm-linux-Add-version-to-libts.so.patch;patchdir=${S}/ts \
|
||||
file://0009-libts-Add-option-to-use-installed-libts.patch;patchdir=${S}/ts \
|
||||
file://0010-external-Add-option-to-use-local-source-or-installed.patch;patchdir=${S}/ts \
|
||||
file://0011-aarch64-Allow-the-stack-to-be-further-than-1MB-from-.patch;patchdir=${S}/ts \
|
||||
file://0012-libc-Add-missing-libc-function-declarations.patch;patchdir=${S}/ts \
|
||||
file://0013-libsp-modify-FFA-ABIs-with-supported-convention.patch;patchdir=${S}/ts \
|
||||
"
|
||||
|
||||
PV = "3.1.0+git"
|
||||
|
||||
SRCREV_FORMAT = "mbed"
|
||||
SRCREV_mbed = "cf4a40ba0a3086cabb5a8227245191161fd26383"
|
||||
SRCREV_ts = "eff4b28b6ae461defb2d8c0f614965439ed19386"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
inherit cmake
|
||||
|
||||
MBEDCRYPTO_CONFIG_FILE = "${S}/ts/components/service/crypto/client/cpp/config_mbed_crypto.h"
|
||||
|
||||
OECMAKE_GENERATOR = "Unix Makefiles"
|
||||
EXTRA_OECMAKE = "-DCMAKE_POSITION_INDEPENDENT_CODE=True \
|
||||
-DENABLE_PROGRAMS=OFF \
|
||||
-DENABLE_TESTING=OFF \
|
||||
-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY \
|
||||
-Dthirdparty_def=-DMBEDTLS_CONFIG_FILE=\"${MBEDCRYPTO_CONFIG_FILE}\" \
|
||||
"
|
||||
@@ -0,0 +1,42 @@
|
||||
SUMMARY = "Trusted Services demo application"
|
||||
HOMEPAGE = "https://trusted-services.readthedocs.io/en/latest/index.html"
|
||||
|
||||
LICENSE = "BSD-3-Clause"
|
||||
LIC_FILES_CHKSUM = "file://license.rst;md5=ea160bac7f690a069c608516b17997f4"
|
||||
|
||||
SRC_URI = "git://git.trustedfirmware.org/TS/trusted-services.git;protocol=https;branch=main \
|
||||
file://0001-Add-a-new-environment-to-run-TS-with-a-shim-layer-in.patch \
|
||||
file://0002-Change-instruction-access-permissions-of-shared-memo.patch \
|
||||
file://0003-Set-in_region_count-to-0-during-memory-retrieve.patch \
|
||||
file://0004-Release-rx-buffer-after-memory-retrieve-request.patch \
|
||||
file://0005-crypto-sp-Create-a-new-deployment-with-the-shim-envi.patch \
|
||||
file://0006-secure-storage-Create-a-new-deployment-with-the-shim.patch \
|
||||
file://0007-crypto-shim-Don-t-link-against-unrequired-libraries.patch \
|
||||
file://0008-libts-arm-linux-Add-version-to-libts.so.patch \
|
||||
file://0009-libts-Add-option-to-use-installed-libts.patch \
|
||||
file://0010-external-Add-option-to-use-local-source-or-installed.patch \
|
||||
file://0011-aarch64-Allow-the-stack-to-be-further-than-1MB-from-.patch \
|
||||
file://0012-libc-Add-missing-libc-function-declarations.patch \
|
||||
file://0013-libsp-modify-FFA-ABIs-with-supported-convention.patch \
|
||||
"
|
||||
|
||||
PV = "1.0+git${SRCPV}"
|
||||
SRCREV = "eff4b28b6ae461defb2d8c0f614965439ed19386"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
inherit deploy python3native cmake
|
||||
|
||||
DEPENDS = "python3-pycryptodome-native python3-pycryptodomex-native \
|
||||
python3-pyelftools-native python3-grpcio-tools-native \
|
||||
python3-protobuf-native protobuf-native nanopb nanopb-native \
|
||||
ts-mbedcrypto libts ts-cpputest"
|
||||
|
||||
OECMAKE_SOURCEPATH = "${S}/deployments/ts-service-test/arm-linux"
|
||||
OECMAKE_GENERATOR = "Unix Makefiles"
|
||||
EXTRA_OECMAKE = "-DCMAKE_POSITION_INDEPENDENT_CODE=True \
|
||||
-DMBEDCRYPTO_USE_INSTALLED=True \
|
||||
-DNANOPB_USE_INSTALLED=True \
|
||||
-DLIBTS_USE_INSTALLED=True \
|
||||
-DCPPUTEST_USE_INSTALLED=True \
|
||||
"
|
||||
Reference in New Issue
Block a user