|
55 | 55 |
|
56 | 56 | /* Stack overflow check is not straight forward to implement for MPU ports |
57 | 57 | * because of the following reasons: |
58 | | - * 1. The context is stroed in TCB and as a result, pxTopOfStack member points |
| 58 | + * 1. The context is stored in TCB and as a result, pxTopOfStack member points |
59 | 59 | * to the context location in TCB. |
60 | 60 | * 2. System calls are executed on a separate privileged only stack. |
61 | 61 | * |
|
82 | 82 | #if ( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) && ( portUSING_MPU_WRAPPERS != 1 ) ) |
83 | 83 |
|
84 | 84 | /* Only the current stack state is to be checked. */ |
85 | | - #define taskCHECK_FOR_STACK_OVERFLOW() \ |
86 | | - do \ |
87 | | - { \ |
88 | | - /* Is the currently saved stack pointer within the stack limit? */ \ |
89 | | - if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack - portSTACK_LIMIT_PADDING ) \ |
90 | | - { \ |
91 | | - char * pcOverflowTaskName = pxCurrentTCB->pcTaskName; \ |
92 | | - vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pcOverflowTaskName ); \ |
93 | | - } \ |
| 85 | + #define taskCHECK_FOR_STACK_OVERFLOW() \ |
| 86 | + do \ |
| 87 | + { \ |
| 88 | + /* Is the currently saved stack pointer within the stack limit? */ \ |
| 89 | + if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack - portSTACK_LIMIT_PADDING ) \ |
| 90 | + { \ |
| 91 | + char * pcOverflowTaskName = pxCurrentTCB->pcTaskName; \ |
| 92 | + vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pcOverflowTaskName ); \ |
| 93 | + } \ |
94 | 94 | } while( 0 ) |
95 | 95 |
|
96 | 96 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */ |
97 | 97 | /*-----------------------------------------------------------*/ |
98 | 98 |
|
99 | 99 | #if ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) && ( portUSING_MPU_WRAPPERS != 1 ) ) |
100 | 100 |
|
101 | | - #define taskCHECK_FOR_STACK_OVERFLOW() \ |
102 | | - do \ |
103 | | - { \ |
104 | | - const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \ |
105 | | - const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5U; \ |
106 | | - \ |
107 | | - if( ( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack + portSTACK_LIMIT_PADDING ) || \ |
108 | | - ( pulStack[ 0 ] != ulCheckValue ) || \ |
109 | | - ( pulStack[ 1 ] != ulCheckValue ) || \ |
110 | | - ( pulStack[ 2 ] != ulCheckValue ) || \ |
111 | | - ( pulStack[ 3 ] != ulCheckValue ) ) \ |
112 | | - { \ |
113 | | - char * pcOverflowTaskName = pxCurrentTCB->pcTaskName; \ |
114 | | - vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pcOverflowTaskName ); \ |
115 | | - } \ |
| 101 | + #define taskCHECK_FOR_STACK_OVERFLOW() \ |
| 102 | + do \ |
| 103 | + { \ |
| 104 | + const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \ |
| 105 | + const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5U; \ |
| 106 | + \ |
| 107 | + if( ( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack + portSTACK_LIMIT_PADDING ) || \ |
| 108 | + ( pulStack[ 0 ] != ulCheckValue ) || \ |
| 109 | + ( pulStack[ 1 ] != ulCheckValue ) || \ |
| 110 | + ( pulStack[ 2 ] != ulCheckValue ) || \ |
| 111 | + ( pulStack[ 3 ] != ulCheckValue ) ) \ |
| 112 | + { \ |
| 113 | + char * pcOverflowTaskName = pxCurrentTCB->pcTaskName; \ |
| 114 | + vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pcOverflowTaskName ); \ |
| 115 | + } \ |
116 | 116 | } while( 0 ) |
117 | 117 |
|
118 | 118 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ |
|
0 commit comments