traceTASK_SWITCHED_IN define throws implicit declaration of function

Hi,

I followed the Trace Hook Macros FreeRTOS docs in Trace Features and I am not sure why I get the warning still.
implicit declaration of function 'vSetTracePin' [-Wimplicit-function-declaration

I use FreeRTOS on a STM microcontroller (enabled CMSIS_V2).
Also USE_APPLICATION_TASK_TAG is enabled in CubeMX

In FreeRTOSConfig.h I want to add:

/* USER CODE BEGIN Defines */
/* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */
#define traceTASK_SWITCHED_IN() vSetTracePin (0, (int) pxCurrentTCB->pxTaskTag)
#define traceTASK_SWITCHED_OUT() vResetTracePin (0, (int) pxCurrentTCB->pxTaskTag)
/* USER CODE END Defines */

And here i get the warnings.

I want to use the vSetTracePin & vResetTracePin in my main.c:

//y=TaskTag
void vSetTracePin (int x, int y) 
{
	//PC_0 for Task1 and PC_1 for Task2
	HAL_GPIO_WritePin ((GPIOC), (1 << (y-1)), 1);
}

void vResetTracePin (int x, int y)
{
	// PC_2 for Task3 and PC_3 for Task4
	HAL_GPIO_WritePin ((GPIOC), (1 << (y-1)), 0);
}

And then I want to use the Trace Hook Macros with the Tags in my Tasks to measure with the Logic Analyzer:
I have set the Pins PC0, PC1, PC2 and PC3 as GPIO Output pin to connect with the LA.

void Task1( void * pvParameters )
{
	vTaskSetApplicationTaskTag(NULL, (void * ) 1 );
    for(;;)
    {
      some code..
    }
}

void Task2( void * pvParameters )
{
	vTaskSetApplicationTaskTag(NULL, (void * ) 2 );
    for(;;)
    {
       some code..
    }
}

void Task3( void * pvParameters )
{
	vTaskSetApplicationTaskTag(NULL, (void * ) 3 );
    for(;;)
    {
        some code..
    }
}

According to the documentation this should be fine. Or am I missing something? Do you know how to resolve the warning?

The #define will insert the text of the call to vSetTracePin.

The C Code wants to know the prototype to cal that function.

In FreeRTOSConfig,h, normally just before or after the define, include prototype for the function. Something like:

extern void vSetTracePin(int, int);
extern void vRestTracePin(int, int);
1 Like