Fix demo build issue , when configUSE_TRACE_FACILITY is disabled (#1189)

This PR enables the FreeRTOS Posix Blinky GCC Demo to be used without the configUSE_TRACE_FACILITY enabled. It is achieved by using `-DNO_TRACING=1` CMake option to disable tracing. By default, -DNO_TRACING is set to 0, and the tracing is enabled.
This commit is contained in:
Rahul Kar 2024-03-04 14:48:17 +05:30 committed by GitHub
parent 2adaf8471f
commit 77cc06d692
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 237 additions and 215 deletions

View file

@ -10,7 +10,7 @@ else()
add_compile_options( -DTRACE_ON_ENTER=0 )
endif()
if( COVERAGE_TEST )
if( ( COVERAGE_TEST ) OR ( NO_TRACING ) )
set( COVERAGE_TEST 1 )
add_compile_options( -DprojCOVERAGE_TEST=1 )
else()

View file

@ -143,6 +143,8 @@ static BaseType_t prvStaticAllocationsWithNullBuffers( void )
}
/*-----------------------------------------------------------*/
#if( configUSE_TRACE_FACILITY == 1 )
static BaseType_t prvTraceUtils( void )
{
EventGroupHandle_t xEventGroup;
@ -202,8 +204,8 @@ static BaseType_t prvTraceUtils( void )
xReturn = pdFAIL;
}
/* Exercise the task trace utilities. Value of 100 is arbitrary, just want
* to check the value that is set is also read back. */
/* Exercise the task trace utilities. Value of 100 is arbitrary, just
* want to check the value that is set is also read back. */
uxValue = 100;
xTaskHandle = xTaskGetCurrentTaskHandle();
vTaskSetTaskNumber( xTaskHandle, uxValue );
@ -221,8 +223,8 @@ static BaseType_t prvTraceUtils( void )
/* Timer trace util functions are exercised in prvTimerQuery(). */
/* Exercise the stream buffer utilities. Try creating with a trigger level
* of 0, it should then get capped to 1. */
/* Exercise the stream buffer utilities. Try creating with a trigger
* level of 0, it should then get capped to 1. */
xStreamBuffer = xStreamBufferCreate( sizeof( uint32_t ), 0 );
if( xStreamBuffer != NULL )
@ -266,6 +268,8 @@ static BaseType_t prvTraceUtils( void )
return xReturn;
}
#endif /* #if( configUSE_TRACE_FACILITY == 1 ) */
/*-----------------------------------------------------------*/
static BaseType_t prvPeekTimeout( void )
@ -370,6 +374,8 @@ static BaseType_t prvQueueQueryFromISR( void )
}
/*-----------------------------------------------------------*/
#if( configUSE_TRACE_FACILITY == 1)
static BaseType_t prvTaskQueryFunctions( void )
{
static TaskStatus_t xStatus, * pxStatusArray;
@ -469,7 +475,7 @@ static BaseType_t prvTaskQueryFunctions( void )
xReturn = pdFAIL;
}
/* Basic santity check of array contents. */
/* Basic sanity check of array contents. */
for( ux = 0; ux < uxReturned; ux++ )
{
if( pxStatusArray[ ux ].eCurrentState >= ( UBaseType_t ) eInvalid )
@ -492,6 +498,8 @@ static BaseType_t prvTaskQueryFunctions( void )
return xReturn;
}
#endif /* #if( configUSE_TRACE_FACILITY == 1) */
/*-----------------------------------------------------------*/
static BaseType_t prvDummyTagFunction( void * pvParameter )
@ -609,12 +617,16 @@ static BaseType_t prvTimerQuery( void )
xReturn = pdFAIL;
}
#if( configUSE_TRACE_FACILITY == 1 )
{
vTimerSetTimerNumber( xTimer, uxTimerNumber );
if( uxTimerGetTimerNumber( xTimer ) != uxTimerNumber )
{
xReturn = pdFAIL;
}
}
#endif /* #if( configUSE_TRACE_FACILITY == 1 ) */
xTimerDelete( xTimer, portMAX_DELAY );
}
@ -632,10 +644,16 @@ BaseType_t xRunCodeCoverageTestAdditions( void )
BaseType_t xReturn = pdPASS;
xReturn &= prvStaticAllocationsWithNullBuffers();
#if( configUSE_TRACE_FACILITY == 1 )
{
xReturn &= prvTraceUtils();
xReturn &= prvTaskQueryFunctions();
}
#endif
xReturn &= prvPeekTimeout();
xReturn &= prvQueueQueryFromISR();
xReturn &= prvTaskQueryFunctions();
xReturn &= prvTaskTags();
xReturn &= prvTimerQuery();

View file

@ -737,6 +737,8 @@ static void prvDemonstrateTaskStateAndHandleGetFunctions( void )
xErrorCount++;
}
#if( configUSE_TRACE_FACILITY == 1 )
{
/* Also with the vTaskGetInfo() function. */
vTaskGetInfo( xTimerTaskHandle, /* The task being queried. */
&xTaskInfo, /* The structure into which information on the task will be written. */
@ -753,6 +755,8 @@ static void prvDemonstrateTaskStateAndHandleGetFunctions( void )
pcStatusMessage = "Error: vTaskGetInfo() returned incorrect information about the timer task";
xErrorCount++;
}
}
#endif /* #if( configUSE_TRACE_FACILITY == 1 ) */
/* Other tests that should only be performed once follow. The test task
* is not created on each iteration because to do so would cause the death