[PATCH] arinc653 support for virtualpok bsp

Philipp Eppelt philipp.eppelt at mailbox.tu-dresden.de
Tue Sep 9 23:25:53 UTC 2014


Hi Janek,

I finally came around to review this patch. Can you make your own
testsuite/sample folder with the ARINC calls and not patch the hello/init.c?

Please fix all trailing whitespace errors in the patch.

virtualpok/Makefile.am produces an error at compile time:

cat libpart.list | rename 's/.lo/.o/g'
rename: not enough arguments

Usage:
 rename [options] expression replacement file...


Next error: This relative path for sed is broken in so far, that I don't
have any arinc653 files from POK in my build tree. Am I missing a step?

gmake[6]: Entering directory
`[..]/rtems/build/i386-rtems4.11/c/virtualpok/lib/libbsp/i386/virtualpok'
cp -u ../../../../../../../../c/src/lib/libbsp/i386/virtualpok/libpart.a .
ar t libpart.a > libpart.list
sed -e "s/\.lo/\.o/g" libpart.list > libpart.o.list
ar x libpart.a
rename .lo .o `cat libpart.list`
ar q libbsp.a `cat libpart.o.list`
sed -i '/#include <types.h>/d'
../../../../../../virtualpok/lib/include/arinc653/types.h
sed: can't read
../../../../../../virtualpok/lib/include/arinc653/types.h: No such file
or directory


Cheers,
Philipp

On 08/24/2014 03:26 AM, JustJanek wrote:
> ---
>  c/src/lib/libbsp/i386/virtualpok/Makefile.am       |  18 +-
>  c/src/lib/libbsp/i386/virtualpok/arinc653_readme   |  72 +++++++
>  .../lib/libbsp/i386/virtualpok/startup/bspstart.c  |   4 +-
>  testsuites/samples/hello/init.c                    | 210 ++++++++++++++++++++-
>  4 files changed, 297 insertions(+), 7 deletions(-)
>  create mode 100644 c/src/lib/libbsp/i386/virtualpok/arinc653_readme
> 
> diff --git a/c/src/lib/libbsp/i386/virtualpok/Makefile.am b/c/src/lib/libbsp/i386/virtualpok/Makefile.am
> index c65a002..c2e0b18 100644
> --- a/c/src/lib/libbsp/i386/virtualpok/Makefile.am
> +++ b/c/src/lib/libbsp/i386/virtualpok/Makefile.am
> @@ -6,6 +6,7 @@ include $(top_srcdir)/../../../../automake/compile.am
>  include $(top_srcdir)/../../bsp.am
>  
>  include_bspdir = $(includedir)/bsp
> +include_arinc653dir = $(includedir)/arinc653
>  
>  dist_project_lib_DATA = bsp_specs
>  
> @@ -19,6 +20,19 @@ nodist_include_bsp_HEADERS = ../../shared/include/bootcard.h
>  DISTCLEANFILES = include/bspopts.h
>  noinst_PROGRAMS =
>  
> +include_arinc653_HEADERS = $(POK_PATH)/libpok/include/arinc653/types.h
> +include_arinc653_HEADERS += $(POK_PATH)/libpok/include/arinc653/process.h
> +include_arinc653_HEADERS += $(POK_PATH)/libpok/include/arinc653/partition.h
> +include_arinc653_HEADERS += $(POK_PATH)/libpok/include/arinc653/blackboard.h
> +include_arinc653_HEADERS += $(POK_PATH)/libpok/include/arinc653/time.h
> +include_arinc653_HEADERS += $(POK_PATH)/libpok/include/arinc653/process.h
> +include_arinc653_HEADERS += $(POK_PATH)/libpok/include/arinc653/buffer.h
> +include_arinc653_HEADERS += $(POK_PATH)/libpok/include/arinc653/error.h
> +include_arinc653_HEADERS += $(POK_PATH)/libpok/include/arinc653/event.h
> +include_arinc653_HEADERS += $(POK_PATH)/libpok/include/arinc653/queueing.h
> +include_arinc653_HEADERS += $(POK_PATH)/libpok/include/arinc653/sampling.h
> +include_arinc653_HEADERS += $(POK_PATH)/libpok/include/arinc653/semaphore.h
> +
>  include_bsp_HEADERS  = irq/irq.h
>  include_bsp_HEADERS += ../../shared/include/irq-generic.h
>  #include_bsp_HEADERS  +=
> @@ -70,8 +84,10 @@ libpokpart.a :
>  	ar t libpart.a > libpart.list
>  	sed -e "s/\.lo/\.o/g" libpart.list > libpart.o.list
>  	ar x libpart.a
> -	rename .lo .o `cat libpart.list`
> +#	rename .lo .o `cat libpart.list`
> +	cat libpart.list | rename 's/.lo/.o/g'
>  	ar q libbsp.a `cat libpart.o.list`
> +	sed -i '/#include <types.h>/d' ../../../../../../virtualpok/lib/include/arinc653/types.h
>  #	ar cru libpokpart.a `cat libpart.o.list`
>  # rm `cat libpart.o.list` is optional as all files get overwritten with new
>  # ones by 'ar x'. But I think it's bad style to remove object files during
> diff --git a/c/src/lib/libbsp/i386/virtualpok/arinc653_readme b/c/src/lib/libbsp/i386/virtualpok/arinc653_readme
> new file mode 100644
> index 0000000..ac82873
> --- /dev/null
> +++ b/c/src/lib/libbsp/i386/virtualpok/arinc653_readme
> @@ -0,0 +1,72 @@
> +Guide to get POK's arinc653 calls working on RTEMS.
> +
> +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.). As this guide won't go into detail 
> +please refer to either the arinc653 wiki on RTEMS wiki 
> +(http://www.rtems.org/wiki/index.php/Main_Page) or to justjnk.blogspot.nl for
> +more details.
> +
> +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 patch arinc653 patch to your rtems environment and the 
> +pok patches to your pok environment.
> +
> +2. Go to $POK and make sure the POK_PATH environment variable is set to the folder
> +of your $POK directory.
> +
> +3. 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
> +Note: Compilation will most likely fail due to an error with 'C_dispatch_isr'. This
> +is okay, you can continue the steps of this guide.
> +
> +#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
> +
> +4. Go to $POK/examples/rtems-guest/generated-code and run the command 'make all'
> +Note: Similar to step 3, this will throw an error about 'C_dispatch_isr'. You can
> +continue the steps in this guide.
> +
> +5. Copy-paste $POK/examples/rtems-guest/generated-code/cpu/part1/libpart.a to
> +$RTEMS/c/src/lib/libbsp/i386/virtualpok.
> +
> +6. Use './bootstrap -p' at your rtems directory's root.
> +
> +7. 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
> +
> +8. Copy-paste <build_dir>/i386-rtems4.11/c/virtualpok/testsuites/samples/hello/hello.exe
> +to $POK/examples/rtems-guest
> +
> +9. go to $POK/examples/rtems-guest and run "./copy_rebuild_kernel.sh hello.exe"
> +
> +10. If everything went well you can now run "make run" in $POK/examples/rtems-guest
> +and the arinc653 calls example will run.
> diff --git a/c/src/lib/libbsp/i386/virtualpok/startup/bspstart.c b/c/src/lib/libbsp/i386/virtualpok/startup/bspstart.c
> index 3464ee0..6b0686e 100644
> --- a/c/src/lib/libbsp/i386/virtualpok/startup/bspstart.c
> +++ b/c/src/lib/libbsp/i386/virtualpok/startup/bspstart.c
> @@ -34,8 +34,8 @@ void bsp_start( void )
>    _BSP_Virtual_Char_write( "Hello RTEMS World\n" );
>  
>    // Initialize IRQ management
> -  rtems_irq_mngt_init();
> +  //rtems_irq_mngt_init();
>  
>    // Register clock driver
> -  Clock_driver_install_handler();
> +  //Clock_driver_install_handler();
>  }
> diff --git a/testsuites/samples/hello/init.c b/testsuites/samples/hello/init.c
> index d8fe450..de9329d 100644
> --- a/testsuites/samples/hello/init.c
> +++ b/testsuites/samples/hello/init.c
> @@ -11,15 +11,47 @@
>  #include "config.h"
>  #endif
>  
> +#define POK_NEEDS_ARINC653_PARTITION 1
> +#define POK_NEEDS_ARINC653_PROCESS 1
> +#define POK_NEEDS_ARINC653_TIME 1
> +#define POK_NEEDS_ARINC653_ERROR 1
> +#define POK_NEEDS_ARINC653_BLACKBOARD 1
> +#define POK_NEEDS_ARINC653_BUFFER 1
> +#define POK_NEEDS_ARINC653_EVENT 1
> +#define POK_NEEDS_ARINC653_SEMAPHORE 1
> +#define POK_NEEDS_ARINC653_SAMPLING 1
> +#define POK_NEEDS_ARINC653_QUEUEING 1
> +
>  #include <rtems/test.h>
>  
>  #include <bsp.h> /* for device driver prototypes */
>  
>  #include <stdio.h>
>  #include <stdlib.h>
> +#include <arinc653/types.h>
> +#include <arinc653/partition.h>
> +#include <arinc653/process.h>
> +#include <arinc653/time.h>
> +#include <arinc653/error.h>
> +#include <arinc653/blackboard.h>
> +#include <arinc653/buffer.h>
> +#include <arinc653/event.h>
> +#include <arinc653/semaphore.h>
> +#include <arinc653/sampling.h>
> +#include <arinc653/queueing.h>
>  
>  /* forward declarations to avoid warnings */
>  rtems_task Init(rtems_task_argument argument);
> +void arinc653_test_partition(void);
> +void arinc653_test_process(void);
> +void arinc653_test_time(void);
> +void arinc653_test_error(void);
> +void arinc653_test_blackboard(void);
> +void arinc653_test_buffer(void);
> +void arinc653_test_event(void);
> +void arinc653_test_semaphore(void);
> +void arinc653_test_sampling(void);
> +void arinc653_test_queueing(void);
>  
>  const char rtems_test_name[] = "HELLO WORLD";
>  
> @@ -27,12 +59,182 @@ rtems_task Init(
>    rtems_task_argument ignored
>  )
>  {
> -  rtems_test_begin();
> -  printf( "Hello World\n" );
> -  rtems_test_end();
> -  exit( 0 );
> +	arinc653_test_partition();
> +	arinc653_test_process();
> +	arinc653_test_time();
> +	arinc653_test_error();
> +	arinc653_test_blackboard();
> +	arinc653_test_buffer();
> +	arinc653_test_event();
> +	arinc653_test_semaphore();
> +	arinc653_test_sampling();
> +	arinc653_test_queueing();
> +	exit( 0 );
> +}
> +
> +void arinc653_test_partition()
> +{
> +	printf("arinc653_test_partition start\n");
> +	PARTITION_STATUS_TYPE 	partition_status;
> +	RETURN_CODE_TYPE 		ret;
> +
> +	GET_PARTITION_STATUS(&partition_status, &ret);
> +	
> +	printf("OPERATING_MODE_TYPE after GET_PARTITION_STATUS: %d\n", (int)partition_status.OPERATING_MODE);
> +	printf("Return after GET_PARTITION_STATUS: %d\n", (int)ret);
> +	printf("arinc653_test_partition stop\n\n");
> +}
> +
> +void arinc653_test_process()
> +{
> +	printf("arinc653_test_process start\n");
> +	PROCESS_ID_TYPE 	PROCESS_ID;
> +	RETURN_CODE_TYPE 	RETURN_CODE;
> +
> +	GET_MY_ID (
> +      /*out*/ &PROCESS_ID,
> +      /*out*/ &RETURN_CODE );
> +      
> +    printf("PROCESS_ID after GET_MY_ID: %d\n", (int)PROCESS_ID);  
> +	printf("RETURN_CODE after GET_MY_ID: %d\n", (int)RETURN_CODE);
> +	printf("arinc653_test_process stop\n\n");
> +}
> +      
> +void arinc653_test_time()
> +{
> +	printf("arinc653_test_time start\n");
> +	RETURN_CODE_TYPE return_code;
> +      
> +    PERIODIC_WAIT (
> +      /*out*/ &return_code );
> +       
> +	printf("return_code after PERIODIC_WAIT: %d\n", (int)return_code);
> +	printf("arinc653_test_time stop\n\n");
> +}
> +
> +void arinc653_test_error()
> +{
> +	printf("arinc653_test_error start\n");
> +	ERROR_STATUS_TYPE 	ERROR_STATUS;
> +	RETURN_CODE_TYPE  	RETURN_CODE;
> +	
> +	GET_ERROR_STATUS (&ERROR_STATUS,
> +                      &RETURN_CODE);
> +      
> +    printf("ERROR_STATUS.ERROR_CODE after GET_ERROR_STATUS: %d\n", (int)ERROR_STATUS.ERROR_CODE);  
> +	printf("RETURN_CODE after GET_ERROR_STATUS: %d\n", (int)RETURN_CODE);
> +	printf("arinc653_test_error stop\n\n");
>  }
>  
> +void arinc653_test_blackboard()
> +{
> +	printf("arinc653_test_blackboard start\n");
> +	BLACKBOARD_ID_TYPE  BLACKBOARD_ID;
> +	RETURN_CODE_TYPE  	RETURN_CODE;
> +	
> +	CREATE_BLACKBOARD ( 
> +       /*in */ "RTEMS_arinc_blackboard", 
> +       /*in */ 5, 
> +       /*out*/ &BLACKBOARD_ID, 
> +       /*out*/ &RETURN_CODE ); 
> +      
> +    printf("BLACKBOARD_ID after CREATE_BLACKBOARD: %d\n", (int)BLACKBOARD_ID);  
> +	printf("RETURN_CODE after CREATE_BLACKBOARD: %d\n", (int)RETURN_CODE);
> +	printf("arinc653_test_blackboard stop\n\n");
> +}
> +
> +void arinc653_test_buffer()
> +{
> +	printf("arinc653_test_buffer start\n");
> +	BUFFER_ID_TYPE      BUFFER_ID;
> +	RETURN_CODE_TYPE  	RETURN_CODE;
> +	
> +	CREATE_BUFFER ( 
> +       /*in */ "RTEMS_arinc_buffer",
> +       /*in */ 5,
> +       /*in */ 4,
> +       /*in */ FIFO,
> +       /*out*/ &BUFFER_ID,
> +       /*out*/ &RETURN_CODE );
> +      
> +    printf("BUFFER_ID after CREATE_BUFFER: %d\n", (int)BUFFER_ID);  
> +	printf("RETURN_CODE after CREATE_BUFFER: %d\n", (int)RETURN_CODE);
> +	printf("arinc653_test_buffer stop\n\n");
> +}
> +
> +void arinc653_test_event()
> +{
> +	printf("arinc653_test_event start\n");
> +	EVENT_ID_TYPE 		EVENT_ID;
> +	RETURN_CODE_TYPE  	RETURN_CODE;
> +	
> +	CREATE_EVENT (
> +      /*IN */ "RTEMS_arinc_event",
> +      /*OUT*/ &EVENT_ID,
> +      /*OUT*/ &RETURN_CODE );
> +      
> +    printf("EVENT_ID after CREATE_EVENT: %d\n", (int)EVENT_ID);  
> +	printf("RETURN_CODE after CREATE_EVENT: %d\n", (int)RETURN_CODE);
> +	printf("arinc653_test_event stop\n\n");
> +}
> +
> +void arinc653_test_semaphore()
> +{
> +	printf("arinc653_test_semaphore start\n");
> +	SEMAPHORE_ID_TYPE 	SEMAPHORE_ID;
> +	RETURN_CODE_TYPE  	RETURN_CODE;
> +	
> +	CREATE_SEMAPHORE (
> +      /*IN */ "RTEMS_arinc_sem",
> +      /*IN */ 1,
> +      /*IN */ 4,
> +      /*IN */ FIFO,
> +      /*OUT*/ &SEMAPHORE_ID,
> +      /*OUT*/ &RETURN_CODE );
> +      
> +    printf("SEMAPHORE_ID after CREATE_SEMAPHORE: %d\n", (int)SEMAPHORE_ID);  
> +	printf("RETURN_CODE after CREATE_SEMAPHORE: %d\n", (int)RETURN_CODE);
> +	printf("arinc653_test_semaphore stop\n\n");
> +}
> +
> +void arinc653_test_sampling()
> +{
> +	printf("arinc653_test_sampling start\n");
> +	SAMPLING_PORT_ID_TYPE 	SAMPLING_PORT_ID;
> +	RETURN_CODE_TYPE  		RETURN_CODE;
> +	
> +	CREATE_SAMPLING_PORT ( 
> +       /*in */ "RTEMS_arinc_sampling", 
> +       /*in */ 5, 
> +       /*in */ SOURCE, 
> +       /*in */ 5000, 
> +       /*out*/ &SAMPLING_PORT_ID, 
> +       /*out*/ &RETURN_CODE );
> +      
> +    printf("SAMPLING_PORT_ID after CREATE_SAMPLING_PORT: %d\n", (int)SAMPLING_PORT_ID);  
> +	printf("RETURN_CODE after CREATE_SAMPLING_PORT: %d\n", (int)RETURN_CODE);
> +	printf("arinc653_test_sampling stop\n\n");
> +}
> +
> +void arinc653_test_queueing()
> +{
> +	printf("arinc653_test_queueing start\n");
> +	QUEUING_PORT_ID_TYPE 	QUEUING_PORT_ID;
> +	RETURN_CODE_TYPE  		RETURN_CODE;
> +	
> +	CREATE_QUEUING_PORT (
> +      /*in */ "RTEMS_arinc_queueing",
> +      /*in */ 5,
> +      /*in */ 3,
> +      /*in */ SOURCE,
> +      /*in */ FIFO,
> +      /*out*/ &QUEUING_PORT_ID,
> +      /*out*/ &RETURN_CODE );
> +      
> +    printf("QUEUING_PORT_ID after CREATE_QUEUING_PORT: %d\n", (int)QUEUING_PORT_ID);  
> +	printf("RETURN_CODE after CREATE_QUEUING_PORT: %d\n", (int)RETURN_CODE);
> +	printf("arinc653_test_queueing stop\n\n");
> +}
>  
>  /* NOTICE: the clock driver is explicitly disabled */
>  #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
> 


More information about the devel mailing list