sched/tcb: add free tcb flag to support static tcb

Add support for static tcb, applications in some special case can
initialize system resources in advance through static tcb.

|  static struct task_tcb_s g_tcb;
|
|  memset(&g_tcb, 0, sizeof(struct task_tcb_s));
|  g_tcb.cmn.flags = TCB_FLAG_TTYPE_KERNEL;
|  nxtask_init(&g_tcb, "PTCB", 101, NULL, 1024, ptcb_task, NULL, NULL, NULL);
|
|  ...
|  nxtask_activate(&g_tcb.cmn);

Signed-off-by: chao an <anchao@lixiang.com>
This commit is contained in:
chao an
2024-02-26 15:50:56 +08:00
committed by Xiang Xiao
parent 91f0a0f1a8
commit 9489953230
5 changed files with 11 additions and 5 deletions

View File

@@ -303,9 +303,11 @@ int exec_module(FAR struct binary_s *binp,
}
#endif
/* Note that tcb->flags are not modified. 0=normal task */
/* Note that tcb->cmn.flags are not modified. 0=normal task */
/* tcb->flags |= TCB_FLAG_TTYPE_TASK; */
/* tcb->cmn.flags |= TCB_FLAG_TTYPE_TASK; */
tcb->cmn.flags |= TCB_FLAG_FREE_TCB;
/* Initialize the task */