mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2026-01-17 15:20:25 -05:00
Add asserts to check stack overflow at task creation
This commit adds assert to allow developers to check for overflow of undersized task stack during task creation.
This commit is contained in:
parent
a9cb459206
commit
3ace38969b
1 changed files with 10 additions and 0 deletions
10
tasks.c
10
tasks.c
|
|
@ -2010,6 +2010,16 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
|
|||
}
|
||||
#endif /* portUSING_MPU_WRAPPERS */
|
||||
|
||||
#if ( portSTACK_GROWTH < 0 )
|
||||
{
|
||||
configASSERT( ( ( portPOINTER_SIZE_TYPE ) ( pxTopOfStack - pxNewTCB->pxTopOfStack ) ) < ( ( portPOINTER_SIZE_TYPE ) uxStackDepth ) );
|
||||
}
|
||||
#else /* portSTACK_GROWTH */
|
||||
{
|
||||
configASSERT( ( ( portPOINTER_SIZE_TYPE ) ( pxNewTCB->pxTopOfStack - pxTopOfStack ) ) < ( ( portPOINTER_SIZE_TYPE ) uxStackDepth ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Initialize task state and task attributes. */
|
||||
#if ( configNUMBER_OF_CORES > 1 )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue