Rtos for Pic24, Pic30 and Pic33 Micros. Small, Fast and Free.

Status
Not open for further replies.

btbass

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
A time sliced, round robin multitasking kernel for the Pic 16-bit family micros.
Supports event flags, semaphores, and messages.
Fast context switching.
Full source code and documentation.
 

Attachments

  • PicRtos_V2.zip
    606.2 KB · Views: 391

It's a self extracting rar file which will create the correct directory structure.
There is a pdf that details the implementation.
There are example programs that show how to use the functions.
It uses Mplab sim so no hardware is required to try it out.
 
How many tasks it can support? Does it support events, messages, semaphores? How much RAM it needs. Is it cooperative or preemptive multitasking?

Notice that SALVO (Pumpkin: Salvo, the RTOS that runs in tiny places) - the best RTOS for PIC has light version with limited number of tasks and events which could be used in many projects
 

    V

    Points: 2
    Helpful Answer Positive Rating
There are no limits except how much memory you have for stack space.
It supports events, messages and semaphores.
It is time sliced round robin scheduling, not all programs need task priorities.
A simple scheduler is a fast context switcher.
The kernel is small, ~520 Rom ~26 bytes Ram.
 
Last edited:

    V

    Points: 2
    Helpful Answer Positive Rating
Sounds promising.

When I get back home I'll pull it down and have a play 8)

