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.
diff --git a/tasks.c b/tasks.c
index 1e6ecdc..104ea61 100644
--- a/tasks.c
+++ b/tasks.c
@@ -2010,6 +2010,16 @@
}
#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 )
{