Skip to content

Commit cacf085

Browse files
committed
rtx - set task id prior rt_init_context
This is a bugfix, which caused LPC1549 to fail (os_error). There was a fix introduced to rtx mbed sources. For more information: 4614039
1 parent 239c40e commit cacf085

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

libraries/rtos/rtx/TARGET_CORTEX_M/rt_Task.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,18 +234,19 @@ OS_TID rt_tsk_create (FUNCP task, U32 prio_stksz, void *stk, void *argv) {
234234
/* If "size != 0" use a private user provided stack. */
235235
task_context->stack = stk;
236236
task_context->priv_stack = prio_stksz >> 8;
237-
/* Pass parameter 'argv' to 'rt_init_context' */
238-
task_context->msg = argv;
239-
/* For 'size == 0' system allocates the user stack from the memory pool. */
240-
rt_init_context (task_context, (U8)(prio_stksz & 0xFFU), task);
241237

242238
/* Find a free entry in 'os_active_TCB' table. */
243239
i = rt_get_TID ();
244240
if (i == 0U) {
245241
return (0U);
246242
}
247-
os_active_TCB[i-1U] = task_context;
248243
task_context->task_id = (U8)i;
244+
/* Pass parameter 'argv' to 'rt_init_context' */
245+
task_context->msg = argv;
246+
/* For 'size == 0' system allocates the user stack from the memory pool. */
247+
rt_init_context (task_context, (U8)(prio_stksz & 0xFFU), task);
248+
249+
os_active_TCB[i-1U] = task_context;
249250
DBG_TASK_NOTIFY(task_context, __TRUE);
250251
rt_dispatch (task_context);
251252
return ((OS_TID)i);

0 commit comments

Comments
 (0)