Skip to content

Commit 4a77605

Browse files
author
Charley Chu
committed
Move current TFM to TFM_V1_1
Named TFM V1.1 as TFM_V1_1 instead of TFM_V1.1 as TFM_V1.1 is invalid as macro name Signed-off-by: Charley Chu <[email protected]>
1 parent 7a67ff8 commit 4a77605

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+23
-35
lines changed

features/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_DUALCPU/src/platform_ns_mailbox.c renamed to features/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_1/TARGET_TFM_DUALCPU/src/platform_ns_mailbox.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ int32_t tfm_ns_mailbox_hal_notify_peer(void)
5454

5555
static int32_t mailbox_sema_init(void)
5656
{
57-
#if defined(CY_IPC_DEFAULT_CFG_DISABLE)
5857
/* semaphore data */
5958
static uint32_t tfm_sema __attribute__((section("TFM_SHARED_DATA")));
6059

@@ -63,7 +62,6 @@ static int32_t mailbox_sema_init(void)
6362
&tfm_sema) != CY_IPC_SEMA_SUCCESS) {
6463
return PLATFORM_MAILBOX_INIT_ERROR;
6564
}
66-
#endif
6765
return PLATFORM_MAILBOX_SUCCESS;
6866
}
6967

@@ -120,7 +118,11 @@ int32_t tfm_ns_mailbox_hal_init(struct ns_mailbox_queue_t *queue)
120118

121119
const void *tfm_ns_mailbox_get_task_handle(void)
122120
{
123-
return osThreadGetId();;
121+
#ifdef TFM_MULTI_CORE_MULTI_CLIENT_CALL
122+
return osThreadGetId();
123+
#else
124+
return NULL;
125+
#endif
124126
}
125127

126128
void tfm_ns_mailbox_hal_wait_reply(mailbox_msg_handle_t handle)
@@ -277,7 +279,7 @@ static bool mailbox_clear_intr(void)
277279
return true;
278280
}
279281

280-
void cpuss_interrupts_ipc_8_IRQHandler(void)
282+
void cpuss_interrupts_ipc_5_IRQHandler(void)
281283
{
282284
uint32_t magic;
283285
mailbox_msg_handle_t handle;
@@ -297,6 +299,9 @@ void cpuss_interrupts_ipc_8_IRQHandler(void)
297299

298300
task_handle = (osThreadId_t)tfm_ns_mailbox_get_msg_owner(handle);
299301
if (task_handle) {
302+
/* According to the description of CMSIS-RTOS v2 Thread Flags,
303+
* osThreadFlagsSet() can be called inside Interrupt Service
304+
* Routine. */
300305
osThreadFlagsSet(task_handle, handle);
301306
}
302307
}

features/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_DUALCPU/src/tfm_multi_core_api.c renamed to features/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_1/TARGET_TFM_DUALCPU/src/tfm_multi_core_api.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,15 @@
99
#include "tfm_mailbox.h"
1010
#include "tfm_multi_core_api.h"
1111
#include "cmsis_os2.h"
12-
#include "mbed_rtos_storage.h"
1312

1413
#define MAX_SEMAPHORE_COUNT NUM_MAILBOX_QUEUE_SLOT
1514

16-
static void *ns_lock_handle = NULL;
17-
static mbed_rtos_storage_semaphore_t tfm_ns_sema_obj;
15+
static osSemaphoreId_t ns_lock_handle = NULL;
1816

