AnsweredAssumed Answered

FreeRTOS and cmsis

Question asked by Ohil on May 6, 2015
Latest reply on May 26, 2017 by Vito Marolda
Hi,
 
I would like to known if I don't understand something or if there is a bug in cmsis_os.c (STMCube for STM32F429)

1) In osThreadCreate()  stacksize in bytes is directly passed to xTaskCreate() but the definition for the usStackDepth argument is

                                               
usStackDepth The size of the task stack specified as the number of variables the stack can hold - not the number of bytes.


typedef struct os_thread_def  {
  char                   *name;        ///< Thread name
  os_pthread             pthread;      ///< start address of thread function
  osPriority             tpriority;    ///< initial thread priority
  uint32_t               instances;    ///< maximum number of instances of that thread function
  uint32_t               stacksize;    ///< stack size requirements in bytes; 0 is default stack size
} osThreadDef_t;

osThreadId osThreadCreate (const osThreadDef_t *thread_def, void *argument)
{
  TaskHandle_t handle;
 
 
  if (xTaskCreate((TaskFunction_t)thread_def->pthread,(const portCHAR *)thread_def->name,
              thread_def->stacksize, argument, makeFreeRtosPriority(thread_def->tpriority),
              &handle) != pdPASS)  {
    return NULL;
  }
 
  return handle;
}

I think the definition of stacksize in os_thread_def must be changed or the code of
osThreadCreate() must be corrected.

Outcomes