Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Free rtos for Pic30,33,24.

Status
Not open for further replies.

btbass

Advanced Member level 5
Advanced Member level 5
Joined
Jul 20, 2001
Messages
1,896
Helped
438
Reputation
880
Reaction score
288
Trophy points
1,363
Location
Oberon
Activity points
12,887

pic30

I have just downloaded and installed Mplab C version 3.10b from Microchip. This is a very nice and powerful compiler.
When building my multitasking system example code for the Pic24FJ128GA010, I got the following error message.

Source\multitask.s: Assembler messages:
Source\multitask.s:207: Error: Invalid operands specified ('bclr IPC0,#T1IP2').
Source\multitask.s:207: Check operand #2. Operand must be between 0 and 15, inclusive.

It would appear the Microchip have ommitted to define this bit in their 'p24FJ128GA010.inc' file.
To fix this problem, add the define to the include file.

Code:
;----- IPC0 Bits -----------------------------------------------------
       
        .equiv INT0IP0, 0x0000
        .equiv INT0IP1, 0x0001
        .equiv INT0IP2, 0x0002

        .equiv IC1IP0,  0x0004
        .equiv IC1IP1,  0x0005
        .equiv IC1IP2,  0x0006

        .equiv OC1IP0,  0x0008
        .equiv OC1IP1,  0x0009
        .equiv OC1IP2,  0x000A

        .equiv T1IP0,   0x000C
        .equiv T1IP1,   0x000D
        .equiv T1IP2,   0x000E	;This is the bit they missed!

Happy multitasking.
 

freertos pic24 feedback

I have modified the message passing strutures. They can now be safely called from the processors peripheral interrupts.
I have also improved the task scheduler.
This release is stable.

The files are in a self extracting rar file. This will create the correct directory structure so the examples will compile ok. Just extract to the C:\ drive.
If you extract to another directory, just go into 'Project\Build Options\Project' and set up the correct search paths.
 
pic18 multitasking

Priority Inversion.

A problem that can occur with semaphores is that a task of low priority can block a task of higher priority while it uses a resource. One approach to solving this problem is to raise the priority of the task that is using the resource to the level of the task that is blocked. This gives the task more processor time to complete its use of the resource.
When the task releases the semaphore, its original lower priority is restored.

I have implemented this solution in the code.

The files are in a self extracting rar file which, if extracted to C:\, will create
C:\PicRtos\ and the correct directory structure, the examples should then build and run ok, otherwise, if installed to a different directory, use the 'Project\Build Options' to point the compiler to the correct directories.

The examples demonstrate the use of the kernel using one of each variant in the Microchip 16-bit family. All examples make use of MPLAB SIM as the debugger, so no hardware is required to run the examples.

Example_1 Create task demo simulates a dsPic30f6011A
Example_2 Event Flags demo simulates a dsPic33FJ256GP710
Example_3 Semaphore demo simulates a Pic24FJ128GA010
Example_4 Messages demo simulates a Pic24HJ64GP206

I now consider the kernel to be complete and stable.
 
freertos mplab

Self extracting rar file.
Improved the stack and task trace functions.
Simplified task stack memory allocation.
Added time argument to WaitForEvent call.
Added stack and pass single byte.

To successfully build the examples, you need to point the compiler to the right directories.
In Mplab, go to
Project/Build Options/Project.
Select the directories tab.
Point the compiler to the correct directories.
 
mplab c compiler for pic30

Hi btbass,
Very nice work!
I use only PIC18 (and PICos18), but if ever I switch to PIC24 will give it a try.
For the hum... not very bright users like me, examples with periferals like USART etc. would be also welcome!

Nice job,
rec
 
compilatore pic 30 free

hi recursos,
Thanks for the feedback, I have been waiting for suggestions for improvement, bug reports or criticism of the code. When I have a little more time, I intend to work on optimising the scheduler a bit more.
The cost difference of moving from the 8-bit pic18 to the 16-bit pic24 is coming down. Some 16-bit micros are cheaper than some pic18's! The extra power of native 16-bits is well worth it. They really hit the sweet spot in terms of cost/performance.
 
pic30f+sample+code

