From 4e89c9261fa175f5137ae7ebe527b930a8c483c5 Mon Sep 17 00:00:00 2001 From: Deepika Date: Thu, 8 Feb 2018 15:52:13 -0600 Subject: [PATCH 1/2] RTX changes pulled in from d20b8aad7f5e RTX5: Added TrustZone Module Identifier configuration for Idle and Timer Thread --- .../TARGET_CORTEX/rtx5/RTX/Config/RTX_Config.h | 18 +++++++++++++++++- rtos/TARGET_CORTEX/rtx5/RTX/Source/rtx_lib.c | 14 ++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/rtos/TARGET_CORTEX/rtx5/RTX/Config/RTX_Config.h b/rtos/TARGET_CORTEX/rtx5/RTX/Config/RTX_Config.h index 4cd0f84a0e..ea5c50b401 100644 --- a/rtos/TARGET_CORTEX/rtx5/RTX/Config/RTX_Config.h +++ b/rtos/TARGET_CORTEX/rtx5/RTX/Config/RTX_Config.h @@ -17,7 +17,7 @@ * * ----------------------------------------------------------------------------- * - * $Revision: V5.1.0 + * $Revision: V5.2.0 * * Project: CMSIS-RTOS RTX * Title: RTX Configuration definitions @@ -181,6 +181,14 @@ #define OS_IDLE_THREAD_STACK_SIZE 200 #endif +// Idle Thread TrustZone Module Identifier +// Defines TrustZone Thread Context Management Identifier. +// Applies only to cores with TrustZone technology. +// Default: 0 (not used) +#ifndef OS_IDLE_THREAD_TZ_MOD_ID +#define OS_IDLE_THREAD_TZ_MOD_ID 0 +#endif + // Stack overrun checking // Enable stack overrun checks at thread switch. // Enabling this option increases slightly the execution time of a thread switch. @@ -242,6 +250,14 @@ #define OS_TIMER_THREAD_STACK_SIZE 200 #endif +// Timer Thread TrustZone Module Identifier +// Defines TrustZone Thread Context Management Identifier. +// Applies only to cores with TrustZone technology. +// Default: 0 (not used) +#ifndef OS_TIMER_THREAD_TZ_MOD_ID +#define OS_TIMER_THREAD_TZ_MOD_ID 0 +#endif + // Timer Callback Queue entries <0-256> // Number of concurrent active timer callback functions. // May be set to 0 when timers are not used. diff --git a/rtos/TARGET_CORTEX/rtx5/RTX/Source/rtx_lib.c b/rtos/TARGET_CORTEX/rtx5/RTX/Source/rtx_lib.c index 70b18e917a..17e1b6801f 100644 --- a/rtos/TARGET_CORTEX/rtx5/RTX/Source/rtx_lib.c +++ b/rtos/TARGET_CORTEX/rtx5/RTX/Source/rtx_lib.c @@ -128,7 +128,12 @@ static const osThreadAttr_t os_idle_thread_attr = { &os_idle_thread_stack, (uint32_t)sizeof(os_idle_thread_stack), osPriorityIdle, - 0U, 0U +#if defined(OS_IDLE_THREAD_TZ_MOD_ID) + (uint32_t)OS_IDLE_THREAD_TZ_MOD_ID, +#else + 0U, +#endif + 0U }; @@ -176,7 +181,12 @@ static const osThreadAttr_t os_timer_thread_attr = { &os_timer_thread_stack, (uint32_t)sizeof(os_timer_thread_stack), (osPriority_t)OS_TIMER_THREAD_PRIO, - 0U, 0U +#if defined(OS_TIMER_THREAD_TZ_MOD_ID) + (uint32_t)OS_TIMER_THREAD_TZ_MOD_ID, +#else + 0U, +#endif + 0U }; // Timer Message Queue Control Block From 9fa0a52c048030f279e732f55136ffcb79fe1aae Mon Sep 17 00:00:00 2001 From: Deepika Date: Thu, 8 Feb 2018 16:03:46 -0600 Subject: [PATCH 2/2] Default values for Trustzone Idle/Timer thread updated Default value for timer/idle thread trustzone identifier is 0, updated it to 1 to allow threads to access secure functions when timer is secure device. --- rtos/TARGET_CORTEX/mbed_rtx_conf.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rtos/TARGET_CORTEX/mbed_rtx_conf.h b/rtos/TARGET_CORTEX/mbed_rtx_conf.h index dfc26c3087..91d024a260 100644 --- a/rtos/TARGET_CORTEX/mbed_rtx_conf.h +++ b/rtos/TARGET_CORTEX/mbed_rtx_conf.h @@ -54,4 +54,7 @@ # define OS_PRIVILEGE_MODE 0 #endif +#define OS_IDLE_THREAD_TZ_MOD_ID 1 +#define OS_TIMER_THREAD_TZ_MOD_ID 1 + #endif /* MBED_RTX_CONF_H */