-
Notifications
You must be signed in to change notification settings - Fork 167
Closed
Labels
Description
In the file cmsis_os2.c :
When the osThreadNew() function calls the FreeRTOS xTaskCreate() function it casts the stack size parameter to an (uint16_t) as seen below:
#if (configSUPPORT_DYNAMIC_ALLOCATION == 1)
if (xTaskCreate ((TaskFunction_t)func, name, (uint16_t)stack, argument, prio, &hTask) != pdPASS) {
hTask = NULL;
}
However, FreeRTOS allows the stack parameter to be defined by the user using configSTACK_DEPTH_TYPE. If the user defines the stack depth to be a uint32_t it could be truncated when cast to a uin16_t. I recommend the cast to be removed or at the very least, cast to configSTACK_DEPTH_TYPE like:
#if (configSUPPORT_DYNAMIC_ALLOCATION == 1)
if (xTaskCreate((TaskFunction_t)func, name, (configSTACK_DEPTH_TYPE)stack, argument, prio, &hTask) != pdPASS) {
hTask = NULL;
}
#endif
VladimirUmek