Re: [pok-devel] Problem while developping a ARINC653 system for POK without AADL

[ Thread Index | Date Index | More lists.tuxfamily.org/pok-devel Archives ]


Hi,

Have you tried attaching gdb? You could easily get where the exception
comes from.

On Wed, Jan 25, 2012 at 11:56 PM, Julien Savard
<julien.savard@xxxxxxxxxx> wrote:
>
> Hello,
>
> I am currently trying an experiment to port a very simple ARINC 653 system of 4
> partitions originally running on ARINC 653 system simulator "SIMA" to a POK
> environment. My guess was that considering ARINC 653's portability, an
> application running on SIMA could easily run on POK (after small modifications
> of course).
>
> Since I am not using any AADL model, but instead, an ARINC 653 XML file
> describing the system (that is the configuration method under the simulator
> SIMA), I used your tool: "misc/arinc653-xml-conf.pl" for the generation of the
> deployment.h/.c kernel configuration. After some work, the system is now
> building itself successfully.
>
> However, during launch, after QEMU boots the kernel, instead of receiving
> outputs of my different partitions on the console screen, I receive a flood of
> the following error messages:
>
> ********************************************************************************
> [KERNEL] Raise exception invalid opcode fault current thread=X
> [KERNEL] [WARNING] Error 13 raised by partition Y but no error recovery was set
> ********************************************************************************
>
> or
>
> ********************************************************************************
> [KERNEL] Raise exception general protection fault current thread=X
> [KERNEL] [WARNING] Error 13 raised by partition Y but no error recovery was set
> ********************************************************************************
>
> Where 'X' are thread IDs: 0, 4, 8 and 11
> and where 'Y' are partition IDs: 0, 1, 2 and 3
>
> After a lot of search, I fail to understand which part of my code is generating
> such errors. Just in case some of you have seen this problem before, I am
> sharing this with you!
>
> Below, I am including the configuration file of the kernel:
> "kernel/deployment.h", and of one of my partition: "client/deployment.h". You
> will also find the source code of that partition at the end. Most of my
> partitions are alike, and all of them generates the error message, so I don't
> think you need all of it.
>
>
> Thanks for your time (the mail was long!).
>
> Julien Savard
>
> ********************************************************************************
> $POK_PATH/examples/arinc653-sima/not-generated-code/cpu/kernel/deployment..h
> ********************************************************************************
> #ifndef __POK_ARINC653_GENERATED_CONFIGURATION_H__
> #define __POK_ARINC653_GENERATED_CONFIGURATION_H__
> #include <core/schedvalues.h>
>
> #define POK_NEEDS_CONSOLE 1
> #define POK_NEEDS_ERROR_HANDLING 1
> #define POK_NEEDS_DEBUG 1
> #define POK_GENERATED_CODE 0
> #define POK_NEEDS_GETTICK 1
> #define POK_NEEDS_SCHED   1
> #define POK_NEEDS_THREADS 1
> #define POK_CONFIG_NB_THREADS   16
> #define POK_CONFIG_PARTITIONS_NTHREADS  {4,4,3,3} //-- Order of partitions:
> serveur1, serveur2, serveur3, client
> #define POK_NEEDS_PARTITIONS   1
> #define POK_CONFIG_NB_PARTITIONS   4
> #define POK_CONFIG_PARTITIONS_SIZE   {0,0,0,0}
> #define POK_NEEDS_SCHED_RR 1
> #define POK_CONFIG_PARTITIONS_SCHEDULER
> {POK_SCHED_RR,POK_SCHED_RR,POK_SCHED_RR,POK_SCHED_RR}
> #define POK_CONFIG_SCHEDULING_MAJOR_FRAME 1333
> #define POK_CONFIG_SCHEDULING_NBSLOTS 4
> #define POK_CONFIG_SCHEDULING_SLOTS {333,333,333,333}
> #define POK_CONFIG_SCHEDULING_SLOTS_ALLOCATION {3,2,1,0}
> #define POK_NEEDS_PORTS_QUEUEING 1
> #define POK_NEEDS_PORTS_SAMPLING 1
> #define POK_CONFIG_NB_PORTS          8
> #define POK_CONFIG_NB_GLOBAL_PORTS   8
>
> typedef enum {
>   DEUX_global=-1,
>   TROIS_global=-1,
>   QUATRE_global=-1,
>   CINQ_global=-1,
>   SIX_global=-1,
>   UN_global=-1,
>   ECH_UN_global=-1,
>   ECH_DEUX_global=-1
> } pok_port_identifier_t;
>
> typedef enum {
>   DEUX=0,
>   TROIS=1,
>   QUATRE=2,
>   CINQ=3,
>   SIX=4,
>   UN=5,
>   ECH_UN=6,
>   ECH_DEUX=7,
>   invalid_local_port = 8
> } pok_port_local_identifier_t;
>
> #define POK_CONFIG_PARTITIONS_PORTS {2,2,3,1}
>
> #endif
> ********************************************************************************
> ********************************************************************************
>
>
> ********************************************************************************
> $POK_PATH/examples/arinc653-sima/not-generated-code/cpu/client/deployment..h
> ********************************************************************************
> #ifndef __DEPLOYMENT_H_
> #define __DEPLOYMENT_H_
>
> #define POK_NEEDS_THREADS 1
> #define POK_GENERATED_CODE 0
> #define POK_NEEDS_ERROR_HANDLING 1
> #define POK_NEEDS_ALLOCATOR 1
> #define POK_NEEDS_CONSOLE 1
> #define POK_CONFIG_NB_THREADS 3
> #define POK_CONFIG_STACKS_SIZE 8192
> #define POK_NEEDS_ARINC653_TIME 1
> #define POK_NEEDS_ARINC653_QUEUEING 1
> #define POK_NEEDS_ARINC653_SAMPLING 1
> #define POK_NEEDS_PORTS_SAMPLING 1
> #define POK_NEEDS_QUEUEING_PORTS 1
> #define POK_NEEDS_ARINC653_PROCESS 1
> #define POK_NEEDS_ARINC653_ERROR 1
> #define POK_NEEDS_ARINC653_PARTITION 1
> #define POK_USE_GENERATED_ERROR_HANDLER 1
>
> #endif
> ********************************************************************************
> ********************************************************************************
>
> ********************************************************************************
> $POK_PATH/examples/arinc653-sima/not-generated-code/cpu/client/main.c
> ********************************************************************************
> #include <types.h>
> #include <libc/string.h>
> #include <libc/stdio.h>
> #include <libc/stdlib.h>
>
> #include <arinc653/types.h>
> #include "deployment.h"
> #include <arinc653/sampling.h>
> #include <arinc653/process.h>
> #include <arinc653/error.h>
> #include <arinc653/partition.h>
> #include <arinc653/time.h>
>
> #include <core/error.h>
> #include <core/thread.h>
> #include <core/partition.h>
>
> SYSTEM_TIME_TYPE WAIT_INTERVAL = 1333;
>
> void pok_error_handler_worker ()
> {
>
>  ERROR_STATUS_TYPE error_status;
>  RETURN_CODE_TYPE ret;
>
>  while (1)
>  {
>    STOP_SELF ();
>    GET_ERROR_STATUS (&(error_status), &(ret));
>    switch (error_status.FAILED_PROCESS_ID)
>    {
>      case 1:
>      {
>        switch (error_status.ERROR_CODE)
>        {
>          case DEADLINE_MISSED:
>          {
>            pok_thread_restart (1);
>
>            break;
>          }
>          case APPLICATION_ERROR:
>          {
>            pok_error_ignore (APPLICATION_ERROR, 1);
>
>            break;
>          }
>          case NUMERIC_ERROR:
>          {
>            pok_partition_set_mode (POK_PARTITION_MODE_INIT_WARM);
>
>            break;
>          }
>          case ILLEGAL_REQUEST:
>          {
>            pok_partition_set_mode (POK_PARTITION_MODE_STOPPED);
>
>            break;
>          }
>          case POWER_FAIL:
>          {
>            pok_error_ignore (POWER_FAIL, 1);
>
>            break;
>          }
>          case MEMORY_VIOLATION:
>          {
>            pok_thread_restart (1);
>
>            break;
>          }
>          case HARDWARE_FAULT:
>          {
>            pok_thread_restart (1);
>
>            break;
>          }
>          case STACK_OVERFLOW:
>          {
>            pok_thread_restart (1);
>
>            break;
>          }
>        }
>
>        break;
>      }
>    }
>  }
> }
>
> void* expediteur()
> {
>        RETURN_CODE_TYPE rc;
>        QUEUING_PORT_ID_TYPE file;
>        char msg[1025];
>        MESSAGE_SIZE_TYPE taille;
>        int i = 0;
>
>        int k=0;
>        for(k=0; k<1025; k++){
>                msg[k] = 0;
>        }
>
>        GET_QUEUING_PORT_ID("UN", &file, &rc);
>        if (rc != NO_ERROR) {
>                printf("Ne peut recevoir le QUEUING PORT ID: %d\n", rc);
>        }
>
>        while(1) {
>                strcpy(msg, "Ceci est le message non-numerote");
>                taille =  strlen(msg);
>
>                printf("Envoie de '%s'\n", msg);
>                SEND_QUEUING_MESSAGE(
>                        file,
>                        (MESSAGE_ADDR_TYPE)msg,
>                        taille,
>                        INFINITE_TIME_VALUE,
>                        &rc);
>
>                if (rc != NO_ERROR) {
>                        printf("Ne peut envoyer le message: %d, %d, %lld\n",
>                                        rc, (int)file, INFINITE_TIME_VALUE);
>                        break;
>                }
>
>                TIMED_WAIT(WAIT_INTERVAL, &rc);
>
>                if (rc != NO_ERROR) {
>                        printf("Ne peut attendre: %i\n", rc);
>                        break;
>                }
>        }
> }
>
> int main ()
> {
>        PROCESS_ATTRIBUTE_TYPE atts;
>        RETURN_CODE_TYPE rc;
>        PROCESS_ID_TYPE id1;
>        QUEUING_PORT_ID_TYPE file;
>
>        atts.PERIOD = 1333;
>        atts.TIME_CAPACITY = INFINITE_TIME_VALUE;
>        atts.ENTRY_POINT = expediteur;
>        atts.STACK_SIZE = 1500;
>        atts.BASE_PRIORITY = 10;
>        atts.DEADLINE = SOFT;
>
>        strcpy(atts.NAME, "UN");
>
>        CREATE_PROCESS(&atts, &id1, &rc);
>        if (rc != NO_ERROR) {
>                printf("N'a pas pu creer la tache '%s': %d\n", atts.NAME, rc);
>        }
>
>        START(id1, &rc);
>        if (rc != NO_ERROR) {
>                printf("N'a pas pu demarrer la tache %ld: %d\n", id1, rc);
>        }
>
>        CREATE_ERROR_HANDLER (pok_error_handler_worker, 8192, &rc);
>
>        CREATE_QUEUING_PORT("UN", 1024, 32, SOURCE, FIFO, &file, &rc);
>        if (rc != NO_ERROR) {
>                printf("N'a pas pu creer le port de file d'attente: %d\n", rc);
>        }
>
>        SET_PARTITION_MODE(NORMAL, &rc);
>        if (rc != NO_ERROR) {
>                printf("N'a pas pu passer en mode NORMAL: %d\n", rc);
>        }
>
>        return NO_ERROR;
> }
>
> ********************************************************************************
> ********************************************************************************
>
>
>



-- 
Laurent Lec



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/