Nummer 0.1 Werkt nog niet volledig

Fork of mbed-rtos by mbed official

Revision:
59:28712e303960
Parent:
53:c35dab33c427
Child:
70:3295e347fd88
--- a/rtx/TARGET_CORTEX_M/rt_CMSIS.c	Tue Dec 16 08:15:25 2014 +0000
+++ b/rtx/TARGET_CORTEX_M/rt_CMSIS.c	Tue Jan 06 16:16:03 2015 +0000
@@ -547,18 +547,19 @@
   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);