PICOS18 : RTOS for PIC18 µC

We heard so many times talking about real-time kernel in the embedded world without knowing exactly what's the matter ! Actually to understand what is bringing a real-time kernel we have to define it through 3 points :

> A real-time kernel ...

A kernel ...

Actually a kernel is a collection of functionnalities, regrouped under the term of SERVICES for most of them. About Linux, for instance, the kernel is made of process management system, hardware access management system, file mangement system,... The shell is a program, then is not included in the kernel. The malloc function, which allocate dynamicaly memory, call a dedicated function of the kernel, because the kernel is responsive of memory management.
One of the most famous functionnality of a kernel (without being really a service) is the SCHEDULER, which allows programs to live together.

... multi-task ...
So the kernel controls the resources and allows a safe and efficiant use of them through SERVICES. Because the kernel assures the stability of the system, many independant programs can be ready to start, actually when the kernel decides to start them. This MULTI-PROGRAMING capability allows developers to build programs whithout taking into account the existence of other programs in the system. Each task has the feeling to be the only one in the system. If the kernel can, it is also possible to run these programs in parallel by giving the feeling to every one to be the only process in the system (with a slowing down of all the system of course). When the kernel is a perfect orchester for the system (the process management is the role of the kernel) we say the kernel is a MULTI-TASK PREEMPTIVE one. If the kernel is not able to do so, the tasks have to do the job by calling the scheduler. We say the kernel is a MULTI-TASK COOPERATIVE kernel.
... real-time.

The multi-tasks kernel could manage the system by splitting the time bitween the different tasks. By the way the tasks have never the same needs, and even some, rarely actives, need all the CPU power when they're running. So the tasks have different PRIORITIES, and have to be activated as soon as possible when an event occurs. Rather than to ensure the smallest deadline (a nul one is not possible), the kernel have to give a constant SCHEDULING LATENCY : it's the DETERMINISM.


> ... for PIC18

Before PIC18 family it was not possible to develop a such real-time kernel for PIC. Indeed the first feature of a multi-task kernel is to manage the tasks with the feeling they run at the same time, and doing so force the stack to be under control of kernel. Imagine what's append if all the running tasks would share the same stack : the kernel would stop the running task to activate another one and during the next RETURN instruction in the new task, the callback would be in the previous task !

The PIC18 uC allow the hadrware stack management (PUSH and POP instructions added to the instruction table, and move of the pc) , so that it is possible now the setup the stack just before the next task activation.

Just was missing the list of kernel services to develop and the architecture of task and resource management. Rather than creating a proprietary solution, I've decided to based my project on a standart. I've choosen the OSEK (www.osek-vdx.org), automotive standart used also in robotic. This standart defines the role of the kernel around 3 axes : Operating System (OS), Communication (COM) and Network Management (NM). At this moment only the OS part has been implemented.

The PICOS18 kernel is an open-source project and is distributed under GPL license. Any help is wellcome and please don't hesitate to tell me about your projects using this real-time kernel.

the sources
Mailing List
Kernel features
and performances