|
66 | 66 | */ |
67 | 67 | #if ( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) && ( portUSING_MPU_WRAPPERS != 1 ) ) |
68 | 68 |
|
69 | | - #if ( configNUMBER_OF_CORES == 1 ) |
70 | | - |
71 | 69 | /* Only the current stack state is to be checked. */ |
72 | | - #define taskCHECK_FOR_STACK_OVERFLOW() \ |
| 70 | + #define taskCHECK_FOR_STACK_OVERFLOW() \ |
73 | 71 | do \ |
74 | 72 | { \ |
75 | 73 | /* Is the currently saved stack pointer within the stack limit? */ \ |
|
80 | 78 | } \ |
81 | 79 | } while( 0 ) |
82 | 80 |
|
83 | | - #else /* if ( configNUMBER_OF_CORES == 1 ) */ |
84 | | - |
85 | | -/* Only the current stack state is to be checked. */ |
86 | | - #define taskCHECK_FOR_STACK_OVERFLOW( xCoreID ) \ |
87 | | - do \ |
88 | | - { \ |
89 | | - TCB_t * pxTCB = pxCurrentTCBs[ xCoreID ]; \ |
90 | | - \ |
91 | | - /* Is the currently saved stack pointer within the stack limit? */ \ |
92 | | - if( pxTCB->pxTopOfStack <= pxTCB->pxStack + portSTACK_LIMIT_PADDING ) \ |
93 | | - { \ |
94 | | - char * pcOverflowTaskName = pxTCB->pcTaskName; \ |
95 | | - vApplicationStackOverflowHook( ( TaskHandle_t ) pxTCB, pcOverflowTaskName ); \ |
96 | | - } \ |
97 | | - } while( 0 ) |
98 | | - |
99 | | - #endif /* if ( configNUMBER_OF_CORES == 1 ) */ |
100 | | - |
101 | 81 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */ |
102 | 82 | /*-----------------------------------------------------------*/ |
103 | 83 |
|
104 | 84 | #if ( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) && ( portUSING_MPU_WRAPPERS != 1 ) ) |
105 | 85 |
|
106 | | - #if ( configNUMBER_OF_CORES == 1 ) |
107 | | - |
108 | 86 | /* Only the current stack state is to be checked. */ |
109 | | - #define taskCHECK_FOR_STACK_OVERFLOW() \ |
| 87 | + #define taskCHECK_FOR_STACK_OVERFLOW() \ |
110 | 88 | do \ |
111 | 89 | { \ |
112 | 90 | /* Is the currently saved stack pointer within the stack limit? */ \ |
|
117 | 95 | } \ |
118 | 96 | } while( 0 ) |
119 | 97 |
|
120 | | - #else /* if ( configNUMBER_OF_CORES == 1 ) */ |
121 | | - |
122 | | -/* Only the current stack state is to be checked. */ |
123 | | - #define taskCHECK_FOR_STACK_OVERFLOW( xCoreID ) \ |
124 | | - do \ |
125 | | - { \ |
126 | | - TCB_t * pxTCB = pxCurrentTCBs[ xCoreID ]; \ |
127 | | - \ |
128 | | - /* Is the currently saved stack pointer within the stack limit? */ \ |
129 | | - if( pxTCB->pxTopOfStack >= pxTCB->pxEndOfStack - portSTACK_LIMIT_PADDING ) \ |
130 | | - { \ |
131 | | - char * pcOverflowTaskName = pxTCB->pcTaskName; \ |
132 | | - vApplicationStackOverflowHook( ( TaskHandle_t ) pxTCB, pcOverflowTaskName ); \ |
133 | | - } \ |
134 | | - } while( 0 ) |
135 | | - |
136 | | - #endif /* if ( configNUMBER_OF_CORES == 1 ) */ |
137 | | - |
138 | 98 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */ |
139 | 99 | /*-----------------------------------------------------------*/ |
140 | 100 |
|
141 | 101 | #if ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) && ( portUSING_MPU_WRAPPERS != 1 ) ) |
142 | 102 |
|
143 | | - #if ( configNUMBER_OF_CORES == 1 ) |
144 | | - |
145 | | - #define taskCHECK_FOR_STACK_OVERFLOW() \ |
| 103 | + #define taskCHECK_FOR_STACK_OVERFLOW() \ |
146 | 104 | do \ |
147 | 105 | { \ |
148 | 106 | const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \ |
|
159 | 117 | } \ |
160 | 118 | } while( 0 ) |
161 | 119 |
|
162 | | - #else /* if ( configNUMBER_OF_CORES == 1 ) */ |
163 | | - |
164 | | - #define taskCHECK_FOR_STACK_OVERFLOW( xCoreID ) \ |
165 | | - do \ |
166 | | - { \ |
167 | | - TCB_t * pxTCB = pxCurrentTCBs[ xCoreID ]; \ |
168 | | - const uint32_t * const pulStack = ( uint32_t * ) pxTCB->pxStack; \ |
169 | | - const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5U; \ |
170 | | - \ |
171 | | - if( ( pxTCB->pxTopOfStack <= pxTCB->pxStack + portSTACK_LIMIT_PADDING ) || \ |
172 | | - ( pulStack[ 0 ] != ulCheckValue ) || \ |
173 | | - ( pulStack[ 1 ] != ulCheckValue ) || \ |
174 | | - ( pulStack[ 2 ] != ulCheckValue ) || \ |
175 | | - ( pulStack[ 3 ] != ulCheckValue ) ) \ |
176 | | - { \ |
177 | | - char * pcOverflowTaskName = pxTCB->pcTaskName; \ |
178 | | - vApplicationStackOverflowHook( ( TaskHandle_t ) pxTCB, pcOverflowTaskName ); \ |
179 | | - } \ |
180 | | - } while( 0 ) |
181 | | - |
182 | | - #endif /* if ( configNUMBER_OF_CORES == 1 ) */ |
183 | | - |
184 | 120 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ |
185 | 121 | /*-----------------------------------------------------------*/ |
186 | 122 |
|
187 | 123 | #if ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) && ( portUSING_MPU_WRAPPERS != 1 ) ) |
188 | 124 |
|
189 | | - #if ( configNUMBER_OF_CORES == 1 ) |
190 | | - |
191 | | - #define taskCHECK_FOR_STACK_OVERFLOW() \ |
| 125 | + #define taskCHECK_FOR_STACK_OVERFLOW() \ |
192 | 126 | do \ |
193 | 127 | { \ |
194 | 128 | int8_t * pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \ |
|
208 | 142 | } \ |
209 | 143 | } while( 0 ) |
210 | 144 |
|
211 | | - #else /* if ( configNUMBER_OF_CORES == 1 ) */ |
212 | | - |
213 | | - #define taskCHECK_FOR_STACK_OVERFLOW( xCoreID ) \ |
214 | | - do \ |
215 | | - { \ |
216 | | - TCB_t * pxTCB = pxCurrentTCBs[ xCoreID ]; \ |
217 | | - int8_t * pcEndOfStack = ( int8_t * ) pxTCB->pxEndOfStack; \ |
218 | | - static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ |
219 | | - tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ |
220 | | - tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ |
221 | | - tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ |
222 | | - tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \ |
223 | | - \ |
224 | | - pcEndOfStack -= sizeof( ucExpectedStackBytes ); \ |
225 | | - \ |
226 | | - if( ( pxTCB->pxTopOfStack >= pxTCB->pxEndOfStack - portSTACK_LIMIT_PADDING ) || \ |
227 | | - ( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) ) \ |
228 | | - { \ |
229 | | - char * pcOverflowTaskName = pxTCB->pcTaskName; \ |
230 | | - vApplicationStackOverflowHook( ( TaskHandle_t ) pxTCB, pcOverflowTaskName ); \ |
231 | | - } \ |
232 | | - } while( 0 ) |
233 | | - |
234 | | - #endif /* if ( configNUMBER_OF_CORES == 1 ) */ |
235 | | - |
236 | 145 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ |
237 | 146 | /*-----------------------------------------------------------*/ |
238 | 147 |
|
239 | 148 | /* Remove stack overflow macro if not being used. */ |
240 | 149 | #ifndef taskCHECK_FOR_STACK_OVERFLOW |
241 | | - #if ( configNUMBER_OF_CORES == 1 ) |
242 | | - #define taskCHECK_FOR_STACK_OVERFLOW() |
243 | | - #else |
244 | | - #define taskCHECK_FOR_STACK_OVERFLOW( xCoreID ) |
245 | | - #endif |
| 150 | + #define taskCHECK_FOR_STACK_OVERFLOW() |
246 | 151 | #endif |
247 | 152 |
|
248 | 153 |
|
|
0 commit comments