I just did the process that @rtel described above and I have 1 task running in the simulator.
- Create a new MPLAB project
- navigate to the project folder and git clone freertos-kernel into this folder. (you could just copy the folder as well)
- inside MPLAB right click on Source Files and select “Add existing items from folders”
- select the kernel folder that you just cloned (or copied) (make sure the file filter is .c and .S
- inside MPLAB right click on the Header Files and select “Add existing items from folders”
- select the kernel folder again. This time change the file filter to header files.
- open the new FreeRTOS-Kernel/portable folder that is now in your project and remove from the build ALL the ports that do not apply. Leave the MPLAB/pic24dsPIC folder in place.
- Add a FreeRTOSConfig.h to the headers folder. You could copy this one to get started.
- Remove the heap implementations that are not needed (only 1 should be in your project). I chose heap_1.c
- Select your project properties. Open XC16->XC16 (Global Options) and add the FreeRTOS include folder and the portable folder for the PIC24.
- Your project view should look something like this.
- Check the FreeRTOSConfig.h settings and adjust the clock speed & total heap size appropriately.j
- Add the following to your FreeRTOSConfig.h
#ifndef SIZE_MAX
#define SIZE_MAX ( ( size_t ) -1 )
#endif
- Add #includej <xc.h> at the top of the FreeRTOSConfig.h. You can remove any #includes that specifically reference a device. xc.h will use the project MCU settings.
- Provide a main function. Or use the one I have attached.
main.c (986 Bytes)
You should be able run this and see count increment every 100msec in the simulator.
When I compile I get one warning related to a cast in heap_1.c
There is no harmony in this project and the port directly access timer 1 to provide the tick interrupt for FreeRTOS.
Good Luck