这里写自定义目录标题
FreeRTOS中任务控制块中关于堆栈的定义
typedef struct tskTaskControlBlock
{
volatile StackType_t *pxTopOfStack; /*< Points to the location of the last item placed on the tasks stack. THIS MUST BE THE FIRST MEMBER OF THE TCB STRUCT. */
//指向放置在任务堆栈上的最后一个项目的位置,对于向下增长的栈,这个总是指向最后一个入栈的项目。
#if ( portUSING_MPU_WRAPPERS == 1 )
xMPU_SETTINGS xMPUSettings; /*< The MPU settings are defined as part of the port layer. THIS MUST BE THE SECOND MEMBER OF THE TCB STRUCT. */
#endif
ListItem_t xStateListItem; /*< The list that the state list item of a task is reference from denotes the state of that task (Ready, Blocked, Suspended ). */
ListItem_t xEventListItem; /*< Used to reference a task from an event list. */
UBaseType_t uxPriority; /*< The priority of the task. 0 is the lowest priority. */
StackType_t *pxStack; /*< Points to the start of the stack. */
//位置是固定的,随着任务的运行,堆栈可能溢出,堆栈往下增长的系统中,这个变量就可以判断堆栈是否溢出,对于堆栈往上增长的系统,想确定堆栈是否溢出,还需要pxEndOfStack这个变量。
char pcTaskName[ configMAX_TASK_NAME_LEN ];/*< Descriptive name given to the task when created. Facilitates debugging only. */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
#if ( portSTACK_GROWTH > 0 )
StackType_t *pxEndOfStack; /*< Points to the end of the stack on architectures where the stack grows up from low memory. *///如果堆栈向上生长(portSTACK_GROWTH > 0),指针pxEndOfStack指向堆栈尾部,用于检验堆栈是否溢出。
#endif
...
}
xTaskCreate()函数中对栈的申请的过程
BaseType_t xTaskCreate( TaskFunction_t pxTaskCode, //函数指针,指向任务函数的入口