Merge pull request #827 from adamgreen/rtxNoStackCheckForMainThread

RTOS: Main thread should not write MAGIC_WORD to stack
pull/809/head
Martin Kojtal 2015-01-05 07:50:23 +01:00
commit fdc60ac217
1 changed files with 7 additions and 6 deletions

View File

@ -547,18 +547,19 @@ osThreadId svcThreadCreate (osThreadDef_t *thread_def, void *argument) {
U8 priority = thread_def->tpriority - osPriorityIdle + 1;
P_TCB task_context = &thread_def->tcb;
/* If "size != 0" use a private user provided stack. */
/* Utilize the user provided stack. */
task_context->stack = (U32*)thread_def->stack_pointer;
task_context->priv_stack = thread_def->stacksize;
/* Pass parameter 'argv' to 'rt_init_context' */
task_context->msg = argument;
/* For 'size == 0' system allocates the user stack from the memory pool. */
rt_init_context (task_context, priority, (FUNCP)thread_def->pthread);
/* Find a free entry in 'os_active_TCB' table. */
OS_TID tsk = rt_get_TID ();
os_active_TCB[tsk-1] = task_context;
task_context->task_id = tsk;
/* Pass parameter 'argv' to 'rt_init_context' */
task_context->msg = argument;
/* Initialize thread context structure, including the thread's stack. */
rt_init_context (task_context, priority, (FUNCP)thread_def->pthread);
/* Dispatch this task to the scheduler for execution. */
DBG_TASK_NOTIFY(task_context, __TRUE);
rt_dispatch (task_context);