diff options
author | Alfred Gedeon <alfred2g@hotmail.com> | 2021-05-28 16:36:07 -0700 |
---|---|---|
committer | alfred gedeon <28123637+alfred2g@users.noreply.github.com> | 2021-06-09 16:08:24 -0700 |
commit | 688152237096b295179a87e9c8f1fc7f789f946e (patch) | |
tree | 48db543b61d1d51d465cc3899ae932ea3c2359cd | |
parent | b6624fa44d6c129e2a2c4746d6e5b8ea7732c9cc (diff) | |
download | freertos-git-688152237096b295179a87e9c8f1fc7f789f946e.tar.gz |
Demo: fix trace vs coverage options, add option no trace on enter
-rw-r--r-- | FreeRTOS/Demo/Posix_GCC/FreeRTOSConfig.h | 2 | ||||
-rw-r--r-- | FreeRTOS/Demo/Posix_GCC/Makefile | 25 | ||||
-rw-r--r-- | FreeRTOS/Demo/Posix_GCC/main.c | 47 | ||||
-rw-r--r-- | FreeRTOS/Demo/Posix_GCC/main_full.c | 13 |
4 files changed, 56 insertions, 31 deletions
diff --git a/FreeRTOS/Demo/Posix_GCC/FreeRTOSConfig.h b/FreeRTOS/Demo/Posix_GCC/FreeRTOSConfig.h index 680bbf852..54b8f13ca 100644 --- a/FreeRTOS/Demo/Posix_GCC/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/Posix_GCC/FreeRTOSConfig.h @@ -141,7 +141,7 @@ extern void vAssertCalled( const char * const pcFileName, /* To test builds that remove the static qualifier for debug builds. */ #define portREMOVE_STATIC_QUALIFIER -#else /* if ( projCOVERAGE_TEST == 1 ) */ +#else /* if ( projCOVERAGE_TEST == 1 ) */ /* It is a good idea to define configASSERT() while developing. configASSERT() * uses the same semantics as the standard C assert() macro. Don't define diff --git a/FreeRTOS/Demo/Posix_GCC/Makefile b/FreeRTOS/Demo/Posix_GCC/Makefile index fcff7dc60..6804c6a3a 100644 --- a/FreeRTOS/Demo/Posix_GCC/Makefile +++ b/FreeRTOS/Demo/Posix_GCC/Makefile @@ -54,16 +54,29 @@ SOURCE_FILES += ${FREERTOS_DIR}/Demo/Common/Minimal/StreamBufferInterru SOURCE_FILES += ${FREERTOS_DIR}/Demo/Common/Minimal/TaskNotify.c SOURCE_FILES += ${FREERTOS_DIR}/Demo/Common/Minimal/TimerDemo.c -# Trace library. -SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-Trace/trcKernelPort.c -SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-Trace/trcSnapshotRecorder.c -SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-Trace/trcStreamingRecorder.c -SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-Trace/streamports/File/trcStreamingPort.c -CFLAGS := -ggdb3 -DprojCOVERAGE_TEST=0 -D_WINDOWS_ +CFLAGS := -ggdb3 LDFLAGS := -ggdb3 -pthread CPPFLAGS := $(INCLUDE_DIRS) -DBUILD_DIR=\"$(BUILD_DIR_ABS)\" +CPPFLAGS += -D_WINDOWS_ + +ifeq ($(TRACE_ON_ENTER),1) + CPPFLAGS += -DTRACE_ON_ENTER=1 +else + CPPFLAGS += -DTRACE_ON_ENTER=0 +endif + +ifeq ($(COVERAGE_TEST),1) + CPPFLAGS += -DprojCOVERAGE_TEST=1 +else + CPPFLAGS += -DprojCOVERAGE_TEST=0 +# Trace library. + SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-Trace/trcKernelPort.c + SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-Trace/trcSnapshotRecorder.c + SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-Trace/trcStreamingRecorder.c + SOURCE_FILES += ${FREERTOS_PLUS_DIR}/Source/FreeRTOS-Plus-Trace/streamports/File/trcStreamingPort.c +endif ifdef PROFILE CFLAGS += -pg -O0 diff --git a/FreeRTOS/Demo/Posix_GCC/main.c b/FreeRTOS/Demo/Posix_GCC/main.c index a9c0b80a6..a1f5d7c02 100644 --- a/FreeRTOS/Demo/Posix_GCC/main.c +++ b/FreeRTOS/Demo/Posix_GCC/main.c @@ -57,6 +57,7 @@ #include <stdarg.h> #include <signal.h> #include <errno.h> +#include <sys/select.h> /* FreeRTOS kernel includes. */ #include "FreeRTOS.h" @@ -133,7 +134,11 @@ static void handle_sigint( int signal ); StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; /* Notes if the trace is running or not. */ -static BaseType_t xTraceRunning = pdTRUE; +#if ( projCOVERAGE_TEST == 1 ) + static BaseType_t xTraceRunning = pdFALSE; +#else + static BaseType_t xTraceRunning = pdTRUE; +#endif /*-----------------------------------------------------------*/ @@ -152,10 +157,13 @@ int main( void ) /* Start the trace recording - the recording is written to a file if * configASSERT() is called. */ printf( "\r\nTrace started.\r\nThe trace will be dumped to disk if a call to configASSERT() fails.\r\n" ); - printf( "\r\nThe trace will be dumped to disk if Enter is hit.\r\n" ); + + #if ( TRACE_ON_ENTER == 1 ) + printf( "\r\nThe trace will be dumped to disk if Enter is hit.\r\n" ); + #endif uiTraceStart(); } - #endif + #endif /* if ( projCOVERAGE_TEST != 1 ) */ console_init(); #if ( mainSELECTED_APPLICATION == BLINKY_DEMO ) @@ -254,25 +262,28 @@ void vApplicationTickHook( void ) void traceOnEnter() { - int xReturn; - struct timeval tv = { 0L, 0L }; - fd_set fds; + #if ( TRACE_ON_ENTER == 1 ) + int xReturn; + struct timeval tv = { 0L, 0L }; + fd_set fds; - FD_ZERO( &fds ); - FD_SET( 0, &fds ); - xReturn = select( 1, &fds, NULL, NULL, &tv ); + FD_ZERO( &fds ); + FD_SET( STDIN_FILENO, &fds ); - if( xReturn > 0 ) - { - if( xTraceRunning == pdTRUE ) + xReturn = select( STDIN_FILENO + 1, &fds, NULL, NULL, &tv ); + + if( xReturn > 0 ) { - prvSaveTraceFile(); - } + if( xTraceRunning == pdTRUE ) + { + prvSaveTraceFile(); + } - /* clear the buffer */ - char buffer[ 200 ]; - read( 1, &buffer, 200 ); - } + /* clear the buffer */ + char buffer[ 0 ]; + read( STDIN_FILENO, &buffer, 1 ); + } + #endif /* if ( TRACE_ON_ENTER == 1 ) */ } void vLoggingPrintf( const char * pcFormat, diff --git a/FreeRTOS/Demo/Posix_GCC/main_full.c b/FreeRTOS/Demo/Posix_GCC/main_full.c index b6fe27066..e5852be44 100644 --- a/FreeRTOS/Demo/Posix_GCC/main_full.c +++ b/FreeRTOS/Demo/Posix_GCC/main_full.c @@ -308,11 +308,12 @@ static void prvCheckTask( void * pvParameters ) pcStatusMessage = "Error: Notification"; xErrorCount++; } + /* else if( xAreTaskNotificationArrayTasksStillRunning() != pdTRUE ) - { - pcStatusMessage = "Error: NotificationArray"; - xErrorCount++; - } */ + * { + * pcStatusMessage = "Error: NotificationArray"; + * xErrorCount++; + * } */ else if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE ) { pcStatusMessage = "Error: IntSem"; @@ -415,7 +416,7 @@ static void prvCheckTask( void * pvParameters ) pcStatusMessage = "Error: Queue set polling"; xErrorCount++; } - #endif + #endif /* if ( configUSE_QUEUE_SETS == 1 ) */ #if ( configSUPPORT_STATIC_ALLOCATION == 1 ) else if( xAreStaticAllocationTasksStillRunning() != pdPASS ) @@ -922,7 +923,7 @@ static void prvDemonstrateChangingTimerReloadMode( void * pvParameters ) xTimer = xTimerCreate( pcTimerName, x100ms, - pdFALSE, /* Created as a one-shot timer. */ + pdFALSE, /* Created as a one-shot timer. */ 0, prvReloadModeTestTimerCallback ); configASSERT( xTimer ); |