wiki:Projects/ARINC653UsingPOK

ARINC653 on RTEMS (using POK)

The goal of this project is to make RTEMS arinc653 compliant using the arinc653 implementation in POK. This means this is part of the RTEMS on POK project.

A lot of additional information can be found on this blog.

Source code can be found on this github.= Status =

At the end of GSoC2014 every pok arinc653 function can be called from the rtems application but only a few return an error code for successfully run. When running the one of each arinc653 subset the following table can be made:

{| class="wikitable" border="1"

! Arinc653 subset ! Works?

| Partition | yes

| Error | yes

| Process | yes

| Time | yes

| Blackboard | no

| Buffer | no

| Event | no

| Queueing | no

| Sampling | no

| Semaphore | no |}

A lot of arinc653 subsets that require any form of inter-process or inter-partition communication currently returns an error and needs debugging for a fix.

Including pok arinc653 calls to rtems

This chapter will explain how you could make available pok arinc653 functions to rtems applications.

A static library containing pok arinc653 calls

To allow rtems to call pok arinc653 calls we make use of static libraries. As it was prior to starting this project the contents of the static library created by pok called 'libpart.a' was already added to 'libbsp.a' which in turn is added to the build directory. Since the object files of the arinc653 calls and the underlying calls are automatically added to 'libpart.a' we have to make sure 'libpart.a' will have the arinc653 calls added to them.

According to the pok user manual (chapter 5) a set of configurations are necessary for arinc653. By default, if the Makefile located in $POK/examples/rtems-guest has an addition '--arinc653' argument added to the BUILD variable it will include the arinc653 partition, arinc653 time and arinc653 process calls to 'libpart.a'. This is because the '--arinc653' argument adds the proper configuration macros to the deployment.h header file. If additional arinc653 calls are to be added make sure to add appropriate macros to deployment.h within the partition folder of your project (e.g. $POK/examples/rtems-guest/generated-code/cpu/part1/deployment.h) and then use 'make all' on the makefile located in the generated-code folder. To make sure your calls are added use the 'nm' command on 'libpart.a'.

Adding header files for pok arinc653 to rtems

As all header files assume the inclusion stucture to be "INCLUDE_DIR/arinc653/*.h" this structure is kept in place for the arinc653 header files by configuration in Makefile.am. This makefile also makes sure that erroneous inclusion within the arinc653 header files are fixed (namely one in arinc653/types.h). It is assumed that the environment variable POK_PATH is set to the path of your pok folder. If all the arinc653 headers are included you can use the calls like calling functions from any other library. An example:

#define POK_NEEDS_ARINC653_PARTITION 1
#define POK_NEEDS_ARINC653_PROCESS 1

#include <bsp.h>
#include <stdio.h>
#include <stdlib.h>
#include <arinc653/types.h>
#include <arinc653/partition.h>

rtems_task Init(rtems_task_argument argument);

rtems_task Init(rtems_task_argument ignored)
{
    PARTITION_STATUS_TYPE partition_status;
    RETURN_CODE_TYPE ret;
    GET_PARTITION_STATUS(&partition_status, &ret);
    printf("ret after get partition:%d\n", ret);
    printf("OPERATING_MODE_TYPE:%d\n", partition_status.OPERATING_MODE);
    exit( 0 );
}

More POK calls

If there are functions from pok that are required to be called and are not in 'libpart.a' (e.g. they are added to 'libpok.a') you can use the same method to add the contents of 'libpok.a' to 'libbsp.a'. However, it should be noted that this might cause duplicates between object files in 'libpok.a' and in 'libpart.a' as they both might contain some of the same object files.

How to build

This guide will go through the steps that are necessary to get arinc653 calls from POK working on an RTEMS partition and to be able to run an example project that goes through at least one arinc653 call of each arinc653 subset (buffer, blackboard, partition, time, etc.).

Note: Make sure your environment can at least run the default "hello world" for RTEMS on POK (i.e. the patches for virtualpok are applied to your RTEMS directory).

  1. Apply the patches that can be retrieved from

https://github.com/JustJanek/GSOC_RTEMS_ARINC653/tree/master/patches

  • virtualpok_arinc653.patch is to be applied to $RTEMS/c/src/lib/libbsp/i386/virtualpok/
  • hello_init_c.patch is to be applied to $RTEMS/testsuites/samples/hello/init.c
  • libpok_rtems_arinc653.patch is to be applied to $POK/libpok
  • rtems-guest_rtems_arinc653.patch is to be applied to $POK/examples/rtems-guest
  1. Go to $POK/examples/rtems-guest and use the command 'make'. A new folder

named generated-code/ should either be added (if it wasn't there yet). Add the following macros to $POK/examples/rtems-guest/generated-code/cpu/part1/deployment.h

#define POK_CONFIG_NB_BLACKBOARDS 2
#define POK_CONFIG_NB_BUFFERS 2
#define POK_CONFIG_ARINC653_NB_SEMAPHORES 2
#define POK_CONFIG_NB_EVENTS 2
#define POK_CONFIG_ARINC653_NB_EVENTS 2
#define POK_NEEDS_BLACKBOARDS 1
#define POK_NEEDS_ARINC653_BLACKBOARD 1
#define POK_NEEDS_BUFFER 1
#define POK_NEEDS_ARINC653_BUFFER 1
#define POK_NEEDS_ARINC653_EVENT 1
#define POK_NEEDS_ARINC653_ERROR 1
#define POK_NEEDS_ARINC653_QUEUEING 1
#define POK_NEEDS_ARINC653_SAMPLING 1
#define POK_NEEDS_ARINC653_SEMAPHORE 1
  1. Go to $POK/examples/rtems-guest/generated-code and run the command 'make all'
  1. Copy-paste $POK/examples/rtems-guest/generated-code/cpu/part1/libpart.a to

$RTEMS/c/src/lib/libbsp/i386/virtualpok.

  1. Build RTEMS with the following configuration line:

--target=i386-rtems4.11 --enable-rtemsbsp=virtualpok --enable-paravirt --disable-cxx --disable-networking --disable-posix --enable-maintainter-mode --enable-tests --disable-multiprocessing USE_COM1_AS_CONSOLE=1 BSP_PRESS_KEY_FOR_RESET=0

For example:

mkdir pc386_arinc653
cd pc386_arinc653
$RTEMS/configure --target=i386-rtems4.11 --enable-rtemsbsp=virtualpok 
	--enable-paravirt --disable-cxx --disable-networking --disable-posix 
	--enable-maintainter-mode --enable-tests --disable-multiprocessing 
	USE_COM1_AS_CONSOLE=1 BSP_PRESS_KEY_FOR_RESET=0
  1. Copy-paste <build_dir>/i386-rtems4.11/c/virtualpok/testsuites/samples/hello/hello.exe

to $POK/examples/rtems-guest

  1. go to $POK/examples/rtems-guest and run "./copy_rebuild_kernel.sh hello.exe"
  1. If everything went well you can now run "make run" in $POK/examples/rtems-guest

and the arinc653 calls example will run.

TODO

  • Fix erroneous arinc653 calls (debugging)
Last modified on Aug 18, 2014 at 5:05:30 AM Last modified on Aug 18, 2014, 5:05:30 AM