Porting to dsPIC33FJ256MC710A


I just recently started out with FreeRTOS. I want to port FreeRTOS to the existing bare metal firmware. I tried to google about this but none of the documents/links have what I want. It would be of great help if someone could guide/point me in the correct direction. What I am looking for:

  1. A porting guide/sample project which shows how to add the necessary files in MPLAB X IDE
  2. Other important IDE settings (if any)

I am currently using MPLAB X IDE v5.50, XC16 compiler v1.61.

Thanks in advance!

Why not just start with the pre-done demo application that targets almost that exact MCU. There should be VERY few changes required (likely none, just retarget the compiler for the correct mcu).
FreeRTOS - PIC24 RTOS and dsPIC RTOS ports

Thanks for replying!
I want to learn how to add FreeRTOS specific files and settings to a project from scratch so I did not go for the demo application. Also, I already have the firmware ready for the bare metal application. I need to port FreeRTOS to the same so starting from scratch seems to be a better alternative to me.

The big reason for starting with a demo is that all of the port specific code is already written. I would very much suggest taking a look at the demo and checking out all of the port*.* and .S (ASM) files. These are really the only things that change from one mcu to the next.

You’ll see that adding FreeRTOS isn’t really that complicated. Add the source code, modify the port* files, and then start the scheduler from main. There’s not a whole lot more to it.

I see. Thanks for the clarity! I shall go through the demo and get back again. Also, any other things that I should keep in mind for porting?

My pleasure.

As for other things, read this : Creating a new RTOS project (freertos.org)

If you really want to get a feel for ‘adding’ FreeRTOS to an already existing source tree, I would suggest adding the minimal FreeRTOS source, the port*.* and FreeRTOSconfig.h files from the demo, and then add the task scheduler start to main. That’s the bread-and-butter of adding FreeRTOS to a project.

You’ll learn a LOT by going through the demo and understanding it though. It’s worth some time. Ultimately, It’s probably a lot easier to add your code to the demo than it is to add FreeRTOS to your project though.

If it were me, I would get the demo running, strip out everything I didn’t need, and then begin adding my code as tasks one piece at a time.

1 Like

Thank you sharing the link. That last line looks like a great advice. I shall try to do the same! Thank you for pointing me in the right direction.

1 Like