Demo: fix trace vs coverage options, add option no trace on enter

This commit is contained in:
Alfred Gedeon
2021-05-28 16:36:07 -07:00
committed by alfred gedeon
parent b6624fa44d
commit 6881522370
4 changed files with 56 additions and 31 deletions

View File

@ -141,7 +141,7 @@ extern void vAssertCalled( const char * const pcFileName,
/* To test builds that remove the static qualifier for debug builds. */ /* To test builds that remove the static qualifier for debug builds. */
#define portREMOVE_STATIC_QUALIFIER #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() /* It is a good idea to define configASSERT() while developing. configASSERT()
* uses the same semantics as the standard C assert() macro. Don't define * uses the same semantics as the standard C assert() macro. Don't define

View File

@ -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/TaskNotify.c
SOURCE_FILES += ${FREERTOS_DIR}/Demo/Common/Minimal/TimerDemo.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 LDFLAGS := -ggdb3 -pthread
CPPFLAGS := $(INCLUDE_DIRS) -DBUILD_DIR=\"$(BUILD_DIR_ABS)\" 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 ifdef PROFILE
CFLAGS += -pg -O0 CFLAGS += -pg -O0

View File

@ -57,6 +57,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <signal.h> #include <signal.h>
#include <errno.h> #include <errno.h>
#include <sys/select.h>
/* FreeRTOS kernel includes. */ /* FreeRTOS kernel includes. */
#include "FreeRTOS.h" #include "FreeRTOS.h"
@ -133,7 +134,11 @@ static void handle_sigint( int signal );
StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
/* Notes if the trace is running or not. */ /* 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 /* Start the trace recording - the recording is written to a file if
* configASSERT() is called. */ * 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\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(); uiTraceStart();
} }
#endif #endif /* if ( projCOVERAGE_TEST != 1 ) */
console_init(); console_init();
#if ( mainSELECTED_APPLICATION == BLINKY_DEMO ) #if ( mainSELECTED_APPLICATION == BLINKY_DEMO )
@ -254,25 +262,28 @@ void vApplicationTickHook( void )
void traceOnEnter() void traceOnEnter()
{ {
int xReturn; #if ( TRACE_ON_ENTER == 1 )
struct timeval tv = { 0L, 0L }; int xReturn;
fd_set fds; struct timeval tv = { 0L, 0L };
fd_set fds;
FD_ZERO( &fds ); FD_ZERO( &fds );
FD_SET( 0, &fds ); FD_SET( STDIN_FILENO, &fds );
xReturn = select( 1, &fds, NULL, NULL, &tv );
if( xReturn > 0 ) xReturn = select( STDIN_FILENO + 1, &fds, NULL, NULL, &tv );
{
if( xTraceRunning == pdTRUE ) if( xReturn > 0 )
{ {
prvSaveTraceFile(); if( xTraceRunning == pdTRUE )
} {
prvSaveTraceFile();
}
/* clear the buffer */ /* clear the buffer */
char buffer[ 200 ]; char buffer[ 0 ];
read( 1, &buffer, 200 ); read( STDIN_FILENO, &buffer, 1 );
} }
#endif /* if ( TRACE_ON_ENTER == 1 ) */
} }
void vLoggingPrintf( const char * pcFormat, void vLoggingPrintf( const char * pcFormat,

View File

@ -308,11 +308,12 @@ static void prvCheckTask( void * pvParameters )
pcStatusMessage = "Error: Notification"; pcStatusMessage = "Error: Notification";
xErrorCount++; xErrorCount++;
} }
/* else if( xAreTaskNotificationArrayTasksStillRunning() != pdTRUE ) /* else if( xAreTaskNotificationArrayTasksStillRunning() != pdTRUE )
{ * {
pcStatusMessage = "Error: NotificationArray"; * pcStatusMessage = "Error: NotificationArray";
xErrorCount++; * xErrorCount++;
} */ * } */
else if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE ) else if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE )
{ {
pcStatusMessage = "Error: IntSem"; pcStatusMessage = "Error: IntSem";
@ -415,7 +416,7 @@ static void prvCheckTask( void * pvParameters )
pcStatusMessage = "Error: Queue set polling"; pcStatusMessage = "Error: Queue set polling";
xErrorCount++; xErrorCount++;
} }
#endif #endif /* if ( configUSE_QUEUE_SETS == 1 ) */
#if ( configSUPPORT_STATIC_ALLOCATION == 1 ) #if ( configSUPPORT_STATIC_ALLOCATION == 1 )
else if( xAreStaticAllocationTasksStillRunning() != pdPASS ) else if( xAreStaticAllocationTasksStillRunning() != pdPASS )
@ -922,7 +923,7 @@ static void prvDemonstrateChangingTimerReloadMode( void * pvParameters )
xTimer = xTimerCreate( pcTimerName, xTimer = xTimerCreate( pcTimerName,
x100ms, x100ms,
pdFALSE, /* Created as a one-shot timer. */ pdFALSE, /* Created as a one-shot timer. */
0, 0,
prvReloadModeTestTimerCallback ); prvReloadModeTestTimerCallback );
configASSERT( xTimer ); configASSERT( xTimer );