As I said in an earlier post, Example 3 fails to build with the latest compiler as Timer 1 priority bit T1IP2 has not been defined in the include file for the Pic24FJ128GA010.
Attached is a corrected include file.
If you are having trouble compiling example 3, use this include file.
 

pic24hj64gp206 project

Well I've hit the 1000 views mark.
Would appreciate any feedback, comments, suggestions, flames etc!
Is anybody using the code in anger?
 
whats the current status of your rtos?? is it static or are you still doing development...

thanks


tom @ lafleur . us
 

At the present time it is static.
I have not received a lot of feedback or any bug reports so I assume it is reasonably stable.
I do intend to try to improve the scheduler when I have a little more free time.
I also intend to see if I can convert it to an OSEK compliant system.
 
would like you to keep it small and fast...

OSEK compliant system is interesting, but small and fast is better... their was/is a free OSEK compliant RTOS for the PIC24 from pragmatec, but it has not been updated in years.

also adding some very basic timer services would be nice...

time delay (x) <---- wake me up in x ticks at a minimum, should also be optional compile time option.

add compile time option to system calls that one may not be using to same some more space.

allow the tick clock to be 16 or 32 bit as an option.

optional % utilization of processor/task that can be remove if not in debug mode, may need an external timer to keep it simple.

You should get this published in Circuit Cellar or Elektor OR post it on some on-line services like https://www.codeproject.com/ to give it/you better exposure. also adding a post on Microchip forum would help others find it.

tom @ lafleur . us

ps: let me know when you make any changes...
 

hi lafleur,
Thanks for your interest in the rtos. I will take your comments on board.
A timer service is the next thing I mean to implement. You can get a crude timer function by calling 'WaitForEvent' with the event set to 0 and the COUNT as the delay. This will suspend the task for COUNT number of task switches. The shortcoming of this is that the delay may vary if you have tasks with different priorities that come ready to run or blocked.

WaitForEvent(0, COUNT);

I will also add some conditional compiles to reduce code size for the functions not being used. Another way to do this is to compile the kernel as a library. Then the linker should only link in the functions being used. I must fight the temptation to add features and just optimize as much as possible the existing code. I believe the functions implemented are enough for the majority of programs. Anybody needing more complex data structures would be looking at a different system.
I agree with your comments that small and fast is what to aim for.
 
the need for optional % utilization/cpu/task is just a debug tool and not a feature, just like the stack checking tool that you have.... it help to find bugs in code.

yes, deterministic time function(s) are needed...

any examples you have talking to device would be of help to most users... USART, LCD, CAN, i2c, SPI ect...

tom lafleur
tom @ lafleur . us
 

lafleur said:
the need for optional % utilization/cpu/task is just a debug tool and not a feature, just like the stack checking tool that you have.... it help to find bugs in code.

yes, deterministic time function(s) are needed...

any examples you have talking to device would be of help to most users... USART, LCD, CAN, i2c, SPI ect...

tom lafleur
tom @ lafleur . us

I'm interested in alternatives to this RTOS; I'm thinking of something like FreeRtos, with most of the code written in C, but with free full documentation.
Thank you!
 

This rtos is lightweight and easy to use. The features implemented, semaphores, events and message passing are all very well documented and demonstrated with examples. It is suitable for a wide range of applications.

If you need more sophisticated features and data structures, then FreeRtos is a good choice. I believe it is in continual development with good supporting documentation.
 
btbass said:
This rtos is lightweight and easy to use. The features implemented, semaphores, events and message passing are all very well documented and demonstrated with examples. It is suitable for a wide range of applications.

If you need more sophisticated features and data structures, then FreeRtos is a good choice. I believe it is in continual development with good supporting documentation.

You're right! Thanks for the fast reply! And thanks for making your RTOS implementation public!
 

Re: pic30f+project

I don't see any files here to download

---------- Post added at 13:59 ---------- Previous post was at 13:57 ----------

Here is my Multitasking system for the Microchip Pic30, 33, 24 series of 16 bit micros.
This is a work in progress, so any feedback, comments, bug reports would be appreciated.
Please read the pdf file.

I don't see any files on here

I have another question. I use a macbook pro. Is there any way that i can use the RTOS tools or develop software on this machine.

Thanks in advance
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top