CRTOS for mikroPascal and mikroBasic.
At this moment it is only available for PIC24. (tested P24FJ64GA002 and MMB for P24EF).
Documentation:http://www.rosseeld.be/DRO/PIC/CRTOS.pdf
Attention for package (.mpkg) users: after installing the package please copy all "*.inc" files from the directory C:\Users\Public\Documents\Mikroelektronika\mikroPascal PRO for dsPIC\Packages\CRTOS_PIC24\examples\CRTOS include files to the directory C:\Users\Public\Documents\Mikroelektronika\mikroPascal PRO for dsPIC\Packages\CRTOS_PIC24\Uses (windows 8 example given).
This RTOS is a Cooperative Real Time Operating System designed for and written specifically in mikroPascal from mikroElektronika. The system uses cooperative as opposed to pre-emptive scheduling which means that the application code you write has to voluntarily release back to the operating system at appropriate times.
Writing code for a RTOS requires a different mindset from that used when writing a single threaded
application. However, once you have come to terms with this approach you will find that quite complex real time systems can be developed quickly using the services of the operating system.
A cooperative operating system is the simplest one imaginable. The tasks running under this type of RTOS are not interrupted by the RTOS to give execution time to another task (as with the preemptive Real Time OS), instead, tasks always have to hand back control to the operating system (i.e.“yield” to the operating system) before the CRTOS gives execution to another task.
So, simple enough. This means however that each single task must yield to the OS in an acceptable time. If a task is too time consuming then it has to be split up in several subtasks, each with an acceptable yield time. Hence the term cooperative: the tasks have to cooperate to make things work well.
The whole library is targeted at the P24 series of MPUs. It is written in mikroPascal, so changes should be easy to implement.
CRTOS supports the following features:
- Task priorities
Unconditional yielding to the CRTOS Scheduler
Timed yielding to the CRTOS Scheduler (i.e. “delay” performed by the Scheduler)
Binary semaphores
Counting semaphores
Waiting for semaphores with or without timeout
Starting and stopping tasks
Signaling semaphores from within an Interrupt Service Routine
- Tasks can NOT have local variables (at least not if their values have to be preserved between invocations)
Acknowledgement:
The specification of CRTOS is derived from PRTOS which was written by John Barrat (JohnGB) in PDS Basic. Also some parts of text in the documentation are extracted (and are sometimes adapted) from the document “PRTOS, Real Time Operating System for Proton Development System” written by John Barrat.
John also contributed a lot to the development of the library, test projects and examples. Thanks John!