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

**URL:** <https://forums.freertos.org/t/create-a-freertos-from-scratch-for-microchip-chips-mplab-ide/6507>\
**Category:** Kernel\
**Created:** [March 28, 2017, 8:43am UTC](https://forums.freertos.org/t/create-a-freertos-from-scratch-for-microchip-chips-mplab-ide/6507 "2017-03-28T08:43:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [March 28, 2017, 8:43am UTC](https://forums.freertos.org/t/create-a-freertos-from-scratch-for-microchip-chips-mplab-ide/6507/1 "2017-03-28T08:43:39Z")

</div>

**[eaoiyrioeaf](https://sourceforge.net/u/eaoiyrioeaf/)** wrote on [Tuesday, March 28, 2017](https://sourceforge.net/p/freertos/discussion/382005/thread/dae2344e/#e08d):

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.”

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [March 28, 2017, 2:56pm UTC](https://forums.freertos.org/t/create-a-freertos-from-scratch-for-microchip-chips-mplab-ide/6507/2 "2017-03-28T14:56:51Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Tuesday, March 28, 2017](https://sourceforge.net/p/freertos/discussion/382005/thread/dae2344e/#e08d/bbf2):

Thanks for these MPLAB specific details. They augment the ‘generic’ pages:  
[http://www.freertos.org/Creating-a-new-FreeRTOS-project.html](http://www.freertos.org/Creating-a-new-FreeRTOS-project.html)  
[http://www.freertos.org/porting-a-freertos-demo-to-different-hardware.html](http://www.freertos.org/porting-a-freertos-demo-to-different-hardware.html)
