portYIELD_FROM_ISR() not recognised

I cannot find portYIELD_FROM_ISR() in the freeRTOS online documentation. Is there a search facility or index for all functions?

Also I include the task.h but the following line


gives the error below as if it does not see it. Do I need to include another header for the function definition?

../src/config/default/interrupts.c: In function 'CHANGE_NOTICE_B_Handler':
../src/config/default/interrupts.c:115:5: error: implicit declaration of function 'portYIELD_FROM_ISR' [-Werror=implicit-function-declaration]

Have you included FreeRTOS.h then task.h? Your support requests just sound like you are not including the header files.

Hi Richard,
I did included task.h in my code and following your reply I have now also included FreeRTOS.h

But the same error persists. And if I click on the function it does not bring me to the definition, as if it does not find the file. But it is there, included.

This is the complete output:

make[2]: Entering directory 'D:/Dropbox (TDL)/TDL Design/Rational/Firmware_OP60_RTOS/firmware/OP60_RTOS.X'
../src/config/default/interrupts.c: In function 'CHANGE_NOTICE_B_Handler':
../src/config/default/interrupts.c:116:5: error: implicit declaration of function 'portYIELD_FROM_ISR' [-Werror=implicit-function-declaration]
cc1.exe: all warnings being treated as errors
make[2]: *** [build/default/production/_ext/1171490990/interrupts.o] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
"C:\Program Files (x86)\Microchip\xc32\v2.30\bin\xc32-gcc.exe" -g -x c -c -mprocessor=32MZ1024EFG100 -ffunction-sections -O1 -I../src/third_party/rtos/FreeRTOS/Source/portable/MPLAB/PIC32MZ -I../src/third_party/rtos/FreeRTOS/Source/include -I../src -I../src/config/default -I../src/packs/PIC32MZ1024EFG100_DFP -Werror -Wall -MMD -MF build/default/production/_ext/1171490990/interrupts.o.d -o build/default/production/_ext/1171490990/interrupts.o ../src/config/default/interrupts.c -DXPRJ_default=default -no-legacy-libc "-mdfp=C:/Program Files (x86)/Microchip/MPLABX/v5.30/packs/Microchip/PIC32MZ-EF_DFP/1.1.45" 
nbproject/Makefile-default.mk:428: recipe for target 'build/default/production/_ext/1171490990/interrupts.o' failed
make[2]: Leaving directory 'D:/Dropbox (TDL)/TDL Design/Rational/Firmware_OP60_RTOS/firmware/OP60_RTOS.X'
nbproject/Makefile-default.mk:91: recipe for target '.build-conf' failed
make[1]: Leaving directory 'D:/Dropbox (TDL)/TDL Design/Rational/Firmware_OP60_RTOS/firmware/OP60_RTOS.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed

BUILD FAILED (exit value 2, total time: 1s)

I also looked into both files task.h and FreeRTOS.h and neither have the function definition/declaration of portYIELD_FROM_ISR.

Previously I asked if you had more than one header file called task.h, can you confirm that is not the case as it should not have built at all if you included task.h with previously including FreeRTOS.h - but just output a #error message.

I just double checked and can only find a single task.h file in the entire freeRTOS folder/sub-folders
and also there are no task.h in any of my project folders/subfolders.

I also tried including only task.h and then only freeRTOS.h and then both. The output from the compiler is always the same.

I also looked into both task.h and freeRTOS.h and neither contain the definition of portYIELD_FROM_ISR function

Do I have to perhaps enable the inclusion of that function to be available?

I hope that answers your point? If not, could you please elaborate.

Thank you :slight_smile:

In which case I don’t think you are building code provided by us. You can see here that if you include task.h without first including FreeRTOS.h the compiler will stop with the #error message on that link.

I just opened task.h and it does have the same #error directive. I then saw that they were both included through a previous include of another file that was generated by MPLAB.

Which also confirms the fact that that the same error does appear even if I don’t include either of them - because they are #included in the other file #included a few #include above

I also checked both task.h and freeRTOS.h from the link you sent me and neither of them include the portYIELD_FROM_ISR(). And mine don’t either.

So where is the definition of portYIELD_FROM_ISR ?

Also is there a search for portYIELD_FROM_ISR in the online documentation? Is there a search facility on the freeRTOS.org website? I could not find any. It is tedious to have to manually go through the API index on the left side of the web page.

Thank you

One thing to note, since the name begins with port, the definition will come from the portability layer. FreeRTOS.h will have in it a statement to include portable.h which will include the portmacro.h file from the appropriate directory (you may need to set the include paths so this happens).

Note that different ports may use slightly different methods to write things like an ISR. It somewhat depends on how old the port is.

The documentation for symbols beginning with port is ultimately in that header, though much is described in the documentation for general rules for ports.

I just looked into those files (portable.h and portmacro.h) and all the #include files that are in there too. No sign of the portYIELD_FROM_ISR

So do I have to enable it somehow to be present in the API, perhaps during the installation by enabling some “installation flags”?

It is not a configurable option - but looking now I see the PIC32 port doesn’t have a macro called portYIELD_FROM_ISR() - it uses the older portEND_SWITCHING_ISR(). I suspect your interrupts.c file is not written for the PIC32. Interrupts on the PIC32 require wrappers, and per the “interrupt service routines” section of this page https://www.freertos.org/port_PIC32_MIPS_MK4.html