Hi, I got a lot further this time (but still only a basic featured RTOS).
See the attached test project and RTOS library zipfile.
The implemented
features are:
- Feature presence is defined in "CRTOS_Defines.pld".
- The sizes used (e.g. max number of tasks or events) are defined in "CRTOS_Sizes.inc".
- Delays in tasks performed by the RTOS (using OS_Delay in stead of delay_ms), giving other tasks the possibility to execute during that waiting time.
- Binary and Counting
semaphores, with or without timeout.
- Starting, stopping and replacing (stop current task, start another one) tasks.
- Signalling semaphores both from interrupts and the main thread.
- Task
priorities (priority 0 being the highest one)
- Tasks are executed in the main thread, not in an interrupt routine.
- The RTOS timebase is timer 1, using interrupt priority 6 (to prevent the usage of the shadow register set), currently set at 1 millisecs. So, all timed activities have a resolution of 1 ms.
- The max task execution time is 10 ms. This is the longest time a task will be executed, after that another task (or the same) will be chosen for execution. If a task is pre-empted by another one the execution time will be shorter of course.
-
Pre-empting (if a task with a higher priority than the current one executed becomes eligible then it gets executed first)
- Tasks with the same priority are executed in a "round Robin" (sequential with wrap around) manner.
Still to do:
- adding the idle task.
- documentation
- perhaps a system stack (now all tasks have their own stack)
- stack overfow detection
Your comments/questions/suggestions will be appreciated! Thanks in advance.
A new version (2015-07-25) has been attached:
https://libstock.mikroe.com/projects/vi ... -for-pic32
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)