mirror of
https://github.com/FreeRTOS/FreeRTOS.git
synced 2025-06-26 11:42:57 +08:00
Demo: fix trace vs coverage options, add option no trace on enter
This commit is contained in:

committed by
alfred gedeon

parent
b6624fa44d
commit
6881522370
@ -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
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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 );
|
||||
|
Reference in New Issue
Block a user