Skip to content

RTOS: using unitiazed task_id to set the MAGIC_WORD for stack overflow check #285

@oresths

Description

@oresths

In rt_CMSIS.c in svcThreadCreate(...) , rt_init_context(...) is called before a proper value is given to task_context->task_id (which is done one line after).

But rt_init_context(...) in rt_Task.c calls rt_init_stack(...) in HAL_CM.c with the following last two lines:
if (p_TCB->task_id != 0x01)
p_TCB->stack[0] = MAGIC_WORD;

That could cause a mismatch in some cases in rt_stk_check (...) in rt_System.c because
os_tsk.run->stack[0] != MAGIC_WORD

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions