【背景】M33平台GCC环境下TZ默认开启TZ。

【修改方案】
1,在M33平台下增加默认选项及开关
2,删除build.gn编译tz的部分,该部分由使用者编译在安全态
3,修改tz初始化的一个问题

【影响】
对现有的产品编译不会有影响。

re #I45UYU
Signed-off-by: wangchen <253227059@qq.com>
This commit is contained in:
wangchen 2021-08-16 20:09:05 +08:00
parent 02beb6b04d
commit f63c45930c
7 changed files with 12 additions and 5 deletions

View File

@ -40,5 +40,6 @@ declare_args() {
enable_ohos_kernel_liteos_m_trace = false enable_ohos_kernel_liteos_m_trace = false
enable_ohos_kernel_liteos_m_lwip = false enable_ohos_kernel_liteos_m_lwip = false
enable_ohos_kernel_liteos_m_dynlink = false enable_ohos_kernel_liteos_m_dynlink = false
enable_ohos_kernel_liteos_m_tz = false
ohos_kernel_liteos_m_lwip_path = "components/net/lwip-2.1:lwip" ohos_kernel_liteos_m_lwip_path = "components/net/lwip-2.1:lwip"
} }

View File

@ -62,7 +62,11 @@ static_library("kernel") {
} else if ("$board_cpu" == "cortex-m7") { } else if ("$board_cpu" == "cortex-m7") {
deps = [ "arch/arm/cortex-m7/gcc/:arch" ] deps = [ "arch/arm/cortex-m7/gcc/:arch" ]
} else if ("$board_cpu" == "cortex-m33") { } else if ("$board_cpu" == "cortex-m33") {
deps = [ "arch/arm/cortex-m33/gcc/TZ:arch" ] if (enable_ohos_kernel_liteos_m_tz == true) {
deps = [ "arch/arm/cortex-m33/gcc/TZ:arch" ]
} else {
deps = [ "arch/arm/cortex-m33/gcc/NTZ:arch" ]
}
} else if ("$board_cpu" == "") { } else if ("$board_cpu" == "") {
if ("$board_arch" == "rv32imac" || "$board_arch" == "rv32imafdc") { if ("$board_arch" == "rv32imac" || "$board_arch" == "rv32imafdc") {
deps = [ "arch/risc-v/riscv32/gcc:arch" ] deps = [ "arch/risc-v/riscv32/gcc:arch" ]

View File

@ -35,9 +35,6 @@ static_library("arch") {
"non_secure/los_interrupt.c", "non_secure/los_interrupt.c",
"non_secure/los_timer.c", "non_secure/los_timer.c",
"non_secure/los_trustzone.c", "non_secure/los_trustzone.c",
"secure/los_secure_context.c",
"secure/los_secure_context_asm.S",
"secure/los_secure_heap.c",
] ]
include_dirs = [ include_dirs = [

View File

@ -34,6 +34,7 @@
#include "los_secure_context.h" #include "los_secure_context.h"
#include "los_debug.h" #include "los_debug.h"
#include "los_arch_context.h" #include "los_arch_context.h"
#include "los_interrupt.h"
OsSecureContext *g_secureContext = NULL; OsSecureContext *g_secureContext = NULL;
@ -69,6 +70,7 @@ VOID LOS_SecureContextAlloc(UINT32 secureStackSize)
return; return;
} }
LOS_ASSERT((__get_IPSR() == 0) && (__get_PRIMASK() == 0));
secureStackSize = LOS_Align(secureStackSize, sizeof(UINTPTR)); secureStackSize = LOS_Align(secureStackSize, sizeof(UINTPTR));
HalSVCSecureContextAlloc(secureStackSize); HalSVCSecureContextAlloc(secureStackSize);
} }

View File

@ -34,7 +34,7 @@
#include "los_config.h" #include "los_config.h"
#include "los_list.h" #include "los_list.h"
STATIC UINT8 g_secureHeap[LOSCFG_SECURE_HEAP_SIZE] = {0}; STATIC UINT8 __attribute__((aligned(0x4)))g_secureHeap[LOSCFG_SECURE_HEAP_SIZE] = {0};
STATIC LOS_DL_LIST g_secureHeapFreeList = {NULL, NULL}; STATIC LOS_DL_LIST g_secureHeapFreeList = {NULL, NULL};
struct OsSecureHeapNode { struct OsSecureHeapNode {

View File

@ -34,6 +34,7 @@
#include "los_secure_context.h" #include "los_secure_context.h"
#include "los_debug.h" #include "los_debug.h"
#include "los_arch_context.h" #include "los_arch_context.h"
#include "los_interrupt.h"
OsSecureContext *g_secureContext = NULL; OsSecureContext *g_secureContext = NULL;
@ -69,6 +70,7 @@ VOID LOS_SecureContextAlloc(UINT32 secureStackSize)
return; return;
} }
LOS_ASSERT((__get_IPSR() == 0) && (__get_PRIMASK() == 0));
secureStackSize = LOS_Align(secureStackSize, sizeof(UINTPTR)); secureStackSize = LOS_Align(secureStackSize, sizeof(UINTPTR));
HalSVCSecureContextAlloc(secureStackSize); HalSVCSecureContextAlloc(secureStackSize);
} }

View File

@ -34,6 +34,7 @@
#include "los_config.h" #include "los_config.h"
#include "los_list.h" #include "los_list.h"
#pragma data_alignment=0x4
STATIC UINT8 g_secureHeap[LOSCFG_SECURE_HEAP_SIZE] = {0}; STATIC UINT8 g_secureHeap[LOSCFG_SECURE_HEAP_SIZE] = {0};
STATIC LOS_DL_LIST g_secureHeapFreeList = {NULL, NULL}; STATIC LOS_DL_LIST g_secureHeapFreeList = {NULL, NULL};