1917
__attribute__((weak))
2018
enum tfm_status_e tfm_ns_interface_init(void)
2119
{
22-
osSemaphoreAttr_t sema_attrib = {
23-
.name = "tfm_ns_lock",
24-
.attr_bits = 0,
25-
.cb_size = sizeof(tfm_ns_sema_obj),
26-
.cb_mem = &tfm_ns_sema_obj
27-
};
20+
osSemaphoreAttr_t sema_attrib = {0};
2821

2922
ns_lock_handle = osSemaphoreNew(MAX_SEMAPHORE_COUNT,
3023
MAX_SEMAPHORE_COUNT,

features/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_DUALCPU/src/tfm_multi_core_psa_ns_api.c renamed to features/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_1/TARGET_TFM_DUALCPU/src/tfm_multi_core_psa_ns_api.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ uint32_t psa_framework_version(void)
6262
uint32_t version;
6363
int32_t ret;
6464

65-
if (tfm_ns_multi_core_lock_acquire() != 0) {
65+
if (tfm_ns_multi_core_lock_acquire() != TFM_SUCCESS) {
6666
return PSA_VERSION_NONE;
6767
}
6868

@@ -80,7 +80,7 @@ uint32_t psa_framework_version(void)
8080
version = PSA_VERSION_NONE;
8181
}
8282

83-
if (tfm_ns_multi_core_lock_release() != 0) {
83+
if (tfm_ns_multi_core_lock_release() != TFM_SUCCESS) {
8484
return PSA_VERSION_NONE;
8585
}
8686

@@ -96,7 +96,7 @@ uint32_t psa_version(uint32_t sid)
9696

9797
params.psa_version_params.sid = sid;
9898

99-
if (tfm_ns_multi_core_lock_acquire() != 0) {
99+
if (tfm_ns_multi_core_lock_acquire() != TFM_SUCCESS) {
100100
return PSA_VERSION_NONE;
101101
}
102102

@@ -114,7 +114,7 @@ uint32_t psa_version(uint32_t sid)
114114
version = PSA_VERSION_NONE;
115115
}
116116

117-
if (tfm_ns_multi_core_lock_release() != 0) {
117+
if (tfm_ns_multi_core_lock_release() != TFM_SUCCESS) {
118118
return PSA_VERSION_NONE;
119119
}
120120

@@ -131,7 +131,7 @@ psa_handle_t psa_connect(uint32_t sid, uint32_t version)
131131
params.psa_connect_params.sid = sid;
132132
params.psa_connect_params.version = version;
133133

134-
if (tfm_ns_multi_core_lock_acquire() != 0) {
134+
if (tfm_ns_multi_core_lock_acquire() != TFM_SUCCESS) {
135135
return PSA_NULL_HANDLE;
136136
}
137137

@@ -149,7 +149,7 @@ psa_handle_t psa_connect(uint32_t sid, uint32_t version)
149149
psa_handle = PSA_NULL_HANDLE;
150150
}
151151

152-
if (tfm_ns_multi_core_lock_release() != 0) {
152+
if (tfm_ns_multi_core_lock_release() != TFM_SUCCESS) {
153153
return PSA_NULL_HANDLE;
154154
}
155155

@@ -172,7 +172,7 @@ psa_status_t psa_call(psa_handle_t handle, int32_t type,
172172
params.psa_call_params.out_vec = out_vec;
173173
params.psa_call_params.out_len = out_len;
174174

175-
if (tfm_ns_multi_core_lock_acquire() != 0) {
175+
if (tfm_ns_multi_core_lock_acquire() != TFM_SUCCESS) {
176176
return PSA_ERROR_GENERIC_ERROR;
177177
}
178178

@@ -190,7 +190,7 @@ psa_status_t psa_call(psa_handle_t handle, int32_t type,
190190
status = PSA_INTER_CORE_COMM_ERR;
191191
}
192192

193-
if (tfm_ns_multi_core_lock_release() != 0) {
193+
if (tfm_ns_multi_core_lock_release() != TFM_SUCCESS) {
194194
return PSA_ERROR_GENERIC_ERROR;
195195
}
196196

@@ -205,7 +205,7 @@ void psa_close(psa_handle_t handle)
205205

206206
params.psa_close_params.handle = handle;
207207

208-
if (tfm_ns_multi_core_lock_acquire() != 0) {
208+
if (tfm_ns_multi_core_lock_acquire() != TFM_SUCCESS) {
209209
return;
210210
}
211211

features/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/include/platform_multicore.h renamed to features/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_1/include/platform_multicore.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
#define IPC_PSA_CLIENT_CALL_IPC_INTR cpuss_interrupts_ipc_6_IRQn
2020

2121
#define IPC_PSA_CLIENT_REPLY_CHAN (9)
22-
#define IPC_PSA_CLIENT_REPLY_INTR_STRUCT (8)
22+
#define IPC_PSA_CLIENT_REPLY_INTR_STRUCT (5)
2323
#define IPC_PSA_CLIENT_REPLY_INTR_MASK (1 << IPC_PSA_CLIENT_REPLY_CHAN)
2424
#define IPC_PSA_CLIENT_REPLY_NOTIFY_MASK (1 << IPC_PSA_CLIENT_REPLY_INTR_STRUCT)
25-
#define IPC_PSA_CLIENT_REPLY_IPC_INTR cpuss_interrupts_ipc_8_IRQn
25+
#define IPC_PSA_CLIENT_REPLY_IPC_INTR cpuss_interrupts_ipc_5_IRQn
2626

2727
#define IPC_RX_RELEASE_MASK (0)
2828

features/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/include/psa_manifest/sid.h renamed to features/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_1/include/psa_manifest/sid.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ extern "C" {
6161
#define SPM_CORE_TEST_INIT_SUCCESS_VERSION (1U)
6262
#define SPM_CORE_TEST_DIRECT_RECURSION_SID (0x0000F021U)
6363
#define SPM_CORE_TEST_DIRECT_RECURSION_VERSION (1U)
64-
#define SPM_CORE_TEST_MPU_ACCESS_SID (0x0000F022U)
65-
#define SPM_CORE_TEST_MPU_ACCESS_VERSION (1U)
66-
#define SPM_CORE_TEST_MEMORY_PERMISSIONS_SID (0x0000F023U)
67-
#define SPM_CORE_TEST_MEMORY_PERMISSIONS_VERSION (1U)
6864
#define SPM_CORE_TEST_SS_TO_SS_SID (0x0000F024U)
6965
#define SPM_CORE_TEST_SS_TO_SS_VERSION (1U)
7066
#define SPM_CORE_TEST_SS_TO_SS_BUFFER_SID (0x0000F025U)

features/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/include/tfm_ns_mailbox.h renamed to features/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_1/include/tfm_ns_mailbox.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ bool tfm_ns_mailbox_is_msg_replied(mailbox_msg_handle_t handle);
8484
*/
8585
int32_t tfm_ns_mailbox_init(struct ns_mailbox_queue_t *queue);
8686

87-
#ifdef TFM_MULTI_CORE_MULTI_CLIENT_CALL
8887
/**
8988
* \brief Get the handle of the current non-secure task executing mailbox
9089
* functionalities
@@ -97,12 +96,6 @@ int32_t tfm_ns_mailbox_init(struct ns_mailbox_queue_t *queue);
9796
* \return Return the handle of task.
9897
*/
9998
const void *tfm_ns_mailbox_get_task_handle(void);
100-
#else
101-
static inline const void *tfm_ns_mailbox_get_task_handle(void)
102-
{
103-
return NULL;
104-
}
105-
#endif
10699

107100
/**
108101
* \brief Fetch the handle to the first replied mailbox message in the NSPE

targets/targets.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
],
136136
"extra_labels": [
137137
"TFM",
138+
"TFM_V1_1",
138139
"TFM_V8M"
139140
],
140141
"device_has": [

0 commit comments

Comments
 (0)