Undefined referenced to `_vTaskDelay'

fabiolo93 wrote on Thursday, February 09, 2017:

Hi, I am making a proyect using FreeRTOS with PIC24F, I already included all the Rtos’ source files and the compiler doesn’t have errors, but when I build the proyect this errors appears:

build/XC16_24FJ256GA110/production/main.o(.text+0xa): In function .LSM2': : undefined reference to _vTaskDelay’

Please if you know how solve this problem help me
Thanks

rtel wrote on Thursday, February 09, 2017:

Is INCLUDE_vTaskDelay set to 1 in FreeRTOSConfig.h?

fabiolo93 wrote on Thursday, February 09, 2017:

yes it is, I have
#define INCLUDE_vTaskDelay 1

rtel wrote on Thursday, February 09, 2017:

Are you including FreeRTOS.h and task.h at the top of the file?

Can you please show the code snippet that calls vTaskDelay().

fabiolo93 wrote on Thursday, February 09, 2017:

yes I am including FreeRTOS.h, task.h, queue.h and croutine.h, there is the code that calls vTaskDelay()

void TOGGLE_LED(int x);
void Tarea_LED0(void *pvParameters){
for(;:wink:
{
TOGGLE_LED(0);
vTaskDelay (500 / portTICK_RATE_MS);
}
vTaskDelete(NULL);
}

if I comment vTaskDelay( 500/ portTICK_RATE_MS), the proyect build OK, but I need use vTaskDelay.

rtel wrote on Thursday, February 09, 2017:

In which case, if INCLUDE_vTaskDelay is really set to 1, I have no idea
what the problem could be. Have your FreeRTOS source files been
modified in any way? Can you verify that tasks.c contains vTaskDelay()
and there there are no other per-processor definitions that are stopping
it from being built?

fabiolo93 wrote on Thursday, February 09, 2017:

I have XC16 as compiler, are there any problem with this compiler?

rtel wrote on Thursday, February 09, 2017:

I wouldn’t know that, but would assume not.

rs9562 wrote on Thursday, February 09, 2017:

Post the full build output.

heinbali01 wrote on Friday, February 10, 2017:

As a test, could you make the following change to task.c ?

+/* Start of insertion. */
+    #if ( INCLUDE_vTaskDelayUntil == 1 )
+        #warning vTaskDelayUntil should get compiled
+    #else
+        #warning vTaskDelayUntil will not get compiled
+    #elif
+/* End of insertion. */
+
 #if ( INCLUDE_vTaskDelayUntil == 1 )
 
     void vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, const TickType_t xTimeIncrement )
     {

( the lines marked with a + are to be added )

My guess would be that you have multiple versions of FreeRTOSConfig.h on your disk and that the compiler see the wrong one. Check your include -I paths.

You can also test this by adding a line in your FreeRTOSConfig.h file:

    #warning This FreeRTOSConfig is included !

The compiler should issue a warning there.