Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Execution time of this task depends on the size of the task’s stack.
  2. The application can determine the total task stack space (in number of CPU_STK elements) by adding the value of *p_free and *p_used. This number should add up to the task’s stack size which is stored in the .StkSize field of the OS_TCB of the task.
  3. The #define CPU_CFG_STK_GROWTH must be declared (typically from os_cpu.h). When this #define is set to CPU_STK_GROWTH_LO_TO_HI, the stack grows from low memory to high memory. When this #define is set to CPU_STK_GROWTH_HI_TO_LO, the stack grows from high memory to low memory.

Example Usage

Code Block
titleOSTaskStkChk() example usage
          OS_TCB  MyTaskTCB;
           
           
          void Task (void *p_arg)
          {
              OS_ERR        err;
              CPU_STK_SIZE  n_free;
              CPU_STK_SIZE  n_used;
           
           
              (void)&p_arg;
              while (DEF_ON) {
                  :
                  :
                  OSTaskStkChk(&MyTaskTCB,
                               &n_free,
                               &n_used,
                               &err);
                  /* Check "err" */
                  :
                  :
              }
          }

...