|
56 | 56 | #if ( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) )
|
57 | 57 |
|
58 | 58 | /* Only the current stack state is to be checked. */
|
59 |
| - #define taskCHECK_FOR_STACK_OVERFLOW() \ |
60 |
| - do { \ |
61 |
| - /* Is the currently saved stack pointer within the stack limit? */ \ |
62 |
| - if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack + portSTACK_LIMIT_PADDING ) \ |
63 |
| - { \ |
64 |
| - vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ |
65 |
| - } \ |
| 59 | + #define taskCHECK_FOR_STACK_OVERFLOW() \ |
| 60 | + do { \ |
| 61 | + /* Is the currently saved stack pointer within the stack limit? */ \ |
| 62 | + if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack + portSTACK_LIMIT_PADDING ) \ |
| 63 | + { \ |
| 64 | + char * pcOverflowTaskName = pxCurrentTCB->pcTaskName; \ |
| 65 | + vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pcOverflowTaskName ); \ |
| 66 | + } \ |
66 | 67 | } while( 0 )
|
67 | 68 |
|
68 | 69 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
|
|
71 | 72 | #if ( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) )
|
72 | 73 |
|
73 | 74 | /* Only the current stack state is to be checked. */
|
74 |
| - #define taskCHECK_FOR_STACK_OVERFLOW() \ |
75 |
| - do { \ |
76 |
| - \ |
77 |
| - /* Is the currently saved stack pointer within the stack limit? */ \ |
78 |
| - if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack - portSTACK_LIMIT_PADDING ) \ |
79 |
| - { \ |
80 |
| - vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ |
81 |
| - } \ |
| 75 | + #define taskCHECK_FOR_STACK_OVERFLOW() \ |
| 76 | + do { \ |
| 77 | + \ |
| 78 | + /* Is the currently saved stack pointer within the stack limit? */ \ |
| 79 | + if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack - portSTACK_LIMIT_PADDING ) \ |
| 80 | + { \ |
| 81 | + char * pcOverflowTaskName = pxCurrentTCB->pcTaskName; \ |
| 82 | + vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pcOverflowTaskName ); \ |
| 83 | + } \ |
82 | 84 | } while( 0 )
|
83 | 85 |
|
84 | 86 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
|
85 | 87 | /*-----------------------------------------------------------*/
|
86 | 88 |
|
87 | 89 | #if ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) )
|
88 | 90 |
|
89 |
| - #define taskCHECK_FOR_STACK_OVERFLOW() \ |
90 |
| - do { \ |
91 |
| - const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \ |
92 |
| - const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5U; \ |
93 |
| - \ |
94 |
| - if( ( pulStack[ 0 ] != ulCheckValue ) || \ |
95 |
| - ( pulStack[ 1 ] != ulCheckValue ) || \ |
96 |
| - ( pulStack[ 2 ] != ulCheckValue ) || \ |
97 |
| - ( pulStack[ 3 ] != ulCheckValue ) ) \ |
98 |
| - { \ |
99 |
| - vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ |
100 |
| - } \ |
| 91 | + #define taskCHECK_FOR_STACK_OVERFLOW() \ |
| 92 | + do { \ |
| 93 | + const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \ |
| 94 | + const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \ |
| 95 | + \ |
| 96 | + if( ( pulStack[ 0 ] != ulCheckValue ) || \ |
| 97 | + ( pulStack[ 1 ] != ulCheckValue ) || \ |
| 98 | + ( pulStack[ 2 ] != ulCheckValue ) || \ |
| 99 | + ( pulStack[ 3 ] != ulCheckValue ) ) \ |
| 100 | + { \ |
| 101 | + char * pcOverflowTaskName = pxCurrentTCB->pcTaskName; \ |
| 102 | + vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pcOverflowTaskName ); \ |
| 103 | + } \ |
101 | 104 | } while( 0 )
|
102 | 105 |
|
103 | 106 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
|
|
120 | 123 | /* Has the extremity of the task stack ever been written over? */ \
|
121 | 124 | if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \
|
122 | 125 | { \
|
123 |
| - vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ |
| 126 | + char * pcOverflowTaskName = pxCurrentTCB->pcTaskName; \ |
| 127 | + vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pcOverflowTaskName ); \ |
124 | 128 | } \
|
125 | 129 | } while( 0 )
|
126 | 130 |
|
|
0 commit comments