]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/include/StackMacros.h
Update version number to 9.0.0rc2.
[freertos] / FreeRTOS / Source / include / StackMacros.h
index 18c6a7f05a39c4e9aa153ea97f1b21680b5d5b59..91d5024000fa96dfbce98ef6b9e2043be40364c9 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    FreeRTOS V9.0.0rc2 - Copyright (C) 2016 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
@@ -8,7 +8,7 @@
 \r
     FreeRTOS is free software; you can redistribute it and/or modify it under\r
     the terms of the GNU General Public License (version 2) as published by the\r
-    Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+    Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.\r
 \r
     ***************************************************************************\r
     >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
 \r
 /*-----------------------------------------------------------*/\r
 \r
-#if( configCHECK_FOR_STACK_OVERFLOW == 0 )\r
-\r
-       /* FreeRTOSConfig.h is not set to check for stack overflows. */\r
-       #define taskFIRST_CHECK_FOR_STACK_OVERFLOW()\r
-       #define taskSECOND_CHECK_FOR_STACK_OVERFLOW()\r
-\r
-#endif /* configCHECK_FOR_STACK_OVERFLOW == 0 */\r
-/*-----------------------------------------------------------*/\r
-\r
-#if( configCHECK_FOR_STACK_OVERFLOW == 1 )\r
-\r
-       /* FreeRTOSConfig.h is only set to use the first method of\r
-       overflow checking. */\r
-       #define taskSECOND_CHECK_FOR_STACK_OVERFLOW()\r
-\r
-#endif\r
-/*-----------------------------------------------------------*/\r
-\r
-#if( ( configCHECK_FOR_STACK_OVERFLOW > 0 ) && ( portSTACK_GROWTH < 0 ) )\r
+#if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) )\r
 \r
        /* Only the current stack state is to be checked. */\r
-       #define taskFIRST_CHECK_FOR_STACK_OVERFLOW()                                                                                                            \\r
+       #define taskCHECK_FOR_STACK_OVERFLOW()                                                                                                                          \\r
        {                                                                                                                                                                                                       \\r
                /* Is the currently saved stack pointer within the stack limit? */                                                              \\r
                if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack )                                                                               \\r
                }                                                                                                                                                                                               \\r
        }\r
 \r
-#endif /* configCHECK_FOR_STACK_OVERFLOW > 0 */\r
+#endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */\r
 /*-----------------------------------------------------------*/\r
 \r
-#if( ( configCHECK_FOR_STACK_OVERFLOW > 0 ) && ( portSTACK_GROWTH > 0 ) )\r
+#if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) )\r
 \r
        /* Only the current stack state is to be checked. */\r
-       #define taskFIRST_CHECK_FOR_STACK_OVERFLOW()                                                                                                            \\r
+       #define taskCHECK_FOR_STACK_OVERFLOW()                                                                                                                          \\r
        {                                                                                                                                                                                                       \\r
                                                                                                                                                                                                                \\r
                /* Is the currently saved stack pointer within the stack limit? */                                                              \\r
 \r
 #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) )\r
 \r
-       #define taskSECOND_CHECK_FOR_STACK_OVERFLOW()                                                                                                                                                                           \\r
-       {                                                                                                                                                                                                                                                                       \\r
-       static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,         \\r
-                                                                                                       tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,         \\r
-                                                                                                       tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,         \\r
-                                                                                                       tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,         \\r
-                                                                                                       tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE };       \\r
-                                                                                                                                                                                                                                                                               \\r
-                                                                                                                                                                                                                                                                               \\r
-               /* Has the extremity of the task stack ever been written over? */                                                                                                                               \\r
-               if( memcmp( ( void * ) pxCurrentTCB->pxStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 )                  \\r
-               {                                                                                                                                                                                                                                                               \\r
-                       vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName );                                                                       \\r
-               }                                                                                                                                                                                                                                                               \\r
+       #define taskCHECK_FOR_STACK_OVERFLOW()                                                                                                                          \\r
+       {                                                                                                                                                                                                       \\r
+               const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack;                                                 \\r
+               const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5;                                                                                  \\r
+                                                                                                                                                                                                               \\r
+               if( ( pulStack[ 0 ] != ulCheckValue ) ||                                                                                                \\r
+                       ( pulStack[ 1 ] != ulCheckValue ) ||                                                                                            \\r
+                       ( pulStack[ 2 ] != ulCheckValue ) ||                                                                                            \\r
+                       ( pulStack[ 3 ] != ulCheckValue ) )                                                                                             \\r
+               {                                                                                                                                                                                               \\r
+                       vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName );       \\r
+               }                                                                                                                                                                                               \\r
        }\r
 \r
 #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */\r
 \r
 #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) )\r
 \r
-       #define taskSECOND_CHECK_FOR_STACK_OVERFLOW()                                                                                                                                                                           \\r
+       #define taskCHECK_FOR_STACK_OVERFLOW()                                                                                                                                                                                          \\r
        {                                                                                                                                                                                                                                                                       \\r
        int8_t *pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack;                                                                                                                                         \\r
        static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,         \\r
 #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */\r
 /*-----------------------------------------------------------*/\r
 \r
+/* Remove stack overflow macro if not being used. */\r
+#ifndef taskCHECK_FOR_STACK_OVERFLOW\r
+       #define taskCHECK_FOR_STACK_OVERFLOW()\r
+#endif\r
+\r
+\r
+\r
 #endif /* STACK_MACROS_H */\r
 \r