Providing "she who must be obayed" has not lined up a series of not so "little jobs" 8(

---------- Post added at 08:30 ---------- Previous post was at 08:27 ----------

Sounds promising.

When I get back home I'll pull it down and have a play 8)

Providing "she who must be obayed" has not lined up a series of not so "little jobs" 8(
 

Good stuff.

Let me know if you have any questions or comments.
 

I downloaded it and it sounds good

but I can find any site or reference for it
 

No, I wrote it.
But it is fairly straightforward and hopefully, simple to use.
Try out the examples, any questions you have, I will try to answer them.
 

Everything is going fine but when i run the "example_1.c"
i get the following response:

----------------------------------------------------------------------
Debug build of project `C:\Users\Kamal's\Desktop\from Project room\New folder\PicRtos\Code\Example_1.mcp' started.
Language tool versions: pic30-as.exe v3.25, pic30-gcc.exe v3.25, pic30-ld.exe v3.25, pic30-ar.exe v3.25
Preprocessor symbol `__DEBUG' is defined.
Sun May 29 16:40:01 2011
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Deleted file "C:\PicRtos\Code\Object\multitask.o".
Clean: Deleted file "C:\Users\Kamal's\Desktop\from Project room\New folder\PicRtos\Code\Example_1.mcs".
Clean: Done.
Executing: "C:\Program Files (x86)\Microchip\mplabc30\v3.25\bin\pic30-gcc.exe" -mcpu=30F6011A -c -I"C:\Microchip\MPLAB C30\support\h" -I"C:\Microchip\MPLAB C30\include" -I"C:\PicRtos\Code\Include" -D__DEBUG "multitask.s" -o"C:\PicRtos\Code\Object\multitask.o" -Wa,-I"C:\Microchip\MPLAB C30\support\inc",--defsym=__DEBUG=1,-g
Executing: "C:\Program Files (x86)\Microchip\mplabc30\v3.25\bin\pic30-gcc.exe" -mcpu=30F6011A -x c -c "Example_1.c" -o"C:\PicRtos\Code\Object\Example_1.o" -I"C:\Microchip\MPLAB C30\support\h" -I"C:\Microchip\MPLAB C30\include" -I"C:\PicRtos\Code\Include" -D__DEBUG -g -Wall
Example_1.c:11:24: error: multitask.h: No such file or directory
Example_1.c:22: error: syntax error before 'UsedStack'
Example_1.c:22: warning: type defaults to 'int' in declaration of 'UsedStack'
Example_1.c:22: warning: data definition has no type or storage class
Example_1.c:36: error: syntax error before 'delay'
Example_1.c:40: error: syntax error before 'var0'
Example_1.c:40: warning: type defaults to 'int' in declaration of 'var0'
Example_1.c:40: warning: data definition has no type or storage class
Example_1.c:41: error: syntax error before 'var1'
Example_1.c:41: warning: type defaults to 'int' in declaration of 'var1'
Example_1.c:41: warning: data definition has no type or storage class
Example_1.c:42: error: syntax error before 'var2'
Example_1.c:42: warning: type defaults to 'int' in declaration of 'var2'
Example_1.c:42: warning: data definition has no type or storage class
Example_1.c:43: error: syntax error before 'var3'
Example_1.c:43: warning: type defaults to 'int' in declaration of 'var3'
Example_1.c:43: warning: data definition has no type or storage class
Example_1.c:44: error: syntax error before 'var4'
Example_1.c:44: warning: type defaults to 'int' in declaration of 'var4'
Example_1.c:44: warning: data definition has no type or storage class
Example_1.c: In function 'main':
Example_1.c:52: warning: implicit declaration of function 'CreateTask'
Example_1.c:59: warning: implicit declaration of function 'TraceStack'
Example_1.c:60: warning: implicit declaration of function 'TraceTask'
Example_1.c:67: warning: implicit declaration of function 'Multitask'
Example_1.c:67: error: 'TMR_PERIOD' undeclared (first use in this function)
Example_1.c:67: error: (Each undeclared identifier is reported only once
Example_1.c:67: error: for each function it appears in.)
Example_1.c:67: error: 'TIME_SLICE' undeclared (first use in this function)
Example_1.c: In function 'task_1':
Example_1.c:89: warning: implicit declaration of function 'TaskSleep'
Example_1.c: At top level:
Example_1.c:129: error: syntax error before 'delay'
Example_1.c: In function 'Delay':
Example_1.c:131: error: 'uint16_t' undeclared (first use in this function)
Example_1.c:131: error: syntax error before 'timer'
Example_1.c:133: error: 'delay' undeclared (first use in this function)
Example_1.c:135: error: 'timer' undeclared (first use in this function)
Halting build on first failure as requested.
----------------------------------------------------------------------
Debug build of project `C:\Users\Kamal's\Desktop\from Project room\New folder\PicRtos\Code\Example_1.mcp' failed.
Language tool versions: pic30-as.exe v3.25, pic30-gcc.exe v3.25, pic30-ld.exe v3.25, pic30-ar.exe v3.25
Preprocessor symbol `__DEBUG' is defined.
Sun May 29 16:40:06 2011
----------------------------------------------------------------------
BUILD FAILED


please tell me what's wrong??




P.S: Infact i have just checked, all these examples are having similar errors
 

It sounds like the compiler can not find the include files?
In Mplab, on the menu bar, go to:

Project/Build Options/Project/

Then on the Directories Tab, Change the paths to point to the correct locations.

Then use 'Build All'
 
dude mmmmmmmmmmmuh...

lol...i mean thankyou so much, i spent my whole weekend in the lab scratching my head for this idiot job
no doubt, little knowledge is always dangerous
 

Hello! How can i compare your RTOS with other RTOSes like FreeRTOS or picos18
i mean if i want to compare the context switch time, code size etc?
 

For code size, you could write a test program, compile it and then in mplab use 'View/Memory Usage Gauge', to get the code and ram sizes.
For context switching time, when using mplab sim, use the debugger 'Stopwatch', and place breakpoints just before and after a task switch.

As my Rtos is fairly simple and targeted at the Pic 16-bit micros, I think you will find it is smaller and faster than most others.
 
OK but i simulate any example, i see the following:

----------------------------------------------------------------------
Debug build of project `C:\Users\kamal's\Desktop\kamal\Code\Example_1.mcp' started.
Language tool versions: pic30-as.exe v3.30, pic30-gcc.exe v3.30, pic30-ld.exe v3.30, pic30-ar.exe v3.30
Preprocessor symbol `__DEBUG' is defined.
Mon Aug 15 08:23:10 2011
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Deleted file "C:\Users\kamal's\Desktop\kamal\Code\Object\multitask.o".
Clean: Deleted file "C:\Users\kamal's\Desktop\kamal\Code\Object\Example_1.o".
Clean: Deleted file "C:\Users\kamal's\Desktop\kamal\Code\Output\Example_1.cof".
Clean: Deleted file "C:\Users\kamal's\Desktop\kamal\Code\Output\Example_1.hex".
Clean: Deleted file "C:\Users\kamal's\Desktop\kamal\Code\Example_1.mcs".
Clean: Done.
Executing: "C:\Program Files (x86)\Microchip\mplabc30\v3.30b\bin\pic30-gcc.exe" -mcpu=30F6011A -c -I"C:\Microchip\MPLAB C30\support\h" -I"C:\Microchip\MPLAB C30\include" -I"C:\Users\kamal's\Desktop\kamal\Code\Include" -D__DEBUG "multitask.s" -o"C:\Users\kamal's\Desktop\kamal\Code\Object\multitask.o" -Wa,-I"C:\Microchip\MPLAB C30\support\inc",--defsym=__DEBUG=1,-g
Executing: "C:\Program Files (x86)\Microchip\mplabc30\v3.30b\bin\pic30-gcc.exe" -mcpu=30F6011A -x c -c "Example_1.c" -o"C:\Users\kamal's\Desktop\kamal\Code\Object\Example_1.o" -I"C:\Microchip\MPLAB C30\support\h" -I"C:\Microchip\MPLAB C30\include" -I"C:\Users\kamal's\Desktop\kamal\Code\Include" -D__DEBUG -g -Wall
Executing: "C:\Program Files (x86)\Microchip\mplabc30\v3.30b\bin\pic30-gcc.exe" -mcpu=30F6011A "..\Object\multitask.o" "..\Object\Example_1.o" -o"Example_1.cof" -Wl,-L"C:\Microchip\MPLAB C30\lib",--script="..\Link\p30f6011A.gld",--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1,--report-mem


Program Memory [Origin = 0x100, Length = 0x15f00]

section address length (PC units) length (bytes) (dec)
------- ------- ----------------- --------------------
.text 0x100 0x448 0x66c (1644)
.dinit 0x548 0x30 0x48 (72)
.isr 0x578 0x4 0x6 (6)

Total program memory used (bytes): 0x6ba (1722) 1%


Data Memory [Origin = 0x800, Length = 0x1800]

section address alignment gaps total length (dec)
------- ------- -------------- -------------------
.ndata 0x800 0 0xa (10)
.nbss 0x80a 0 0xa (10)
.data 0x814 0 0x14 (20)
.bss 0x828 0 0xa (10)

Total data memory used (bytes): 0x32 (50) <1%


Dynamic Memory Usage

region address maximum length (dec)
------ ------- ---------------------
heap 0 0 (0)
stack 0x832 0x17ce (6094)

Maximum dynamic memory (bytes): 0x17ce (6094)


c:\program files (x86)\microchip\mplabc30\v3.30b\bin\bin\..\bin/pic30-coff-ld.exe: Warning: linker script did not specify CRT0_STARTUP file, default for this device: crt0_standard.o
c:\program files (x86)\microchip\mplabc30\v3.30b\bin\bin\..\bin/pic30-coff-ld.exe: Warning: linker script did not specify CRT1_STARTUP file, default for this device: crt1_standard.o
Executing: "C:\Program Files (x86)\Microchip\mplabc30\v3.30b\bin\pic30-bin2hex.exe" "C:\Users\kamal's\Desktop\kamal\Code\Output\Example_1.cof"
Loaded C:\Users\kamal's\Desktop\kamal\Code\Output\Example_1.cof.
----------------------------------------------------------------------
Debug build of project `C:\Users\kamal's\Desktop\kamal\Code\Example_1.mcp' succeeded.
Language tool versions: pic30-as.exe v3.30, pic30-gcc.exe v3.30, pic30-ld.exe v3.30, pic30-ar.exe v3.30
Preprocessor symbol `__DEBUG' is defined.
Mon Aug 15 08:23:23 2011
----------------------------------------------------------------------
BUILD SUCCEEDED



isn't the blue potion already showing the code size? and how could you make this code size appear in this output window???
does it appear automatically or we have to make some settings??

Thank you so much for your time
I love playing with RTOS
 



and i just got an idea, why not get the context switch time directly from example one, zooming it out and finding the number of instruction cycles used in context switch??
not a bad idea...right???

but now how to calculate the % CPU utilization???
 

If you change from DEBUG build to RELEASE build you will find the code and data size smaller and the context switch faster.
With release build, it does not set the I/O line high for the logic analyser and it doesn't save the stack depth.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…