From ErikaWiki

Jump to: navigation, search


temporary page as a skeleton for x86 support

x86 support

ERIKA Enterprise supports the x86 platforms. The support for RT-Druid is not yet available.

The x86 support includes:

  1. support for gcc and llvm/clang (>= v3.3) compiler toolchains;
  2. support for single and multi stack configurations;
  3. ISR Type 1 and Type 2 supported;
  4. support for gdb Debuggers via qemu debug stub.
  5. currently tested on emulated execution environment (qem-system-i386)
  • Supported IDEs:
    • RT-Druid IDE
  • Mode of operation:
    • Mono-stack: The Monostack configuration of the ERIKA Kernel models the fact that all tasks and ISRs in the system share the same stack.
    • Multi-stack: Every task can have its private stack, or it can share it with other tasks.

Download and install

RT-Druid and ERIKA Enterprise RTOS can be freely downloaded from the following web address:

Once downloaded, extract all the files contained in it and copy the folder named eclipse in your preferred directory on your PC (a recommended path is: C:\Evidence\). Now, launch the program by double-clicking on the executable eclipse.exeinside the C:\Evidence\eclipse folder and choose the path of your workspace. The workspace is the default working directory in which the projects will be created.

If you want to download only a selected revision of the kernel, open the Cygwin shell and get an anonymous SVN checkout typing this command:

 svn co svn://svn.tuxfamily.org/svnroot/erika/erikae/repos/ee/trunk/ee -r number_of_revision

Note: Cygwin can be downloaded from this web site: http://www.cygwin.com/. To use SVN, the Cygwin SVN package must to be installed using the Cygwin Setup utility.

How to run a simple demo on the Virtual Machine

Just enter an arbitrary EEtest0x folder in examples/x86/porting_examples/{monostack,multistack}>, and type make run to build and run the test case.

Target Configuration and Programming

Compiler Path

It is possible to choose the path of the compiler in three different ways:


CPU_DATA must be set to X86.
The exact model is specified with the MODEL item.
The compiler is specified with the COMPILER_TYPE item (TBD! supported values will be gcc and clang).
Example of a CPU_DATA section:

 CPU_DATA = X86 {
   APP_SRC = "code.c";

Interrupt Handling

To define each ISR an ISR object is needed to be added in the CPU object of the OSEK/VDX configuration:

   ENTRY = "<ENTRY>";

Where <ISR_TYPE> is the type of the ISR (1 or 2), <SYMBOL> is the symbol that must be the parameter of ISR<ISR_TYPE>() ISR signature, and <ENTRY> is the fixed Interrupt Vector Table Entry identifier.


The port is currently tested to to run in the qemu emulator (qemu-system-i386).

The toolchain builds an ELF file including a multiboot header. The resulting image can be booted from any multiboot compliant boot loader (e.g., grub2). The toolchain further generates a bootable CDROM image (using grub-mkrescue).

The resulting images can be run in qemu either from the cdrom image:
qemu-system-i386 -cdrom erika.iso -no-reboot -machine pc,accel=tcg -nographic

Or by direclty loading the elf image (using -kernel):
qemu-system-i386 -kernel Debug/Debug/out.elf -no-reboot -machine pc,accel=tcg -nographic

Please, don't forget the -machine pc,accel=tcg parameter, which disables the KVM based accelerations.

OSEK/VDX Extensions

This Section contains information about the OSEK/VDX Extensions (or optional features) that have been implemented for the ARM Cortex MX support. All of these features are not yet implemented in Cortex M0 (NXP LPCXpresso LPC12xx MCU) porting of ERIKA Enterprise.

Resource Managament at ISR level

This feauture is automatically enabled by RT-Druid during the configuration generation step. To specify that a Resource is used by both a Task and a ISR you need to add that respource to the corrisponding ISR object as follows:

 TASK Task1 {
   RESOURCE = "ResourceA";
   ENTRY = "<ENTRY>";
   RESOURCE = "ResourceA";

System Timer

The port uses the PIT timer for periodic interrupts. At the moment, the timer unit must initialised manually (EE_pit_init()), which sets up a default period of 1000 Hz.
The rate can be changed using EE_pit_set_periodic(EE_UINT16 rate_in_Hz). Please note: Due to hardware limitations, the minimal PIT rate is around 20 Hz.

A user-defined interrupt handler can then be realised, by providing a EE_pit_handler(void) function, which replaces an empty weakly linked default handler. See also the porting examples for more details.

The following configuration options not implemented yet:
The OSEK/VDX standard provides support for a System Counter (a counter that is automatically linked to hardware timers). The System Timer is used to give a coherent timing reference across the entire application.

In ERIKA Enterprise, this special counter has been named System Timer. To use it, you need to set a specific attribute in a Counter definition. Please note that only one counter can be the System Timer.

A Counter which is not a System Counter must be incremented manually using the primitive IncrementCounter.

The following is an example OIL definition for a System Counter:

  COUNTER SystemTimer {
   MINCYCLE = 1;
   MAXALLOWEDVALUE = 2147483647;
     DEVICE = "PIT";

The meaning of the various attributes is as follows:

  • COUNTER/TYPE must be set to "HARDWARE", and SYSTEM_TIMER must be set to true.
  • COUNTER/TYPE/DEVICE must be a valid device that can be used for a system timer. Currently, for X86 only "PIT" is a valid device for system timer.
  • SECONDSPERTICK is used to declare the wanted time duration of one hardware tick in seconds.

The System Timer can be attached to ALARMs as usual, as in the following example:

 ALARM AlarmExample {
   COUNTER = SystemTimer;
      TASK = TaskExample;


This port was provided by Martin Hoffmann from the Department of Computer Science 4 (System Software Group) at FAU Erlangen.

Personal tools