Unable to use macros such as xQueuePeekFromISR, xTaskNotifyStateClear etc

Platfrom: stm32cubeIDE

I am having issues with accessing macro’s with the compiler throwing an undefined reference ? I am able to access functions such as xTaskCreate which is in the same file as xTaskNotifyStateClear.

Some of the other macros i have tried
xQueuePeekFromISR, xTaskAbortDelay, xPortGetFreeHeapSize

#define configSUPPORT_DYNAMIC_ALLOCATION         1
#define INCLUDE_xTaskGetCurrentTaskHandle 1
#define configMAX_SYSCALL_INTERRUPT_PRIORITY       6
#define configENABLE_BACKWARD_COMPATIBILITY        1
#define configUSE_PREEMPTION                       1
#define configUSE_PORT_OPTIMISED_TASK_SELECTION    1
#define configMAX_PRIORITIES                       ( 7 )
#define configTICK_RATE_HZ                         ( 1000 )                  /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */
#define configMINIMAL_STACK_SIZE                   ( ( unsigned short ) 60 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the Win32 thread. */
#define configTOTAL_HEAP_SIZE                      ( ( size_t ) ( 2048U * 1024U ) )
#define configMAX_TASK_NAME_LEN                    ( 15 )
#define configUSE_16_BIT_TICKS                     0
#define configIDLE_SHOULD_YIELD                    1
#define configUSE_CO_ROUTINES                      0
#ifndef configUSE_MUTEXES
    #define configUSE_MUTEXES                      1
#endif
#ifndef configUSE_RECURSIVE_MUTEXES
    #define configUSE_RECURSIVE_MUTEXES            1
#endif
#define configQUEUE_REGISTRY_SIZE                  0
#define configUSE_APPLICATION_TASK_TAG             1
#define configUSE_COUNTING_SEMAPHORES              1
#define configUSE_ALTERNATIVE_API                  0
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS    3      /* FreeRTOS+FAT requires 2 pointers if a CWD is supported. */
#define configRECORD_STACK_HIGH_ADDRESS            1

/* Hook function related definitions. */
#ifndef configUSE_TICK_HOOK
    #define configUSE_TICK_HOOK            0
#endif
#define configUSE_IDLE_HOOK                1
#define configUSE_MALLOC_FAILED_HOOK       1
#define configCHECK_FOR_STACK_OVERFLOW     0              /* Not applicable to the Win32 port. */

/* Software timer related definitions. */
#define configUSE_TIMERS                   1
#define configTIMER_TASK_PRIORITY          ( configMAX_PRIORITIES - 1 )
#define configTIMER_QUEUE_LENGTH           5
#define configTIMER_TASK_STACK_DEPTH       ( configMINIMAL_STACK_SIZE * 2 )

/* Event group related definitions. */
#define configUSE_EVENT_GROUPS             1

/* Co-routine definitions. */
#define configUSE_CO_ROUTINES              0
#define configMAX_CO_ROUTINE_PRIORITIES    ( 2 )

/* Memory allocation strategy. */
#ifndef configSUPPORT_DYNAMIC_ALLOCATION
    #define configSUPPORT_DYNAMIC_ALLOCATION    1
#endif
#ifndef configSUPPORT_STATIC_ALLOCATION
    #define configSUPPORT_STATIC_ALLOCATION     1
#endif


/* Set the following definitions to 1 to include the API function, or zero
 * to exclude the API function. */
#define INCLUDE_vTaskPrioritySet                1
#define INCLUDE_uxTaskPriorityGet               1
#define INCLUDE_vTaskDelete                     1
#define INCLUDE_vTaskCleanUpResources           0
#ifndef INCLUDE_vTaskSuspend
    #define INCLUDE_vTaskSuspend                1
#endif
#define INCLUDE_vTaskDelayUntil                 1
#define INCLUDE_vTaskDelay                      1
#define INCLUDE_uxTaskGetStackHighWaterMark     1
#ifndef INCLUDE_xTaskGetSchedulerState
    #define INCLUDE_xTaskGetSchedulerState      1
#endif
#define INCLUDE_xTimerGetTimerTaskHandle        0
#define INCLUDE_xTaskGetIdleTaskHandle          0
#define INCLUDE_xQueueGetMutexHolder            1
#define INCLUDE_eTaskGetState                   1
#define INCLUDE_xEventGroupSetBitsFromISR       1
#define INCLUDE_xTimerPendFunctionCall          1
#define INCLUDE_xTaskGetCurrentTaskHandle       1
#define INCLUDE_xTaskAbortDelay                 1

You probably missed to compile and especially link the necessary FreeRTOS sources like tasks.c resp. tasks.o to the target executable.
The undefined reference issue is also probably unrelated the FreeRTOS configuration macros/constants.
And you really should mention WHICH undefined reference it is :wink:

If I am able to compile xTaskCreate then surely I have linked “task.h” correctly ? They are all included on the path within the ide. I would understand if I was unable to access any of the functions within task.h. I thought perhaps there might be something i’m missing from the config file.

Compiler : Src/test_state.c:213: undefined reference to `xQueuePeek’

Header files are not directly compiled nor linked . They are just included by a real source file like tasks.c or your Src/test_state.c.
You have to add the FreeRTOS sources to your Makefile as well.
The FreeRTOS functions are declared in header files but are defined in the respective source files.
That’s basic C/C++ development.

That seems to have resolved it, thank you !