dsPIC 30f6014 Port

dspicrtos wrote on Friday, September 22, 2006:


I make a port of the freertos for the dsPIC30f6014 from microchip under the MPLAB-C30 compiler.

I tested it on a simple board with the flashing led tasks.

Also, I tried to use the simulator for testing the UART functions with Queue services.

Evrything sames ok. Well mi question is
how to guarented that the port is absolutly ok?
do I need to test evry services function individualy? or can I satisfy with some minimal test?

In other way, is there a  general method for testing micro-embedded OS?


Abdallah M’ziti El Ibrahimi

rtel wrote on Friday, September 22, 2006:

Hi - I’m working on the same thing!  Well PIC24 anyhow.

The ‘standard’ demo tasks are designed to provide code coverage to test the port behaviour.  They actually provide a very good test.

In addition I generally:

+ Create some tasks that (written in assembler) set each register to known values then check they maintain the expected value as a context switch occurs.  I let these run in the background during all other tests.

+ Step through various aspects to ensure correct behaviour - for example switching a task in an ISR, then back to the task from task level and visa versa, etc.

+ Perform tests on context switching within critical regions to ensure status registers and interrupt levels remain at their correct value.

+ Etc…Etc…Etc.  It actually takes quite a lot of time and in depth understanding of the source code to know where the potential pitfalls are.

I would be interested in seeing your dsPIC code.  I hope to have the PIC24 code released in a couple of weeks.  I don’t think there is much difference between the dsPIC and PIC24?


dspicrtos wrote on Friday, September 22, 2006:


I well try in depper all the proposed tests.

And also, I well conform the code to your guidance style code writing as you mentionned it in you site web.

It well take me about a week I hope. And then I well give you the code if you want.

Thank you for your help

Abdallah M’ziti El Ibrahimi.

dspicrtos wrote on Wednesday, September 27, 2006:


I send to you the port of the freeRTOS for dsPIC 30f6014 from microchip.
Please have a look and let me know your comments.

I used the
- 4.0.1 freertos version
- 7.42 MPLAB IDE
- v2.03 MPLAB C30

Thank you

Abdallah M’ziti El Ibrahimi

rtel wrote on Thursday, September 28, 2006:

Thanks for your files.  As you know I have been working on a PIC24 port also.  I see that you are saving more registers than my PIC24 version, I presume these are dsPIC specific, but will recheck the data sheet to make sure I am not missing anything.

It is interesting to see the different approach taken.  I have written the port using inline assembler where necessary, but all within C files. 

One thing - looking at your _vPortYield function.  It seems that w0 is modified before it is saved in the context.  Is this the case?


dspicrtos wrote on Thursday, September 28, 2006:

Yes you’re wright,
a make a correction by using the Shadow registers as temporary registers for saving the W0.

A send to you the files.


dspicrtos wrote on Thursday, September 28, 2006:

Yes as you mentionned it; I wrote a part of the port in assembler because I was fearing that the compiler insert some instructions before saving the context. Also for better performance, a prefer to do the strict minimum things in the switching process since  the switch task is usually called and mist be quickly executed for don’t disturbing the tasks.

But it’s clear that C writing is more elegant style and more easy to modifie, and with modern compilers the code generated is near the assembler hand writing.

For informations, I test the port with-out using optimisation options of the compiler


Abdallah M’ziti El Ibrahimi

nobody wrote on Wednesday, March 21, 2007:


I am a new user of FreeRTOS. I have downloaded it and am trying to compile the demo application. I have the Explorer 16 demo board from Microchip.

When I try to build the dsPIC_MPLAB demo I get the following errors:

main.c:68:22: FreeRTOS.h: No such file or directory
main.c:69:18: task.h: No such file or directory
main.c:70:22: croutine.h: No such file or directory
main.c:73:20: BlockQ.h: No such file or directory
main.c:74:21: crflash.h: No such file or directory
main.c:75:22: blocktim.h: No such file or directory
main.c:76:21: integer.h: No such file or directory
main.c:77:22: comtest2.h: No such file or directory
main.c:78:21: partest.h: No such file or directory

The FreeRTOS.h,task.h, croutine.h are included in the demo project. Where are BlockQ.h,crfalsh.h,blocktim.h,integer.h,comtest2.h and partest.h files located?

Can anyone please paste instructions on how to build the demo project in MPLAB?

I look forward to your reply.

beverlin wrote on Sunday, November 22, 2009:

Hi Abdallah,

Do you have the port for dsPIC30F4011?

Thanks and Kind Regards,