Allow non-secure main thread to call secure functions

pull/7302/head
ccli8 2018-05-22 14:43:24 +08:00
parent 43b98cf405
commit 0b00d0ce11
1 changed files with 6 additions and 0 deletions

View File

@ -321,6 +321,12 @@ void mbed_start_main(void)
_main_thread_attr.cb_mem = &_main_obj;
_main_thread_attr.priority = osPriorityNormal;
_main_thread_attr.name = "main_thread";
/* Allow non-secure main thread to call secure functions */
#if defined(DOMAIN_NS) && (DOMAIN_NS == 1U)
_main_thread_attr.tz_module = 1U;
#endif
osThreadId_t result = osThreadNew((osThreadFunc_t)pre_main, NULL, &_main_thread_attr);
if ((void *)result == NULL) {
MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_PLATFORM, MBED_ERROR_CODE_INITIALIZATION_FAILED), "Pre main thread not created", &_main_thread_attr);