Rewrote macro taskCHECK_FOR_STACK_OVERFLOW such that VF can handle it.

This commit is contained in:
Tobias Reinhard 2022-11-16 15:28:33 -05:00
parent b330847935
commit 7675b3bbe4

View file

@ -84,19 +84,41 @@
#if ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) ) #if ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) )
#define taskCHECK_FOR_STACK_OVERFLOW() \ #ifdef VERIFAST
{ \ /* Reason for rewrite:
const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \ * VeriFast complains about unspecified evaluation order of
const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \ * `pxCurrentTCB->pxStack`.
\ *
if( ( pulStack[ 0 ] != ulCheckValue ) || \ */
( pulStack[ 1 ] != ulCheckValue ) || \ #define taskCHECK_FOR_STACK_OVERFLOW() \
( pulStack[ 2 ] != ulCheckValue ) || \ { \
( pulStack[ 3 ] != ulCheckValue ) ) \ TCB_t* tcb = pxCurrentTCB; \
{ \ const uint32_t * const pulStack = ( uint32_t * ) tcb->pxStack; \
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \
} \ \
} if( ( pulStack[ 0 ] != ulCheckValue ) || \
( pulStack[ 1 ] != ulCheckValue ) || \
( pulStack[ 2 ] != ulCheckValue ) || \
( pulStack[ 3 ] != ulCheckValue ) ) \
{ \
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
} \
}
#else
#define taskCHECK_FOR_STACK_OVERFLOW() \
{ \
const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \
const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \
\
if( ( pulStack[ 0 ] != ulCheckValue ) || \
( pulStack[ 1 ] != ulCheckValue ) || \
( pulStack[ 2 ] != ulCheckValue ) || \
( pulStack[ 3 ] != ulCheckValue ) ) \
{ \
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
} \
}
#endif /* VERIFAST */
#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/