]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/WIN32-MingW/main.c
Start to remove unnecessary 'signed char *' casts from strings that are now just...
[freertos] / FreeRTOS / Demo / WIN32-MingW / main.c
index d09adb4d81bb37bde5112039088e646ece9d4c13..d11c74d45d33b1c275d8ddbbc85b46ab01ca696a 100644 (file)
@@ -105,7 +105,7 @@ mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is used to select between the two.
 The simply blinky demo is implemented and described in main_blinky.c.  The more \r
 comprehensive test and demo application is implemented and described in \r
 main_full.c. */\r
-#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY     0\r
+#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY     1\r
 \r
 /*\r
  * main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1.\r
@@ -143,19 +143,17 @@ static portBASE_TYPE xTraceRunning = pdTRUE;
 \r
 /*-----------------------------------------------------------*/\r
 \r
-\r
 int main( void )\r
 {\r
        /* Initialise the trace recorder and create the label used to post user\r
        events to the trace recording on each tick interrupt. */\r
        vTraceInitTraceData();\r
-       printf( "Trace started.  Hit a key to dump trace file to disk.  Note stdin does not work when using the Eclipse console with MingW.\r\n" );\r
-       fflush( stdout );\r
-\r
        xTickTraceUserEvent = xTraceOpenLabel( "tick" );\r
 \r
        /* Start the trace recording - the recording is written to a file if\r
        configASSERT() is called. */\r
+       printf( "\r\nTrace started.  Hit a key to dump trace file to disk (does not work from Eclipse console).\r\n" );\r
+       fflush( stdout );\r
        uiTraceStart();\r
 \r
        /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top\r
@@ -203,7 +201,7 @@ void vApplicationIdleHook( void )
        memory allocated by the kernel to any task that has since been deleted. */\r
 \r
        /* The trace can be stopped with any key press. */\r
-       if( kbhit() != pdFALSE )\r
+       if( _kbhit() != pdFALSE )\r
        {\r
                if( xTraceRunning == pdTRUE )\r
                {\r
@@ -260,6 +258,8 @@ void vApplicationTickHook( void )
 \r
 void vAssertCalled( unsigned long ulLine, const char * const pcFileName )\r
 {\r
+static portBASE_TYPE xPrinted = pdFALSE;\r
+\r
        /* Parameters are not used. */\r
        ( void ) ulLine;\r
        ( void ) pcFileName;\r
@@ -268,10 +268,14 @@ void vAssertCalled( unsigned long ulLine, const char * const pcFileName )
        __asm volatile( "int $3" );\r
 \r
        /* Stop the trace recording. */\r
-       if( xTraceRunning == pdTRUE )\r
+       if( xPrinted == pdFALSE )\r
        {\r
+               xPrinted = pdTRUE;\r
+               if( xTraceRunning == pdTRUE )\r
+               {\r
                vTraceStop();\r
                prvSaveTraceFile();\r
+               }\r
        }\r
 \r
        taskENABLE_INTERRUPTS();\r
@@ -289,11 +293,9 @@ FILE* pxOutputFile;
                fwrite( RecorderDataPtr, sizeof( RecorderDataType ), 1, pxOutputFile );\r
                fclose( pxOutputFile );\r
                printf( "\r\nTrace output saved to Trace.dump\r\n" );\r
-               fflush( stdout );\r
        }\r
        else\r
        {\r
                printf( "\r\nFailed to create trace dump file\r\n" );\r
-               fflush( stdout );\r
        }\r
 }\r