|
|
Mkernel - Kernel for PIC18Fx550 micro controlerlast update 29.9.2008 |
The Mkernel, Michaels
Kernel,
Mini Kernel, call it what you want, was created after porting
FreeRTOS to a PIC18F4550 using the SDCC. The motivation for starting
an independent development was the memory footprint, since FreeRTOS
was when compiled with SDCC consuming 80% of the code space. So the
basic idea of Mkernel is to keep requirements and implementation
simple and small.
Besides the beeing simple, starting with Version 0.6.x the kernel
API will be developed based along the OSEK/VDX
specification since
i like to reuse the mature semantics of the OSEK/VDX specifications as
long as it creates no useless burden. Specially the idea of
leaving the creation of the complete system to tools using a
specification language will become a key element of Mkernel.
Even thought, mkernel is not intended as a compliant OSEK/VDX implementation, it supports the following OSEK/VDX inpspired features:
Extended Task Model
Resources
Counter & Alarms
Process communication based on OSEK/VDX like event passing
OIL Systembuilder
Process/Interrupt handler communication based on events and resources.
Simple device model
Drivers for most of the build in devices of the PIC18f4550 (ADC,PWM,CVREF, I2C, COMP).
Drivers for the IOR5E board
The project results maintained at source forge
The kernel it is implemented as a set of libraries which
are
linked with the application part. Lets assume we like to write an
application which is intended to toggle a led. The first thing you need
is an alarm which fires regulary and a task which does the actual
toggeling.
The implementation of such a task rather straight forward:
static byte led_state = 0;
TASK(ToggelLED) {
led_state = !led_state;
if(led_state)
led_on(1);
else
led_off(1);
TerminateTask();
}
This task need to be associated with an periodic alarm. This is done
by creating three entries in the system defintion file of the
application. The following definitions do specify a counter which is
associated with an alarm which activates the task ToggelLED.
COUNTER ledCounter {
MAXALLOWEDVALUE = 20;
TICKSPERBASE = 10;
} ;
ALARM ledAlarm {
COUNTER = ledCounter;
ACTION = ACTIVATETASK { TASK = ToggelLED; };
AUTOSTART = TRUE {
APPMODE = IOR5E;
};
} ;
The properties of the actual task need to be specified as well.
TASK ToggelLED {
PRIORITY = 1;
STACKSIZE = 96;
SCHEDULE = FULL;
AUTOSTART = FALSE;
};
Running the OIL compiler will provide the glue code needed to maintain
the counters and the provide the task.
After linking the image it is loaded into the micro controler using e.g. a bootloader.
The most simples way of getting started is to create a directory in the root directory of the mkernel installation and copy the Makefile and a sample testx.c into this directory from the ./samples directory.
The API available to applications is described in the include file kernel.h. It provides task managemant and communication function which allows an task to event on external events and to send events to other tasks.
The project uses the bootloader fsusb from Rick Luddy. This seems to work well with the SBC44UCR board i am using. I have added the source code to the svn tree even thought i don't expect any changes.
The following tools have been used:
|
Tool |
Description |
Linux |
Windows XP |
|
SDCC |
Small devices c compiler |
2.8.0 |
2.7.0 |
|
gputils |
GNU micor controler dev. package |
0.13.4 |
|
|
KDevelope |
Development environment |
|
Not applicable |
|
GNU Make |
GNU Tools |
|
|
|
Doxygen |
Documentation Generator |
1.4.6 |
|
|
fsusb |
Bootloader |
http://www.internetking.org/ |
|
The table below does summarize the contact points of the mkernel project.
|
Topic |
Description |
Responsible |
|---|---|---|
|
Home Page |
http://mkernel.sourceforge.net |
michael.erdman@snafu.de |
|
Technical Discussion |
|
|
The source code is can be downloaded from the download area or accessed via the subversion archive.
This project's SourceForge.net Subversion repository can be checked out through SVN with the following instruction set:
svn co https://mkernel.svn.sourceforge.net/svnroot/mkernel mkernel
Or you may directly browse the repository.
"The spirit of GNU" - Copyright (C) 1999,2000 Georg C. F. Greve Permission is granted to make and distribute verbatim copies of this transcript as long as the copyright and this permission notice appear.
“fsusb” - Copyright Author is Rick Luddy (GPG 1024D/98AA0510) <rickluddy@gmail.com>.
© 2007
Michael Erdmann - $Id$