]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/WIN32-MingW/main.c
Import the code coverage test additions from the (unpublished) Visual Studio project...
[freertos] / FreeRTOS / Demo / WIN32-MingW / main.c
index cfb16a4b0524b49411f624f28003d8d32776bc06..96a51cabef8a165f482f33247f55e911657443fe 100644 (file)
@@ -75,7 +75,7 @@ that make up the total heap.  heap_5 is only used for test and example purposes
 as this demo could easily create one large heap region instead of multiple\r
 smaller heap regions - in which case heap_4.c would be the more appropriate\r
 choice.  See http://www.freertos.org/a00111.html for an explanation. */\r
-#define mainREGION_1_SIZE      8201\r
+#define mainREGION_1_SIZE      10801\r
 #define mainREGION_2_SIZE      29905\r
 #define mainREGION_3_SIZE      6007\r
 \r
@@ -141,10 +141,6 @@ int main( void )
        http://www.freertos.org/a00111.html for an explanation. */\r
        prvInitialiseHeap();\r
 \r
-       /* Initialise the trace recorder.  Use of the trace recorder is optional.\r
-       See http://www.FreeRTOS.org/trace for more information. */\r
-       vTraceEnable( TRC_START );\r
-\r
        /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top\r
        of this file. */\r
        #if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 )\r
@@ -153,11 +149,20 @@ int main( void )
        }\r
        #else\r
        {\r
-               /* Start the trace recording - the recording is written to a file if\r
-               configASSERT() is called. */\r
-               printf( "\r\nTrace started.\r\nThe trace will be dumped to disk if a call to configASSERT() fails.\r\n" );\r
-               printf( "Uncomment the call to kbhit() in this file to also dump trace with a key press.\r\n" );\r
-               uiTraceStart();\r
+               /* Do not include trace code when performing a code coverage analysis. */\r
+               #if( projCOVERAGE_TEST != 1 )\r
+               {\r
+                       /* Initialise the trace recorder.  Use of the trace recorder is optional.\r
+                       See http://www.FreeRTOS.org/trace for more information. */\r
+                       vTraceEnable( TRC_START );\r
+\r
+                       /* Start the trace recording - the recording is written to a file if\r
+                       configASSERT() is called. */\r
+                       printf( "\r\nTrace started.\r\nThe trace will be dumped to disk if a call to configASSERT() fails.\r\n" );\r
+                       printf( "Uncomment the call to kbhit() in this file to also dump trace with a key press.\r\n" );\r
+                       uiTraceStart();\r
+               }\r
+               #endif\r
 \r
                main_full();\r
        }\r
@@ -282,7 +287,6 @@ volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0;
                        xPrinted = pdTRUE;\r
                        if( xTraceRunning == pdTRUE )\r
                        {\r
-                               vTraceStop();\r
                                prvSaveTraceFile();\r
                        }\r
                }\r
@@ -302,20 +306,27 @@ volatile uint32_t ulSetToNonZeroInDebuggerToContinue = 0;
 \r
 static void prvSaveTraceFile( void )\r
 {\r
-FILE* pxOutputFile;\r
+       /* Tracing is not used when code coverage analysis is being performed. */\r
+       #if( projCOVERAGE_TEST != 1 )\r
+       {\r
+               FILE* pxOutputFile;\r
 \r
-       pxOutputFile = fopen( "Trace.dump", "wb");\r
+               vTraceStop();\r
 \r
-       if( pxOutputFile != NULL )\r
-       {\r
-               fwrite( RecorderDataPtr, sizeof( RecorderDataType ), 1, pxOutputFile );\r
-               fclose( pxOutputFile );\r
-               printf( "\r\nTrace output saved to Trace.dump\r\n" );\r
-       }\r
-       else\r
-       {\r
-               printf( "\r\nFailed to create trace dump file\r\n" );\r
+               pxOutputFile = fopen( "Trace.dump", "wb");\r
+\r
+               if( pxOutputFile != NULL )\r
+               {\r
+                       fwrite( RecorderDataPtr, sizeof( RecorderDataType ), 1, pxOutputFile );\r
+                       fclose( pxOutputFile );\r
+                       printf( "\r\nTrace output saved to Trace.dump\r\n" );\r
+               }\r
+               else\r
+               {\r
+                       printf( "\r\nFailed to create trace dump file\r\n" );\r
+               }\r
        }\r
+       #endif\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r