We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: dany
Last Updated: 2016-02-18
Package Version: 3.0.0.0
Category: Other Codes
Downloaded: 5190 times
Followed by: 2 users
License: MIT license
CRTOS stands for Cooperative Real Time Operating System; designed for and written specifically in mP/mB 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.
Do you want to subscribe in order to receive notifications regarding "C RTOS for mP and mB (P18 and P24)" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "C RTOS for mP and mB (P18 and P24)" changes.
Do you want to report abuse regarding "C RTOS for mP and mB (P18 and P24)".
DOWNLOAD LINK | RELATED COMPILER | CONTAINS |
---|---|---|
1431346206_c_rtos_for_mp_an_mikropascal_pic.mpkg [1.41MB] | mikroPascal PRO for PIC |
|
1435592986_c_rtos_for_mp_an_mikrobasic_pic.mpkg [1.45MB] | mikroBasic PRO for PIC |
|
1435593005_c_rtos_for_mp_an_other_pic.zip [2.15MB] | Other PIC Compilers |
|
1431346273_c_rtos_for_mp_an_mikropascal_pic24.mpkg [1.48MB] | mikroPascal PRO for dsPIC30/33 & PIC24 |
|
1435593024_c_rtos_for_mp_an_mikrobasic_pic24.mpkg [1.45MB] | mikroBasic PRO for dsPIC30/33 & PIC24 |
|
1435593043_c_rtos_for_mp_an_other_pic24.zip [1.92MB] | Other PIC24 Compilers |
|
CRTOS Library (Cooperative Real Time Operating System). Documentation. The P24 mP version was tested on P24FJ64GA002 and on MMB for P24EF. The P24 mB version was tested on a P24FJ64GA002 (limited test). The P18 version is tested on a P18F2620.
IMPORTANT: Since the projects using CRTOS will include *.inc files and at least one *.pld file it is necessary to have the "Always build all files in the project” compiler option (IDE menu: Tools, Options, Output settings ) ON.
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" (P24 version, windows 7 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 P18, P24 and P24E series of MPUs. It is written in mikroPascal (with a small part - context saving and restoring - in assembler), so changes should be rather easy to implement.
CRTOS supports the following features:
Have fun!
Usage Examples:
Uart receive / send example with a critical resource
CRTOS Counting Semaphore example
CRTOS Counting Semaphore signaled from ISR example
Example for the mikro Media Board (P24EP)
Acknowledgement: The specification of CRTOS is derived from PRTOS which was written by John Barrat 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!
As can be seen, the scheduler does not “call†the tasks, the tasks “call†the scheduler. The scheduler simply chooses the task to which it “returns†to.
View full imageVersion 1.1: corrected an error in "OS_CreateCountingSemaphore". Sorry for the inconvenience.
2013-06-27: Updated the documentation CRTOS.pdf
2013-06-29: New version: the .mpkg file (package) was not installable: an .mpkg file should have a library (.mcl files) included, this was not the case.
30-06-2013: version 1.2.
Made selection of the next task faster,
Optimized the timer interrupt procedure for speed,
Optimized the time interrupts are disabled.
2013-07-01: added the mikroBasic for PIC24 version.
2013-07-03: Added the "Always" procedure to the documentation now (was implemented in version 1.2). This is a procedure that is called (optionally) in every CRTOS scheduler loop.
2013-07-04: Updated the documentation. My thanks to John Barrat for his advice.
2012-07-05: new version: v1.3.
Added some functionalities:
2013-07-09: version 1.4: Moved the CRTOS configuration out of CRTOS.mpas to 2 project files: CRTOS_Defines.pld and CRTOS_Sizes.inc. The user does not have to adapt the library code itself to his needs, this is now done in the 2 extra project files. See the Documentation for details.
New version 2.0 (2013-09-02): Extended the context of the tasks. The saved context per task is now: W0..W14, PSVPAG, TBLPAG, RCOUNT, PCH and PCL, according the suggestions of the mE developers (thanks mE!).
2013-09-03: - corrected a small error in "CRTOS_Select_and Run_Task.inc". Nothing fatal. :-) - made the assembler code in the .inc files more simple. The functionality is unchanged.
Version 3.0 (2013-09-11): - Made the PIC24 versions more code size efficient (one extra file: "CRTOS_P24E.inc"). - Added the P18 versions (mP and mB)
2013-12-12: Added the following text to the helpfile regarding the compiler options to use: IMPORTANT: Since the projects using CRTOS will include *.inc files and at least one *.pld file it is necessary to have the "Always build all files in the project” compiler option (IDE menu: Tools, Options, Output settings ) ON.
2014-03-13: The mikroBasic files and zip files have been updated. All mB sources are present now (not tested if compilable though).
2015-01-26: Replaced the mB files: all mB files are compilable now (which e.g. means that all "with" statements are dealt with). I could however not link and test the libraries (no mB licence).
2015-05-09: Corrected the P24 version for problems with non preservation of local variable values. Also a problem with accessing constants (which blocked the code) has been solved. Sorry for any inconveniences caused by these issues!
2015-05-11: Both P18 and P24: Small change in OS_CreateTask and Restore_Context, no functionality changes...