Merge branch 'release-candidate' of github.com:ARMmbed/mbed-os into release-candidate

pull/10469/head
adbridge 2019-04-24 15:32:09 +01:00
commit 51b9a094b9
17 changed files with 64 additions and 242 deletions

View File

@ -1,11 +1,13 @@
/* /*
* Copyright (c) 2017-2019, Arm Limited. All rights reserved. * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
* *
*/ */
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "cmsis.h"
#include "rtx_os.h"
#include "cmsis_os2.h" #include "cmsis_os2.h"
#include "tfm_api.h" #include "tfm_api.h"
#include "tfm_ns_lock.h" #include "tfm_ns_lock.h"
@ -27,9 +29,14 @@ static struct ns_lock_state ns_lock = {.init=false, .id=NULL};
/** /**
* \brief Mutex properties, NS lock * \brief Mutex properties, NS lock
*/ */
static osRtxMutex_t ns_lock_cb = { 0 };
static const osMutexAttr_t ns_lock_attrib = { static const osMutexAttr_t ns_lock_attrib = {
.name = "ns_lock", .name = "ns_lock",
.attr_bits = osMutexPrioInherit .attr_bits = osMutexPrioInherit,
.cb_mem = &ns_lock_cb,
.cb_size = sizeof(ns_lock_cb)
}; };
/** /**

View File

@ -1,71 +0,0 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2017-2018, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
#-------------------------------------------------------------------------------
#Definitions to compile the "core" module.
#This file assumes it will be included from a project specific cmakefile, and
#will not create a library or executable.
#Inputs:
# TFM_ROOT_DIR - directory where secure FW sourec is located.
#
#Outputs:
# Will modify include directories to make the source compile.
# ALL_SRC_C: C source files to be compiled will be added to this list.
# This shall be added to your add_executable or add_library command.
# ALL_SRC_CXX: C++ source files to be compiled will be added to this list.
# This shall be added to your add_executable or add_library command.
# ALL_SRC_ASM: assembly source files to be compiled will be added to this
# list. This shall be added to your add_executable or add_library
# command.
# Include directories will be modified by using the include_directories()
# commands as needed.
#Get the current directory where this file is located.
set(SS_CORE_DIR ${CMAKE_CURRENT_LIST_DIR})
if(NOT DEFINED TFM_ROOT_DIR)
message(FATAL_ERROR
"Please set TFM_ROOT_DIR before including this file.")
endif()
set (SS_CORE_C_SRC
"${SS_CORE_DIR}/tfm_core.c"
"${SS_CORE_DIR}/tfm_handler.c"
"${SS_CORE_DIR}/tfm_secure_api.c"
"${SS_CORE_DIR}/tfm_spm_services.c"
"${SS_CORE_DIR}/tfm_nspm.c"
"${SS_CORE_DIR}/tfm_boot_data.c"
)
#Append all our source files to global lists.
list(APPEND ALL_SRC_C ${SS_CORE_C_SRC})
unset(SS_CORE_C_SRC)
#Setting include directories
embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/spm ABSOLUTE)
embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/core ABSOLUTE)
set(BUILD_CMSIS_CORE Off)
set(BUILD_RETARGET Off)
set(BUILD_NATIVE_DRIVERS Off)
set(BUILD_STARTUP Off)
set(BUILD_TARGET_CFG Off)
set(BUILD_TARGET_HARDWARE_KEYS Off)
set(BUILD_TARGET_NV_COUNTERS Off)
set(BUILD_CMSIS_DRIVERS Off)
set(BUILD_TIME Off)
set(BUILD_UART_STDOUT Off)
set(BUILD_FLASH Off)
set(BUILD_BOOT_SEED Off)
set(BUILD_DEVICE_ID Off)
if(NOT DEFINED PLATFORM_CMAKE_FILE)
message (FATAL_ERROR "Platform specific CMake is not defined. Please set PLATFORM_CMAKE_FILE.")
elseif(NOT EXISTS ${PLATFORM_CMAKE_FILE})
message (FATAL_ERROR "Platform specific CMake \"${PLATFORM_CMAKE_FILE}\" file does not exist. Please fix value of PLATFORM_CMAKE_FILE.")
else()
include(${PLATFORM_CMAKE_FILE})
endif()

View File

@ -1,74 +0,0 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2018, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
#-------------------------------------------------------------------------------
#Definitions to compile the "ipc" module.
#This file assumes it will be included from a project specific cmakefile, and
#will not create a library or executable.
#Inputs:
# TFM_ROOT_DIR - directory where secure FW sourec is located.
#
#Outputs:
# Will modify include directories to make the source compile.
# ALL_SRC_C: C source files to be compiled will be added to this list.
# This shall be added to your add_executable or add_library command.
# ALL_SRC_CXX: C++ source files to be compiled will be added to this list.
# This shall be added to your add_executable or add_library command.
# ALL_SRC_ASM: assembly source files to be compiled will be added to this
# list. This shall be added to your add_executable or add_library
# command.
# Include directories will be modified by using the include_directories()
# commands as needed.
#Get the current directory where this file is located.
set(SS_IPC_DIR ${CMAKE_CURRENT_LIST_DIR})
if(NOT DEFINED TFM_ROOT_DIR)
message(FATAL_ERROR
"Please set TFM_ROOT_DIR before including this file.")
endif()
if (NOT DEFINED TFM_PSA_API)
message(FATAL_ERROR "Incomplete build configuration: TFM_PSA_API is undefined. ")
elseif (TFM_PSA_API)
set (SS_IPC_C_SRC "${SS_IPC_DIR}/tfm_svcalls.c"
"${SS_IPC_DIR}/psa_service.c"
"${SS_IPC_DIR}/psa_client.c"
"${SS_IPC_DIR}/tfm_arch_v8m.c"
"${SS_IPC_DIR}/tfm_thread.c"
"${SS_IPC_DIR}/tfm_wait.c"
"${SS_IPC_DIR}/tfm_utils.c"
"${SS_IPC_DIR}/tfm_message_queue.c"
"${SS_IPC_DIR}/tfm_pools.c"
"${SS_IPC_DIR}/tfm_spm.c"
"${SS_IPC_DIR}/../tfm_core.c"
"${SS_IPC_DIR}/../tfm_secure_api.c"
"${SS_IPC_DIR}/../tfm_spm_services.c"
"${SS_IPC_DIR}/../tfm_handler.c"
"${SS_IPC_DIR}/../tfm_psa_api_client.c"
"${SS_IPC_DIR}/../tfm_nspm.c"
"${SS_IPC_DIR}/../tfm_boot_data.c"
)
endif()
#Append all our source files to global lists.
list(APPEND ALL_SRC_C ${SS_IPC_C_SRC})
unset(SS_IPC_C_SRC)
#Setting include directories
embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/spm ABSOLUTE)
embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/core ABSOLUTE)
embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/core/ipc ABSOLUTE)
embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/core/ipc/include ABSOLUTE)
if(NOT DEFINED PLATFORM_CMAKE_FILE)
message (FATAL_ERROR "Platform specific CMake is not defined. Please set PLATFORM_CMAKE_FILE.")
elseif(NOT EXISTS ${PLATFORM_CMAKE_FILE})
message (FATAL_ERROR "Platform specific CMake \"${PLATFORM_CMAKE_FILE}\" file does not exist. Please fix value of PLATFORM_CMAKE_FILE.")
else()
include(${PLATFORM_CMAKE_FILE})
endif()

View File

@ -7,7 +7,9 @@
#ifndef __TFM_MESSAGE_QUEUE_H__ #ifndef __TFM_MESSAGE_QUEUE_H__
#define __TFM_MESSAGE_QUEUE_H__ #define __TFM_MESSAGE_QUEUE_H__
#ifndef TFM_MSG_QUEUE_MAX_MSG_NUM
#define TFM_MSG_QUEUE_MAX_MSG_NUM 128 #define TFM_MSG_QUEUE_MAX_MSG_NUM 128
#endif
#define TFM_MSG_MAGIC 0x15154343 #define TFM_MSG_MAGIC 0x15154343
/* Message struct to collect parameter from client */ /* Message struct to collect parameter from client */
struct tfm_msg_body_t { struct tfm_msg_body_t {

View File

@ -10,11 +10,15 @@
#include <stdbool.h> #include <stdbool.h>
#include "tfm_list.h" #include "tfm_list.h"
#ifndef TFM_SPM_MAX_ROT_SERV_NUM
#define TFM_SPM_MAX_ROT_SERV_NUM 28 #define TFM_SPM_MAX_ROT_SERV_NUM 28
#endif
#define TFM_VERSION_POLICY_RELAXED 0 #define TFM_VERSION_POLICY_RELAXED 0
#define TFM_VERSION_POLICY_STRICT 1 #define TFM_VERSION_POLICY_STRICT 1
#ifndef TFM_CONN_HANDLE_MAX_NUM
#define TFM_CONN_HANDLE_MAX_NUM 32 #define TFM_CONN_HANDLE_MAX_NUM 32
#endif
/* RoT connection handle list */ /* RoT connection handle list */
struct tfm_conn_handle_t { struct tfm_conn_handle_t {

View File

@ -1,14 +0,0 @@
/*
* Copyright (c) 2018-2019, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#ifndef __TFM_SPM_SIGNAL_DEFS_H__
#define __TFM_SPM_SIGNAL_DEFS_H__
#include "test/test_services/tfm_ipc_service/tfm_ipc_service_partition.h"
#include "test/test_services/tfm_core_test/tfm_ss_core_test_signal.h"
#include "test/test_services/tfm_core_test_2/tfm_ss_core_test_2_signal.h"
#endif

View File

@ -46,7 +46,7 @@ TFM_POOL_DECLARE(msg_db_pool, sizeof(struct tfm_msg_body_t),
TFM_MSG_QUEUE_MAX_MSG_NUM); TFM_MSG_QUEUE_MAX_MSG_NUM);
static struct tfm_spm_service_db_t g_spm_service_db[] = { static struct tfm_spm_service_db_t g_spm_service_db[] = {
#include "secure_fw/services/tfm_service_list.inc" #include "tfm_service_list.inc"
}; };
/********************** SPM functions for handler mode ***********************/ /********************** SPM functions for handler mode ***********************/
@ -109,6 +109,8 @@ int32_t tfm_spm_free_conn_handle(struct tfm_spm_service_t *service,
/* Remove node from handle list */ /* Remove node from handle list */
tfm_list_del_node(&node->list); tfm_list_del_node(&node->list);
node->rhandle = NULL;
/* Back handle buffer to pool */ /* Back handle buffer to pool */
tfm_pool_free(node); tfm_pool_free(node);
return IPC_SUCCESS; return IPC_SUCCESS;
@ -271,7 +273,7 @@ int32_t tfm_spm_check_client_version(struct tfm_spm_service_t *service,
switch (service->service_db->minor_policy) { switch (service->service_db->minor_policy) {
case TFM_VERSION_POLICY_RELAXED: case TFM_VERSION_POLICY_RELAXED:
if (minor_version < service->service_db->minor_version) { if (minor_version > service->service_db->minor_version) {
return IPC_ERROR_VERSION; return IPC_ERROR_VERSION;
} }
break; break;
@ -430,15 +432,19 @@ tfm_spm_partition_get_thread_info_ext(uint32_t partition_idx)
return &g_spm_partition_db.partitions[partition_idx].sp_thrd; return &g_spm_partition_db.partitions[partition_idx].sp_thrd;
} }
static uint32_t tfm_spm_partition_get_stack_base_ext(uint32_t partition_idx) static uint32_t tfm_spm_partition_get_stack_size_ext(uint32_t partition_idx)
{ {
return (uint32_t)&(g_spm_partition_db.partitions[partition_idx]. return g_spm_partition_db.partitions[partition_idx].stack_size;
stack[TFM_STACK_SIZE]);
} }
static uint32_t tfm_spm_partition_get_stack_limit_ext(uint32_t partition_idx) static uint32_t tfm_spm_partition_get_stack_limit_ext(uint32_t partition_idx)
{ {
return (uint32_t)&g_spm_partition_db.partitions[partition_idx].stack; return g_spm_partition_db.partitions[partition_idx].stack_limit;
}
static uint32_t tfm_spm_partition_get_stack_base_ext(uint32_t partition_idx)
{
return tfm_spm_partition_get_stack_limit_ext(partition_idx) + tfm_spm_partition_get_stack_size_ext(partition_idx);
} }
static tfm_thrd_func_t static tfm_thrd_func_t
@ -457,6 +463,8 @@ static uint32_t tfm_spm_partition_get_priority_ext(uint32_t partition_idx)
/* Macros to pick linker symbols and allow references to sections in all level*/ /* Macros to pick linker symbols and allow references to sections in all level*/
#define REGION_DECLARE_EXT(a, b, c) extern uint32_t REGION_NAME(a, b, c) #define REGION_DECLARE_EXT(a, b, c) extern uint32_t REGION_NAME(a, b, c)
REGION_DECLARE_EXT(Image$$, ARM_LIB_HEAP, $$ZI$$Base);
REGION_DECLARE_EXT(Image$$, ARM_LIB_HEAP, $$ZI$$Limit);
REGION_DECLARE_EXT(Image$$, ER_TFM_DATA, $$ZI$$Base); REGION_DECLARE_EXT(Image$$, ER_TFM_DATA, $$ZI$$Base);
REGION_DECLARE_EXT(Image$$, ER_TFM_DATA, $$ZI$$Limit); REGION_DECLARE_EXT(Image$$, ER_TFM_DATA, $$ZI$$Limit);
REGION_DECLARE_EXT(Image$$, ER_TFM_DATA, $$RW$$Base); REGION_DECLARE_EXT(Image$$, ER_TFM_DATA, $$RW$$Base);
@ -512,7 +520,19 @@ int32_t tfm_memory_check(void *buffer, size_t len, int32_t ns_caller)
if (memory_check_range(buffer, len, base, limit) == IPC_SUCCESS) { if (memory_check_range(buffer, len, base, limit) == IPC_SUCCESS) {
return IPC_SUCCESS; return IPC_SUCCESS;
} }
base = (uintptr_t)NS_CODE_START;
limit = (uintptr_t)(NS_CODE_START + NS_CODE_SIZE);
if (memory_check_range(buffer, len, base, limit) == IPC_SUCCESS) {
return IPC_SUCCESS;
}
} else { } else {
base = (uintptr_t)&REGION_NAME(Image$$, ARM_LIB_HEAP, $$ZI$$Base);
limit = (uintptr_t)&REGION_NAME(Image$$, ARM_LIB_HEAP, $$ZI$$Limit);
if (memory_check_range(buffer, len, base, limit) == IPC_SUCCESS) {
return IPC_SUCCESS;
}
base = (uintptr_t)&REGION_NAME(Image$$, ER_TFM_DATA, $$RW$$Base); base = (uintptr_t)&REGION_NAME(Image$$, ER_TFM_DATA, $$RW$$Base);
limit = (uintptr_t)&REGION_NAME(Image$$, ER_TFM_DATA, $$RW$$Limit); limit = (uintptr_t)&REGION_NAME(Image$$, ER_TFM_DATA, $$RW$$Limit);
if (memory_check_range(buffer, len, base, limit) == IPC_SUCCESS) { if (memory_check_range(buffer, len, base, limit) == IPC_SUCCESS) {
@ -537,6 +557,12 @@ int32_t tfm_memory_check(void *buffer, size_t len, int32_t ns_caller)
if (memory_check_range(buffer, len, base, limit) == IPC_SUCCESS) { if (memory_check_range(buffer, len, base, limit) == IPC_SUCCESS) {
return IPC_SUCCESS; return IPC_SUCCESS;
} }
base = (uintptr_t)S_CODE_START;
limit = (uintptr_t)(S_CODE_START + S_CODE_SIZE);
if (memory_check_range(buffer, len, base, limit) == IPC_SUCCESS) {
return IPC_SUCCESS;
}
} }
return IPC_ERROR_MEMORY_CHECK; return IPC_ERROR_MEMORY_CHECK;

View File

@ -25,6 +25,8 @@
#define EXC_NUM_PENDSV (14) #define EXC_NUM_PENDSV (14)
#define EXC_NUM_SYSTICK (15) #define EXC_NUM_SYSTICK (15)
#define printf(...)
/* Disable NS exceptions by setting NS PRIMASK to 1 */ /* Disable NS exceptions by setting NS PRIMASK to 1 */
#define TFM_NS_EXC_DISABLE() __TZ_set_PRIMASK_NS(1) #define TFM_NS_EXC_DISABLE() __TZ_set_PRIMASK_NS(1)
/* Enable NS exceptions by setting NS PRIMASK to 0 */ /* Enable NS exceptions by setting NS PRIMASK to 0 */

View File

@ -11,7 +11,6 @@
#include "tfm_internal.h" #include "tfm_internal.h"
#include "tfm_api.h" #include "tfm_api.h"
#include "platform/include/tfm_spm_hal.h" #include "platform/include/tfm_spm_hal.h"
#include "uart_stdout.h"
#include "secure_utilities.h" #include "secure_utilities.h"
#include "secure_fw/spm/spm_api.h" #include "secure_fw/spm/spm_api.h"
#include "secure_fw/include/tfm_spm_services_api.h" #include "secure_fw/include/tfm_spm_services_api.h"
@ -88,7 +87,6 @@ int32_t tfm_core_init(void)
__enable_irq(); __enable_irq();
stdio_init();
LOG_MSG("Secure image initializing!"); LOG_MSG("Secure image initializing!");
#ifdef TFM_CORE_DEBUG #ifdef TFM_CORE_DEBUG

View File

@ -48,7 +48,8 @@ int32_t tfm_core_ns_ipc_request(void *fn, int32_t arg1, int32_t arg2,
int32_t arg3, int32_t arg4) int32_t arg3, int32_t arg4)
{ {
int32_t args[4] = {arg1, arg2, arg3, arg4}; int32_t args[4] = {arg1, arg2, arg3, arg4};
struct tfm_sfn_req_s desc, *desc_ptr = &desc; volatile struct tfm_sfn_req_s desc;
struct tfm_sfn_req_s *desc_ptr = &desc;
int32_t res; int32_t res;
desc.sfn = fn; desc.sfn = fn;
@ -98,7 +99,7 @@ psa_handle_t tfm_psa_connect_veneer(uint32_t sid, uint32_t minor_version)
__tfm_secure_gateway_attributes__ __tfm_secure_gateway_attributes__
psa_status_t tfm_psa_call_veneer(psa_handle_t handle, psa_status_t tfm_psa_call_veneer(psa_handle_t handle,
const psa_invec *in_vecs, const psa_invec *in_vecs,
const psa_invec *out_vecs) psa_outvec *out_vecs)
{ {
TFM_CORE_NS_IPC_REQUEST_VENEER(tfm_svcall_psa_call, handle, in_vecs, TFM_CORE_NS_IPC_REQUEST_VENEER(tfm_svcall_psa_call, handle, in_vecs,
out_vecs, 0); out_vecs, 0);

View File

@ -12,7 +12,6 @@
#include "tfm_secure_api.h" #include "tfm_secure_api.h"
#include "tfm_nspm.h" #include "tfm_nspm.h"
#include "secure_utilities.h" #include "secure_utilities.h"
#include "uart_stdout.h"
#include "secure_fw/spm/spm_api.h" #include "secure_fw/spm/spm_api.h"
#include "region_defs.h" #include "region_defs.h"
#include "tfm_api.h" #include "tfm_api.h"

View File

@ -1,61 +0,0 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2017-2018, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
#-------------------------------------------------------------------------------
#Definitions to compile the "spm" module.
#This file assumes it will be included from a project specific cmakefile, and
#will not create a library or executable.
#Inputs:
# TFM_ROOT_DIR - root directory of the TF-M repository.
#
#Outputs:
# Will modify include directories to make the source compile.
# ALL_SRC_C: C source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
# ALL_SRC_CXX: C++ source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
# ALL_SRC_ASM: assembly source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
# Include directories will be modified by using the include_directories() commands as needed.
#Get the current directory where this file is located.
set(SS_SPM_DIR ${CMAKE_CURRENT_LIST_DIR})
if(NOT DEFINED TFM_ROOT_DIR)
message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
endif()
set (SS_SPM_C_SRC "${SS_SPM_DIR}/spm_api.c")
#Append all our source files to global lists.
list(APPEND ALL_SRC_C ${SS_SPM_C_SRC})
unset(SS_SPM_C_SRC)
#Setting include directories
embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/spm ABSOLUTE)
embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/core ABSOLUTE)
embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
set(BUILD_CMSIS_CORE Off)
set(BUILD_RETARGET Off)
set(BUILD_NATIVE_DRIVERS Off)
set(BUILD_STARTUP Off)
set(BUILD_TARGET_CFG Off)
set(BUILD_TARGET_HARDWARE_KEYS Off)
set(BUILD_TARGET_NV_COUNTERS Off)
set(BUILD_CMSIS_DRIVERS Off)
set(BUILD_TIME Off)
set(BUILD_UART_STDOUT Off)
set(BUILD_FLASH Off)
set(BUILD_BOOT_SEED Off)
set(BUILD_DEVICE_ID Off)
if(NOT DEFINED PLATFORM_CMAKE_FILE)
message (FATAL_ERROR "Platform specific CMake is not defined. Please set PLATFORM_CMAKE_FILE.")
elseif(NOT EXISTS ${PLATFORM_CMAKE_FILE})
message (FATAL_ERROR "Platform specific CMake \"${PLATFORM_CMAKE_FILE}\" file does not exist. Please fix value of PLATFORM_CMAKE_FILE.")
else()
include(${PLATFORM_CMAKE_FILE})
endif()

View File

@ -122,7 +122,7 @@ enum spm_err_t tfm_spm_db_init(void)
++g_spm_partition_db.partition_count; ++g_spm_partition_db.partition_count;
/* Add user-defined secure partitions */ /* Add user-defined secure partitions */
#include "secure_fw/services/tfm_partition_list.inc" #include "tfm_partition_list.inc"
g_spm_partition_db.is_init = 1; g_spm_partition_db.is_init = 1;

View File

@ -65,11 +65,10 @@ struct spm_partition_desc_t {
#ifdef TFM_PSA_API #ifdef TFM_PSA_API
struct tfm_thrd_ctx sp_thrd; struct tfm_thrd_ctx sp_thrd;
/* /*
* FixMe: Hard code stack is not aligned with the definition in the * stack_limit points to starting address of the partitions' stack plus the partitions' stack size.
* manifest. It will use the partition stacks in the linker scripts/sct
* files include Level 1 to 3.
*/ */
uint8_t stack[TFM_STACK_SIZE] __attribute__((aligned(8))); uint32_t stack_limit;
uint32_t stack_size;
#endif #endif
}; };

View File

@ -76,7 +76,7 @@ struct spm_partition_db_t {
} while (0) } while (0)
#endif #endif
#define PARTITION_DECLARE(partition, flag, type, id, priority) \ #define PARTITION_DECLARE(partition, flag, type, id, priority, part_stack_size) \
do { \ do { \
REGION_DECLARE(Image$$, partition, $$Base); \ REGION_DECLARE(Image$$, partition, $$Base); \
REGION_DECLARE(Image$$, partition, $$Limit); \ REGION_DECLARE(Image$$, partition, $$Limit); \
@ -102,8 +102,12 @@ struct spm_partition_db_t {
if (g_spm_partition_db.partition_count >= SPM_MAX_PARTITIONS) { \ if (g_spm_partition_db.partition_count >= SPM_MAX_PARTITIONS) { \
return SPM_ERR_INVALID_CONFIG; \ return SPM_ERR_INVALID_CONFIG; \
} \ } \
__attribute__((section(".data.partitions_stacks"))) \
static uint8_t partition##_stack[part_stack_size] __attribute__((aligned(8))); \
part_ptr = &(g_spm_partition_db.partitions[ \ part_ptr = &(g_spm_partition_db.partitions[ \
g_spm_partition_db.partition_count]); \ g_spm_partition_db.partition_count]); \
part_ptr->stack_limit = (uint32_t)partition##_stack; \
part_ptr->stack_size = part_stack_size; \
PARTITION_INIT_STATIC_DATA(part_ptr->static_data, partition, flags, \ PARTITION_INIT_STATIC_DATA(part_ptr->static_data, partition, flags, \
id, priority); \ id, priority); \
PARTITION_INIT_RUNTIME_DATA(part_ptr->runtime_data, partition); \ PARTITION_INIT_RUNTIME_DATA(part_ptr->runtime_data, partition); \

View File

@ -29,7 +29,7 @@
*/ */
#define TFM_SP_CORE_ID (1) #define TFM_SP_CORE_ID (1)
#include "secure_fw/services/tfm_partition_defs.inc" #include "tfm_partition_defs.inc"
/* This limit is only used to define the size of the database reserved for /* This limit is only used to define the size of the database reserved for
* partitions. There's no requirement that it match the number of partitions * partitions. There's no requirement that it match the number of partitions

View File

@ -110,13 +110,13 @@ psa_handle_t tfm_psa_connect_veneer(uint32_t sid, uint32_t minor_version);
* *
* \param[in] handle Handle to connection * \param[in] handle Handle to connection
* \param[in] in_vecs invec containing pointer/count of input vectors * \param[in] in_vecs invec containing pointer/count of input vectors
* \param[in] out_vecs invec containing pointer/count of output vectors * \param[in] out_vecs outvec containing pointer/count of output vectors
* *
* \return Returns \ref psa_status_t status code * \return Returns \ref psa_status_t status code
*/ */
psa_status_t tfm_psa_call_veneer(psa_handle_t handle, psa_status_t tfm_psa_call_veneer(psa_handle_t handle,
const psa_invec *in_vecs, const psa_invec *in_vecs,
const psa_invec *out_vecs); psa_outvec *out_vecs);
/** /**
* \brief Close connection to secure function referenced by a connection handle * \brief Close connection to secure function referenced by a connection handle