TF-M patch: General modifications

- Remove un-needed files
- Disable printf and uart
- Modify include paths
- Guard macros from mbed_lib with ifndef

(cherry picked from commit 1f30b52488)
pull/9915/head
Michael Schwarcz 2019-02-07 11:51:12 +02:00
parent 823e5a2a7f
commit 71cd34df32
12 changed files with 11 additions and 224 deletions

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__
#define __TFM_MESSAGE_QUEUE_H__
#ifndef TFM_MSG_QUEUE_MAX_MSG_NUM
#define TFM_MSG_QUEUE_MAX_MSG_NUM 128
#endif
#define TFM_MSG_MAGIC 0x15154343
/* Message struct to collect parameter from client */
struct tfm_msg_body_t {

View File

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

View File

@ -1,12 +0,0 @@
/*
* Copyright (c) 2018, 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"
#endif

View File

@ -45,7 +45,7 @@ TFM_POOL_DECLARE(msg_db_pool, sizeof(struct tfm_msg_body_t),
TFM_MSG_QUEUE_MAX_MSG_NUM);
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 ***********************/

View File

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

View File

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

View File

@ -12,7 +12,6 @@
#include "tfm_secure_api.h"
#include "tfm_nspm.h"
#include "secure_utilities.h"
#include "uart_stdout.h"
#include "secure_fw/spm/spm_api.h"
#include "region_defs.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

@ -123,7 +123,7 @@ enum spm_err_t tfm_spm_db_init(void)
++g_spm_partition_db.partition_count;
/* 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;

View File

@ -29,7 +29,7 @@
*/
#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
* partitions. There's no requirement that it match the number of partitions