Errors software timers

hi, i m using freertos v10.2.1 i am trying to use software timers i included timer.c i added timer’s configuration in freertosconfig.h but nothing works i have when i compile i get this error :syntax error in timers.c ligne 76 TimerCallbackFunction_t pxCallbackFunction;
please any one can help me (im using pic 18F45K22 with mplab x v6 and mplab c 18 compiler .
thanx for help

That code builds with a lot of compilers so my guess is the C18 compiler doesn’t support all the C constructs used in the code. TimeCallbackFunction_t is a function pointer, you could try playing around with its definition. The task.h header file also uses function pointer types - is that compiling?

yes mr,
task.h is compiling , but nothing works with timers same thing with timer’s functions (timerhandle…etc) it keeps showing syntax errors
thank you verry much for your reply mr.

Can you post the complete compiler output?

make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'E:/TP_FreeRTOS/PIC18_MPLAB/demarrage00copienew2again.X'
make -f nbproject/Makefile-default.mk dist/default/production/demarrage00copienew2again.X.production.hex
make[2]: Entering directory 'E:/TP_FreeRTOS/PIC18_MPLAB/demarrage00copienew2again.X'
"C:\Program Files (x86)\Microchip\mplabc18\v3.47\bin\mcc18.exe" -p18F45K22 -DMPLAB_PIC18F_PORT -I"C:/Program Files (x86)/Microchip/mplabc18/v3.47/h" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/include" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/portable/MPLAB/PIC18F" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/portable/Common" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Demo/Common/include" -I"../" -ms -oa- -Ls -o- -I "C:\Program Files (x86)\Microchip\mplabc18\v3.47\bin"\\..\\h -fo build/default/production/_ext/603255033/heap_1.o ../../../FreeRTOSv10.2.1/FreeRTOS/Source/portable/MemMang/heap_1.c
"C:\Program Files (x86)\Microchip\mplabc18\v3.47\bin\mcc18.exe" -p18F45K22 -DMPLAB_PIC18F_PORT -I"C:/Program Files (x86)/Microchip/mplabc18/v3.47/h" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/include" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/portable/MPLAB/PIC18F" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/portable/Common" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Demo/Common/include" -I"../" -ms -oa- -Ls -o- -I "C:\Program Files (x86)\Microchip\mplabc18\v3.47\bin"\\..\\h -fo build/default/production/_ext/1993632420/queue.o ../../../FreeRTOSv10.2.1/FreeRTOS/Source/queue.c
"C:\Program Files (x86)\Microchip\mplabc18\v3.47\bin\mcc18.exe" -p18F45K22 -DMPLAB_PIC18F_PORT -I"C:/Program Files (x86)/Microchip/mplabc18/v3.47/h" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/include" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/portable/MPLAB/PIC18F" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/portable/Common" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Demo/Common/include" -I"../" -ms -oa- -Ls -o- -I "C:\Program Files (x86)\Microchip\mplabc18\v3.47\bin"\\..\\h -fo build/default/production/_ext/1993632420/list.o ../../../FreeRTOSv10.2.1/FreeRTOS/Source/list.c
"C:\Program Files (x86)\Microchip\mplabc18\v3.47\bin\mcc18.exe" -p18F45K22 -DMPLAB_PIC18F_PORT -I"C:/Program Files (x86)/Microchip/mplabc18/v3.47/h" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/include" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/portable/MPLAB/PIC18F" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/portable/Common" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Demo/Common/include" -I"../" -ms -oa- -Ls -o- -I "C:\Program Files (x86)\Microchip\mplabc18\v3.47\bin"\\..\\h -fo build/default/production/_ext/295306048/flash.o ../../../FreeRTOSv10.2.1/FreeRTOS/Demo/Common/Minimal/flash.c
"C:\Program Files (x86)\Microchip\mplabc18\v3.47\bin\mcc18.exe" -p18F45K22 -DMPLAB_PIC18F_PORT -I"C:/Program Files (x86)/Microchip/mplabc18/v3.47/h" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/include" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/portable/MPLAB/PIC18F" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/portable/Common" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Demo/Common/include" -I"../" -ms -oa- -Ls -o- -I "C:\Program Files (x86)\Microchip\mplabc18\v3.47\bin"\\..\\h -fo build/default/production/_ext/821501661/serial.o ../serial/serial.c
"C:\Program Files (x86)\Microchip\mplabc18\v3.47\bin\mcc18.exe" -p18F45K22 -DMPLAB_PIC18F_PORT -I"C:/Program Files (x86)/Microchip/mplabc18/v3.47/h" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/include" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/portable/MPLAB/PIC18F" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/portable/Common" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Demo/Common/include" -I"../" -ms -oa- -Ls -o- -I "C:\Program Files (x86)\Microchip\mplabc18\v3.47\bin"\\..\\h -fo build/default/production/_ext/431188260/port_modif.o C:/Users/moi/Desktop/softwr_tool/pfe/port_modif.c
"C:\Program Files (x86)\Microchip\mplabc18\v3.47\bin\mcc18.exe" -p18F45K22 -DMPLAB_PIC18F_PORT -I"C:/Program Files (x86)/Microchip/mplabc18/v3.47/h" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/include" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/portable/MPLAB/PIC18F" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/portable/Common" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Demo/Common/include" -I"../" -ms -oa- -Ls -o- -I "C:\Program Files (x86)\Microchip\mplabc18\v3.47\bin"\\..\\h -fo build/default/production/_ext/809743516/ParTest.o ../ParTest/ParTest.c
"C:\Program Files (x86)\Microchip\mplabc18\v3.47\bin\mcc18.exe" -p18F45K22 -DMPLAB_PIC18F_PORT -I"C:/Program Files (x86)/Microchip/mplabc18/v3.47/h" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/include" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/portable/MPLAB/PIC18F" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/portable/Common" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Demo/Common/include" -I"../" -ms -oa- -Ls -o- -I "C:\Program Files (x86)\Microchip\mplabc18\v3.47\bin"\\..\\h -fo build/default/production/_ext/1993632420/tasks.o ../../../FreeRTOSv10.2.1/FreeRTOS/Source/tasks.c
E:\FreeRTOSv10.2.1\FreeRTOS\Demo\Common\Minimal\flash.c:73:Warning [2066] type qualifier mismatch in assignment
make[2]: Circular dist/default/production/demarrage00copienew2again.X.production.hex <- dist/default/production/demarrage00copienew2again.X.production.hex dependency dropped.
E:\FreeRTOSv10.2.1\FreeRTOS\Source\tasks.c:1053:Warning [2066] type qualifier mismatch in assignment
E:\FreeRTOSv10.2.1\FreeRTOS\Source\tasks.c:2002:Warning [2066] type qualifier mismatch in assignment
E:\FreeRTOSv10.2.1\FreeRTOS\Source\tasks.c:2014:Warning [2058] call of function without prototype
"C:\Program Files (x86)\Microchip\mplabc18\v3.47\bin\mcc18.exe" -p18F45K22 -DMPLAB_PIC18F_PORT -I"C:/Program Files (x86)/Microchip/mplabc18/v3.47/h" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/include" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/portable/MPLAB/PIC18F" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/portable/Common" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Demo/Common/include" -I"../" -ms -oa- -Ls -o- -I "C:\Program Files (x86)\Microchip\mplabc18\v3.47\bin"\\..\\h -fo build/default/production/_ext/697113925/timers.o ../../../FreeRTOS/FreeRTOSv10.2.1/FreeRTOS/Source/timers.c
"C:\Program Files (x86)\Microchip\mplabc18\v3.47\bin\mcc18.exe" -p18F45K22 -DMPLAB_PIC18F_PORT -I"C:/Program Files (x86)/Microchip/mplabc18/v3.47/h" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/include" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/portable/MPLAB/PIC18F" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Source/portable/Common" -I"../../../FreeRTOSv10.2.1/FreeRTOS/Demo/Common/include" -I"../" -ms -oa- -Ls -o- -I "C:\Program Files (x86)\Microchip\mplabc18\v3.47\bin"\\..\\h -fo build/default/production/_ext/1472/maindemarrage00copy.o ../maindemarrage00copy.c
E:\TP_FreeRTOS\PIC18_MPLAB\serial\serial.c:205:Warning [2074] location PRODH specified in the interrupt save list is redundant
E:\TP_FreeRTOS\PIC18_MPLAB\serial\serial.c:205:Warning [2074] location PRODL specified in the interrupt save list is redundant
E:\TP_FreeRTOS\PIC18_MPLAB\serial\serial.c:205:Warning [2074] location TABLAT specified in the interrupt save list is redundant
E:\TP_FreeRTOS\PIC18_MPLAB\serial\serial.c:205:Warning [2074] location .tmpdata specified in the interrupt save list is redundant
E:\TP_FreeRTOS\PIC18_MPLAB\serial\serial.c:231:Warning [2074] location PRODH specified in the interrupt save list is redundant
E:\TP_FreeRTOS\PIC18_MPLAB\serial\serial.c:231:Warning [2074] location PRODL specified in the interrupt save list is redundant
E:\TP_FreeRTOS\PIC18_MPLAB\serial\serial.c:231:Warning [2074] location TABLAT specified in the interrupt save list is redundant
E:\TP_FreeRTOS\PIC18_MPLAB\serial\serial.c:231:Warning [2074] location .tmpdata specified in the interrupt save list is redundant
E:\FreeRTOS\FreeRTOSv10.2.1\FreeRTOS\Source\timers.c:83:Error: syntax error
nbproject/Makefile-default.mk:259: recipe for target 'build/default/production/_ext/697113925/timers.o' failed
make[2]: *** [build/default/production/_ext/697113925/timers.o] Error 3
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [build/default/production/_ext/1472/maindemarrage00copy.o] Error 3
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
E:\TP_FreeRTOS\PIC18_MPLAB\maindemarrage00copy.c:167:Error: syntax error
nbproject/Makefile-default.mk:251: recipe for target 'build/default/production/_ext/1472/maindemarrage00copy.o' failed
make[2]: Leaving directory 'E:/TP_FreeRTOS/PIC18_MPLAB/demarrage00copienew2again.X'
nbproject/Makefile-default.mk:91: recipe for target '.build-conf' failed
make[1]: Leaving directory 'E:/TP_FreeRTOS/PIC18_MPLAB/demarrage00copienew2again.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed

BUILD FAILED (exit value 2, total time: 5s

I installed the mcc18 compiler and created a project but timers.c file compiles successfully for me. Did you modify this file or any of the FreeRTOS file? If not, can you zip up and attach your project so that I can give it a try?

Hi mr, i think that the problem was that the compiler was confused between the header file 'timers.h of freertos and the library "timers.h " of the pic ( pot.c use timers.h of the pic ) so i renamed the freertos’s header file timers.h but now i m getting a new error :
Error - section ‘.idata_heap_1.o’ can not fit the section. Section ‘.idata_heap_1.o’ length=0x00000004
Errors : 1

Pleased you found the source of the original problem.

This new error is a linker error - it is saying the heap defined in heap_1 isn’t fitting into the RAM. Have a look at this page, although I’m curious it seems to indicate the heap is 4 bytes only.