taskYIELD() implicit_function-declaration

When trying to use the function taskYIELD() I get a compile error: implicit_function-declaration. I have looked over the header files and find taskYIELD is defined as portYIELD() but that seems not to be defined.

I tried adding the include file portable.h but that does not seem to help. Perhaps taskYIELD is not supported on the PIC32MX port?

I looked through FreeRTOSConfig.h to see if there is an option related to this, but did not find one. I also cannot find anthing in Harmony that seems to apply.

Please help if you can,
Thanks

In the PIC32 port taskYIELD() maps to portYIELD(), which is necessarily the case for all ports, otherwise the kernel itself wouldn’t build. So in this case I’m guessing your problem is something to do with the source files you are building, or way you in including header files.

Do you have the PIC32 port layer included in your project? See the demo application provided for the PIC32 in the FreeRTOS download or the link in this post for information on including the right port layer.

How are you including the FreeRTOS header files in the c file calling taskYIELD()? You should have FreeRTOS.h first, as that brings in the correct port layer files in the correct order so will bring in portYIELD(), and then task.h as that is the file in which taskYIELD() is defined.

Richard, I am sure that I am doing something wrong. Just not sure what it is. At this point my project includes 2 dozen files and they all compile and run. I am using message_buffers, stream_buffers, queues, task handles, mutex’s and such without problems.

But taskYIELD() does not compile. Here is the lineup of my includes:

#include <string.h>
#include “FreeRTOS.h”
#include “message_buffer.h”
#include “task.h”
#include “device.h”
#include “plib_i2c2.h”
#include “peripheral/gpio/plib_gpio.h”
#include “TypeSizes.h”
#include “gcs.h”
#include “i2c.h”
#include “DPI700_config.h”

The setup of the include path is as set my Microchip environment, I have not changed it.

I would be surprised if it made a difference, but can you try swapping the order in which message_buffer.h and task.h are included.

Richard, Thank you for the suggestion.

#include <string.h>
#include “FreeRTOS.h”
#include “task.h”
#include “message_buffer.h”
#include “device.h”
#include “plib_i2c2.h”
#include “peripheral/gpio/plib_gpio.h”
#include “TypeSizes.h”
#include “gcs.h”
#include “i2c.h”
#include “DPI700_config.h”
.
.
.
.
while( GPIO_PinRead(GPIO_PIN_RD13) == 0 ) TaskYIELD();
.
.
.
.
.
.

result:

../src/config/default/peripheral/i2c/plib_i2c2.c: In function 'i2c_send':
../src/config/default/peripheral/i2c/plib_i2c2.c:200:5: error: implicit declaration of function 'TaskYIELD' [-Werror=implicit-function-declaration]
while( GPIO_PinRead(GPIO_PIN_RD13) == 0 ) TaskYIELD();

The macro is taskYIELD(), not TaskYIELD() :smiley:

See the macro naming conventions here: https://www.freertos.org/FreeRTOS-Coding-Standard-and-Style-Guide.html#NamingConventions

Good catch, thank you. Funny I had it coded in two different places:

while( i2c_control.done == 0 ) { taskYIELD(); }

while( GPIO_PinRead(GPIO_PIN_RD13) == 0 ) TaskYIELD();  

Did not notice only one of them was being complained about…

Silly mistake,
Robert