Create a FreeRTOS from scratch (For MicroChip chips, MPLab IDE)

eaoiyrioeaf wrote on Tuesday, March 28, 2017:

In some case, modifying the example port to your own port might difficult, because it is difficulty to modify all the settings. I’m sharing my procedure to create a project from zero, hope it can help some one. Below are the procedure:
1> Create an empty project by the MPLab wizard, and choose the correct chip model.
2> Create main source file, main.c.
3> Copy the “Hardware” folder & “Source” folder & “FreeRTOSConfig.h” to the project folder, Add the folders to source folder, Project_Properties–>XC16–>XC16-gcc–>Preprocessing and messages–>C include dirs, then include the “FreeRTOS.h”, “task.h” and “queue.h”, this time the compiler should build with no error.
4> Disable CO_ROUTINES the in file “FreeRTOSConfig.h” by set the Micro configUSE_CO_ROUTINES to 0.
5> Create a new logic folder under the Source file, rename the folder to “FreeRTOS Source”, and add heap_4.c, list.c, port.c, portasm_dsPIC.S, queue.c, tasks.c into this logic folder.
6> Define a empty function void vApplicationIdleHook( void ) in the main.c file. By now, the project should build with no error.
7> Define Micro for the port “MPLAB_DSPIC_PORT” Project_Properties–>XC16–>XC16-gcc–>Preprocessing and messages–>Define C macros. Try to build the project again, if some include error appeared, modify the path to help compiler find the file. In my case, the compiler says “deprecated_definitions.h:106:64: fatal error: …/…/Source/portable/MPLAB/PIC24_dsPIC/portmacro.h: No such file or directory”. I just change the include statement from #include “…/…/Source/portable/MPLAB/PIC24_dsPIC/portmacro.h” to #include “portmacro.h” then the build pass.
8> At last, we might need to uncheck the Use legacy libc option, Project_Properties–>XC16(Global Options)–>Use legacy libc. according to the help document this option:“Check to use libraries in the format before v3.25. Uncheck to use the new (HI-TECH) libraries format.”

rtel wrote on Tuesday, March 28, 2017:

Thanks for these MPLAB specific details. They augment the ‘generic’ pages: