FreeRTOS新建任务时 xTaskCreate 函数有这样一段注释
// 代码已简化
/* If the stack grows down then allocate the stack then the TCB so the stack
* does not grow into the TCB. Likewise if the stack grows up then allocate
* the TCB then the stack. */
#if ( portSTACK_GROWTH > 0 ) // 栈向上生长
{
pxNewTCB = ( TCB_t * ) pvPortMall

本文解析了FreeRTOS中任务创建时栈空间与任务控制块(TCB)分配的顺序,解释了栈增长方向如何影响这两者的分配顺序,并通过实例说明了栈向上或向下增长时的正确分配方式。
最低0.47元/天 解锁文章
2707

被折叠的 条评论
为什么被折叠?



