polyorb-hi-c_ug.texi 68.2 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
\input texinfo @c -*-texinfo-*-

@c %**start of header

@c oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
@c
@c                                Style Guide
@c
@c  1. Always put a @noindent on the line before the first paragraph
@c     after any of these commands:
@c
@c          @chapter
@c          @section
@c          @subsection
@c          @subsubsection
@c          @subsubsubsection
@c
@c          @end smallexample
@c          @end itemize
@c          @end enumerate
@c
@c  2. DO NOT use @example. Use @smallexample instead.
@c     a) DO NOT use highlighting commands (@b{}, @i{}) inside an @smallexample
@c        context.  These can interfere with the readability of the texi
@c        source file.  Instead, use one of the following annotated
@c        @smallexample commands, and preprocess the texi file with the
@c        gentexifile tool (which generates appropriate highlighting):
@c        @smallexample @c ada
@c        @smallexample @c adanocomment
@c        @smallexample @c projectfile
@c     b) The "@c ada" markup will result in boldface for reserved words
@c        and italics for comments
@c     c) The "@c adanocomment" markup will result only in boldface for
@c        reserved words (comments are left alone)
@c     d) The "@c projectfile" markup is like "@c ada" except that the set
@c        of reserved words include the new reserved words for project files
@c
@c  3. Each @chapter, @section, @subsection, @subsubsection, etc.
@c     command must be preceded by two empty lines
@c
@c  4. The @item command should be on a line of its own if it is in an
@c     @itemize or @enumerate command.
@c
@c  5. DO NOT put trailing spaces at the end of a line.  Such spaces will
@c     cause the document build to fail.
@c
@c  6. DO NOT use @cartouche for examples that are longer than around 10 lines.
@c     This command inhibits page breaks, so long examples in a @cartouche can
@c     lead to large, ugly patches of empty space on a page.
@c
@c  7. To add an entry to the bibliography, you must:
@c     * add it to polyorb-hi_ug.bib
@c     This will generate the correct polyorb-hi_ug_ref.texi file
@c     You may then cite the correct reference.
@c
@c oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo

@c $Id: polyorb-hi_ug.texi 419 2007-07-06 09:36:55Z zalila $

@include version.texi

@setfilename polyorb-hi-c_ug.info
@settitle PolyORB-HI-C User's Guide

@setchapternewpage odd
@syncodeindex fn cp

@c %**end of header

@c description and copyright
@copying
Copyright @copyright{} 2007-2009, @'Ecole nationale sup@'erieure des
t@'el@'communications

@noindent
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``GNU Free Documentation License'', with the
Front-Cover Texts being ``PolyORB High Integrity C User's Guide'', and
with no Back-Cover Texts.  A copy of the license is included in the
section entitled ``GNU Free Documentation License''.
@end copying

@titlepage

@title PolyORB High Integrity User's Guide
@subtitle C Edition
@subtitle Version @value{EDITION}
@subtitle Date: @value{UPDATED}
@author Julien Delange, J@'er@^ome Hugues
@page
@vskip 0pt plus 1filll
@end titlepage

@iftex
@contents
@end iftex

@c top node

@ifnottex
@node Top, About This Guide, (dir), (dir)
@top PolyORB High Integrity User's Guide
@insertcopying
@end ifnottex

@menu
* About This Guide:: 
* Introduction to PolyORB-HI-C:: 
* Configuration:: 
* Building a system:: 
* Supported features:: 
* AADL to C transformations:: 
* PolyORB-HI-C API:: 
* Porting PolyORB-HI-C to another architecture:: 
* References:: 
* GNU Free Documentation License:: 
* The Index::

@detailmenu
 --- The Detailed Node Listing ---

About This Guide

* What This Guide Contains::    
* Conventions::                 

Configuration

* Supported Platforms::         
* Tree structure::              
* Build requirements::          
* Configuration instructions::  
* Build instructions::          

Building a system

* Building examples::           
* Building a new system::       

142
143
144
145
146
147
148
Porting PolyORB-HI-C to another architecture
* POSIX compliance::
* Architecture-dependent files::
* Declare a new supported system::
* Define the compilation process::
* Device Drivers::

149
150
151
152
153
Supported features

* C constructions and restrictions::  
* AADL features::       

154

155
156
157
158
159
160
161
162
163
AADL to C transformations

* Whole distributed application::  
* Distributed application nodes::  
* Hosts::                       
* Threads::                     
* Connections::                 
* Subprograms::                 
* Data::                        
164
* Devices::
165
166
167
168
169
170
171
172

PolyORB-HI-C API

* Tasking functions::           
* Time functions::              
* Marshallers functions::       
* GIOP functions::              
* Messages functions::          
173
@c * Protocols functions::         
174
175
176
177
* Transport functions::         
* Protected types functions::   
* Global queue functions::      
* Types used in PolyORB-HI-C::  
178

179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303

@end detailmenu
@end menu

@ifhtml
@center @code{$LastChangedDate: 2009-07-24 16:59:59 +0200 (Fri, 24 Jul 2009) $}
@end ifhtml

@c -------------------------------------------------------------------

@contents

@c -------------------------------------------------------------------
@node About This Guide
@unnumbered About This Guide
@c -------------------------------------------------------------------

@noindent
This document describes PolyORB High-Integrity C (PolyORB-HI-C), a
reduced version of the PolyORB schizophrenic middleware
(@url{http://libre.adacore/com/polyorb}) for High-Integrity systems.

There are two versions of PolyORB High Integrity. The first, written
in Ada is called PolyORB-HI-Ada, and the other, written in C, is
called PolyORB-HI-C.  The following manual focuses on PolyORB-HI-C.

@menu
* What This Guide Contains::    
* Conventions::                 
@end menu

@c -------------------------------------------------------------------
@node What This Guide Contains
@unnumberedsec What This Guide Contains
@c -------------------------------------------------------------------

@noindent
This guide contains the following chapters:
@itemize @bullet

@item @ref{Introduction to PolyORB-HI-C} provides a brief description of
middleware and PolyORB-HI-C's architecture.

@item @ref{Configuration} details how to configure PolyORB-HI-C.

@item @ref{Building a system} details how to build a distributed
system from its AADL description.

@item @ref{Supported features} details the features that are available
in PolyORB-HI-C,as well as the restrictions on the language it follows.

@item @ref{AADL to C transformations} details the mapping rules to
map an AADL model onto a High-Integrity Distributed System.

@item @ref{PolyORB-HI-C API} provides an overview of PolyORB-HI-C API.

@item @ref{References} provides a list of useful references to
complete this documentation.

@item
@ref{GNU Free Documentation License} contains the text of the license
under which this document is being distributed.
@end itemize

@c -------------------------------------------------------------------
@c generic typographical conventions
@include conventions.texi
@c -------------------------------------------------------------------

@c -------------------------------------------------------------------
@node Introduction to PolyORB-HI-C
@chapter Introduction to PolyORB-HI-C
@cindex PolyORB-HI-C
@c -------------------------------------------------------------------

@noindent
PolyORB-HI-C is a middleware for High-Integrity Systems, it inherits
most concepts of the schizophrenic middleware @i{PolyORB} while being
based on a complete new source code base, compatible with the
Ravenscar profile and the restrictions for High-Integrity systems.

In order to ease the construction of Distributed High-Integrity
Systems, PolyORB-HI-C relies on the AADL language and the Ocarina
toolsuite (@cite{[VZH06]}) to allocate all required ressources and
generate stubs, skeletons, marshallers and concurrent structures.

Ocarina/PolyORB-HI-C supports both AADLv1 and AADLv2 as input models.

This manual describes the different elements parts of PolyORB-HI-C.

@c -------------------------------------------------------------------
@node Configuration
@chapter Configuration
@c -------------------------------------------------------------------

@menu
* Supported Platforms::         
* Tree structure::              
* Build requirements::          
* Configuration instructions::  
* Build instructions::          
@end menu

@c -------------------------------------------------------------------
@node Supported Platforms
@section Supported Platforms
@c -------------------------------------------------------------------

@noindent
PolyORB-HI-C has been compiled and sucessfully tested on 

@itemize @bullet
@item native platforms

@itemize @bullet
@item Linux
@item Mac OS X
@item Solaris
@item FreeBSD
@item Windows
@end itemize

@item embedded platforms
@itemize @bullet
@item RTLinx, using Elinos
julien.delange's avatar
julien.delange committed
304
@item Linux embedded, specific version for the TASTE toolset.
305
306
307
308
309
310
311
@item Nintendo DS (tm) (Linux) - see http://www.dslinux.org
@item Nokia 770 (Linux) - see http://www.maemo.org
@item LEON (SPARC-like CPU) (RTEMS)
@item Spif (PowerPC CPU) (RTEMS) - see http://www.enst.fr/~spif/
@end itemize
@end itemize

julien.delange's avatar
julien.delange committed
312
313
314
315
316
317
318

When you are using RTEMS operating system, you have to define the @code{RTEMS_MAKEFILE_PATH} environment variable. This variable must point to the directory
that contains the @code{Makefile.inc} file relevant to your platform. In a similar way, when you are using the linux distribution specific to @emph{TASTE}, you have to 
set the variable @code{LINUXTASTE_PATH}. This variable should point to the directory where the linux-specific distribution was built. To be sure that
the variable is well defined, you can check that the directory @code{$LINUXTASTE_PATH/output/staging/usr/bin/} exists and that the @code{$LINUXTASTE_PATH/output/staging/usr/bin/i386-linux-gcc}
file exists and is executable (it corresponds to the cross-compiler for this distribution).

319
320
@noindent
@emph{Note: PolyORB-HI-C should compile and run on every
321
POSIX-compliant system.}
322

julien.delange's avatar
julien.delange committed
323
324


325
326
327
328
329
330
331
332
333
334
335
336
337
@c -------------------------------------------------------------------
@node Tree structure
@section Tree structure
@c -------------------------------------------------------------------

@noindent
PolyORB-HI-C has the following tree structure:

@itemize @bullet
@item @file{doc/}: documentation,
@item @file{examples/}: set of examples to test PolyORB-HI-C
@item @file{share/}: common files (aadl files used by Ocarina, makefiles, ...)
@item @file{src/}: core of PolyORB-HI
338
@item @file{src/drivers}: device drivers supported by PolyORB-HI-C
339
340
341
342
343
344
345
@item @file{tools/}: some script to handle the packaging and a verification
tool to check if the binaries are compliant with the POSIX restrictions.
@item @file{ChangeLog}: release information,
@item @file{COPYING}: GPLv2 licence document,
@item @file{README}: short description of the distribution.
@end itemize

346
When installed with Ocarina, in @file{$OCARINA_PATH} directory (you can use the @file{ocarina-config --prefix} command to get the installation directory).
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364

@itemize @bullet
@item docutmentation is in @file{$OCARINA_PATH/share/doc/ocarina};
@item examples are in @file{$OCARINA_PATH/examples/ocarina/polyorb-hi-c/}: 
set of examples to test PolyORB-HI-C
@item runtime files are in 
@file{$OCARINA_PATH/include/ocarina/runtime/polyorb-hi-c/}.
@end itemize

@c -------------------------------------------------------------------
@node Build requirements
@section Build requirements
@c -------------------------------------------------------------------

@noindent
To be compiled, PolyORB-HI-C requires the following tools:

@itemize @bullet
365
366
367
@item a C compiler that produces binaries for the target architecture. If you are running applications
on topof Linux, a regular gcc installation should be sufficient (packages provided by most Linux distributions
would be sufficient). If you are trying to compile for another architecture, you would need a cross-compiler tool.
368
369

@item a  standard C-library, for common functions like @code{socket()} or
370
@code{pthread_create()}.
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
@end itemize

@i{Note: For each tested bare board, the toolchains provides Makefiles
to configure additional environment variables}

PolyORB-HI-C also relies on AADL-to-C code generation provided by
Ocarina. Therefore, it is important to select a version of Ocarina
that is compatible with this version of PolyORB-HI-C. Whenever
possible, pick a unified archive that contains both tools.

@c -------------------------------------------------------------------
@node Configuration instructions
@section Configuration instructions
@c -------------------------------------------------------------------

@noindent
387
To install PolyORB-HI-C, please observe the following steps:
388
389
390
391
392
393
394
395
396
397
398

@itemize
@item 
Install your C compiler and Ocarina as specified by their respective
documentations and make sure their 'bin/' installation directories are
located at the top of your PATH environment variable.

@item 
Issue @code{./configure}. The @code{configure} script can take several
options: issue @code{./configure --help} to have a quick overview of
them. For examples. @code{./configure --enable-debug} will configure
jdelange's avatar
jdelange committed
399
400
401
the software to be built with all debug options (mainly additional output).  
Also @code{./configure --enable-lua} will enable the LUA scripting engine
within PolyORB-HI-C. At the end of the
402
403
404
405
configuration process, a file with all parameters is created
(@file{include/po_hi_config.h}. If this file is not created, the
compilation is not possible.

jdelange's avatar
jdelange committed
406
407
408
For having all the configuration options, you can invoke the @code{configure}
script with the @code{--help} switch : @code{./configure --help}.

409
410
411
412
413
414
415
416
417
418
419
420
@item Issue @code{make && make install}
@end itemize

@subsection Examples of configuration

@subsubsection Configure the framework for the LEON platform (case of cross-compilation)

In this example, we want configure the framework for the LEON platform
and the RTEMS operating system. The LEON architecture is similar to
the SPARC. In other words, we have to use a compiler that is different
from the one used to compile native binaries. In our case, the
compiler is called @code{sparc-rtems-gcc}. Consequently, the host name
421
will be @code{sparc-rtems}. 
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522

@noindent
@emph{Note: If you use RTEMS, you have to define the
@code{RTEMS_MAKEFILE_PATH} as RTEMS documentation describe
it. Generally, you have to follow all instructions that are described
with the system you will use.}


@c -------------------------------------------------------------------
@node Build instructions
@section Build instructions
@c -------------------------------------------------------------------

@noindent
PolyORB-HI-C must be installed correctly in order to be able to build
examples.

To compile all examples, simply issue @code{make examples} from the
main source directory. To clean the examples, issue @code{make
clean-examples} from the main source directory.

The examples may be built with the debug information. This is the
default behavior of the @code{make examples} command. If the user
wants to make the examples without any debug information and any GNAT
check, he should use the @code{make examples 'BUILD=Release'} command
instead. The footprint of the generated executable will be reduced
considerably.

Each example uses a makefile.

For each example, a makefile is provided with the following rules:

@itemize @bullet
@item 
@code{build-all}: generate code from the example and compile it;

@item 
@code{clean}: clean all generated files;

@end itemize

@c -------------------------------------------------------------------
@node Building a system
@chapter Building a system
@c -------------------------------------------------------------------

@noindent
In this chapter, we discuss the construction of an application, using
PolyORB-HI-C and an AADL model of the application.

@menu
* Building examples::           
* Building a new system::       
@end menu

@c -------------------------------------------------------------------
@node Building examples
@section Building examples
@c -------------------------------------------------------------------

Each example provide a makefile that does the following steps:

@enumerate
@item parse the AADL model;
@item generate C code from the AADL model;
@item compile each node
@end enumerate

PolyORB-HI-C comes with different examples and configurations, please
refer to @file{examples/README} and subsequent documentation files for
more details.

@c -------------------------------------------------------------------
@node Building a new system
@section Building a new system
@c -------------------------------------------------------------------

To build your own system, you have two choices: using a scenario file
or the command line.

@itemize @bullet
@item To use a scenario file, please follow these instructions

@enumerate
@item build a scenario file, a scenario file is an AADL file containing a
system describing your applications (AADL files, code generator that
has to be used, needed Ocarina non-standard property sets:
@include scenario_sample.texi

@item issue the command @code{ocarina -b -x <scenario-file>}

@end enumerate

@item To use command line, please follow these instructions
@enumerate
@item issue the command @code{ocarina -g polyorb_hi_c <list-of-aadl-files>}
@end enumerate

@end itemize

@noindent
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
For a list of ALL supported flags, please refere to the @i{Ocarina User's
Guide}. There are some PolyORB-HI-C specific flags :

@enumerate

@item @b{-perf} : enable performance traces. Using this flag, PolyORB-HI-C will execute
your application during a fixed amount of time and then, produce a performance analysis 
(indicating the Worst-Case Execution Time (WCET) and call traces (which functions was executed and when).

@end enumerate


@c -------------------------------------------------------------------
@node Porting PolyORB-HI-C to another architecture
@chapter Porting PolyORB-HI-C to another architecture
@c -------------------------------------------------------------------

@menu
* POSIX compliance::
* Architecture-dependent files::
* Declare a new supported system::
* Define the compilation process::
* Device Drivers::
@end menu

This section gives some hints to help the developer to port
PolyORB-HI-C. We will give the name of the files you need to change
and what part of them should be modified to support new architectures
and operating systems.

@node POSIX compliance
@section POSIX compliance

PolyORB-HI-C is POSIX compliant. It means that all the functions used
in the framework should be available if your operating system is POSIX
compliant. Even this compliance, you will probably need to make some
changes and for each new architecture or operating system, you have to
create a specific Makefile, as described in the thrid section.

@node Architecture-dependent files
@section Architecture-dependent files

If you need to port the framework on another architecture, some files
don't need to be changed. Porting efforts will be focused on the
following files :

@itemize @bullet
@item @code{po_hi_task.c} : Create tasks and handle their properties
(period, priority, ...). At this time, this file contains only POSIX
calls to create and manage thread.
  
@item @code{po_hi_time.c} : Handle time and provide some functions to wait
until an absolute time. The functions defined in this file make calls
to POSIX functions like @code{clock_gettime()}.
  
@item @code{po_hi_transport_sockets.c} : All the functions defined in this
file are used to send or receive data through sockets. It creates a
task to receive data and put them on a stack. All the functions made
calls to POSIX-compliant functions like @code{socket()}, @code{listen}
or @code{bind}.
@end itemize


@node Declare a new supported system
@section Declare a new supported system

In all files that contain architecture-dependent, we need to split
code for each system. We make it with MACCRO and include the code for
the used architecture when we compile it. At this time, two systems
are supported : @code{POSIX} and @code{RTEMS_POSIX}. Even if RTEMS use
the POSIX implementation, there are some differences between that
needs to declare another system.

If you want to support a new architecture, you need to declare a new
maccro which will be used to differenciate the code for your
architecture from other parts of the code. Then, this maccro will be
included in the @code{CFLAGS} variable in the Makefile created for
your architecture.

@node Define the compilation process
@section Define the compilation process

Each architecture has its own Makefile. It is used to define the
compiler name, the linker name and some maccros to compile the code
with a specific architecture.

All Makefiles are stored in the @code{share/make} directory. Each
Makefile follow the following naming rule :
@code{Makefile.arch.ostype}. For example, the Makefile created for the
LEON architecture with the RTEMS OS has the name
@code{Makefile.leon.rtems}. You need to create a Makefile with name
that follow the naming rule and fill it with the rights @code{CFLAGS}
and @code{CC} for the sytem you port.


@node Device Drivers

@section Device Drivers

PolyORB-HI-C supports a set of predefined drivers. It relies on the @t{device} component of AADL models.
You can see the code of all available drivers in the @file{src/drivers} directory.

@subsection Supported devices drivers
Actually, PolyORB-HI-C supports the following devices
@enumerate
   @item
julien.delange's avatar
julien.delange committed
629
      @b{sockets}: a socket interface that uses PolyORB marshallers to send data accross an ethernet network.
630
631
      It relies on the TCP/IP protocol and uses POSIX functions to send and receive data. 
   @item
julien.delange's avatar
julien.delange committed
632
      @b{Linux serial}: provides function to send data accross the serial bus on a Linux host.
633
   @item
julien.delange's avatar
julien.delange committed
634
      @b{RASTA serial}: is the same than Linux serial but for LEON/Rasta software. It also uses
635
636
      PolyORB-HI-C marshallers. It requires that you use the RTEMS executive.
   @item
julien.delange's avatar
julien.delange committed
637
      @b{RASTA spacewire}: sends data accross a Spacewire bus. It works on top of the RTEMS operating system.
638
   @item
julien.delange's avatar
julien.delange committed
639
      @b{RASTA 1553}: sends data accross a 1553 bus. It provides functions to use the bus as
640
      a controller or a terminal (monitor mode not yet implemented).
641
   @item
julien.delange's avatar
julien.delange committed
642
643
644
645
      @b{LEON serial}: provides ability to use the serial port of a LEON board
      under RTEMS 4.8. This driver supports only a speed of 38400 bauds.
   @item
      @b{Exarm}: a driver that implements a network protocol dedicated to the
646
647
648
      EXARM project. You can find more information about this project on
      @url{http://www.esa.int/TEC/Robotics/SEMA9EVHESE_0.html}.
   @item
julien.delange's avatar
julien.delange committed
649
      @b{NI 6071E}:  driver for the National Instrument 6071E card. See
650
      @url{http://sine.ni.com/nips/cds/view/p/lang/en/nid/1042}. The driver was
julien.delange's avatar
julien.delange committed
651
652
653
654
      designed for the EXARM project. To be able to use it, you must use
      the LINUX TASTE specific distribution that embedds the low-level driver
      for the card. For that, the underlying operating system must be
      set to x86.linuxtaste.
655
656
657
@end enumerate


julien.delange's avatar
julien.delange committed
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717

@subsection Drivers configuration
The configuration of drivers is specified in AADL models using the
@code{Deployment::Config} property. This property is a string that is later
translated into code used by PolyORB-HI-C to configure the drivers. The code
created consists in an array (@code{__po_hi_devices_naming}) that contains the strings specified using the
AADL property.

The following list summarizes how device driver configuration should be written
in the @code{Deployment::Config} property and so, how PolyORB-HI-C understands
drivers configuration.

@itemize
   @item
      @b{Ethernet driver for Linux and NE2000 driver for RTEMS}: the
      configuration should be written like that :

      @code{ip XXX.XXX.XXX.XXX NNN}

      Where @code{XXX.XXX.XXX.XXX} corresponds to the IP address associated to
      the interface and @code{NNN} the port bound to the generated
      application (produced programs will listen on this port for incoming
      requests/data).
   @item
      @b{Serial driver for LEON2/LEON3 on RTEMS and serial driver for i386 on Linux and RTEMS}: the
      configuration should be written like this:
      @code{dev=accessed_device speed=baudrate}

      For example:

      @itemize

         @item
            On RTEMS/LEON, a valid configuration that accesses the
            second serial port would be:
       @code{dev=/dev/console_b speed=34600}
         @item
            On RTEMS/LEON with a RASTA board, a valid configuration that accesses the
            first serial port of the RASTA rack would be:
       @code{dev=/dev/apburasta0 speed=19200}
         @item
            On Linux/x86, a valid configuration that accesses the
            first serial COM port would be:
       @code{dev=/dev/ttyS0 speed=115200}
      @end itemize

      Note that the RTEMS/LEON driver supports only a speed of 34600 bauds.
      Other specified values will raise an error at run-time.

      Also, when the speed of the driver is not specified, the driver
      automatically fallback to a default speed, which is 34600.
   @item
      @b{Spacewire for LEON2/LEON3 with RTEMS}: the configuration is
      composed of one number that corresponds to the node identifier of the
      device. You directly write in the configuration the node number associated
      with the device.
@end itemize



718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
@subsection Adding a new driver
To add a new driver, you need to add a file in the @file{src/drivers} directory. It would basically contain
the implementation of your driver. Then, since all files are compiled, you need to add some C macro
that will indicate that your file will be compiled only under some circumstances (when the device is used in the model).
To do so, the code generator automatically generates a maccro called @code{__PO_HI_NEED_XXX} where @code{XXX} is the 
driver name in uppercase. The driver name is specified in AADL models using the @code{Deployment::Driver_Name} property.

If you are implementing your own driver, you can take existing drivers as an example.


@subsection Add your files to the list of compiled files
To get your driver compiled with PolyORB-HI-C services, you need to edit the @file{share/make/Makefile.common} file
and add your to the list of compiled files (the @code{PO_HI_OBJS} variable). Then, don't forget to install your modified
version of the file before testing it.


@subsection Retrieve driver configuration
In AADL models, the configuration of the device is specified using the @code{Deployment::Configuration} property.
It describes configuration concerns (IP address of the device and so on). It is useful to configure and initialize
your driver. To get this information in your driver code, you can use the @code{__po_hi_get_device_naming()} function
from the transport layer. This function takes one @b{device-id} that corresponds to the identifier
of your device in the AADL model. However, this @b{device-id} is automatically passed to the initialization function of your
driver in the generated code so that you can easily get configuration strings.

742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799

@c -------------------------------------------------------------------
@node Supported features
@appendix Supported features
@c -------------------------------------------------------------------

@menu
* C constructions and restrictions::  
* AADL features::       
@end menu

@c -------------------------------------------------------------------
@node C constructions and restrictions
@section C constructions and restrictions
@c -------------------------------------------------------------------

@noindent
PolyORB-HI-C introduces Ravenscar-like restrictions on C concurrent
features.  

Moreover, the code is compliant with the Application Environment
Profile (AEP) defined by the OMG. If these constructions are warrant
on the underlying middleware, it does not apply on the user code. In
other words, the code provided by the user and used by the generated
code must be written carefully.

If you want to check that your application if compliant with the AEP
profile, use the @code{check-symbols} tool, available in the
@file{tools} directory.

@c -------------------------------------------------------------------
@node AADL features
@section AADL features
@c -------------------------------------------------------------------

@noindent
POlyORB-HI acts as an AADLv1 or AADLv2 runtime. AADL is a complete
description language. Some features cannot be implemented or supported
by restricted HI runtimes.

This section lists AADL features supported by PolyORB-HI-C:

@itemize @bullet
@item asynchronous, oneway calls;
@item data component types of statically bounded size;
@item all compile-time and run-time restrictions enforced as part of
  the compilation process;
@item PolyORB-HI-Ada can use different transport infrastructures:

@itemize @bullet
@item on native platform, distribution can be tested using the native
socket library.

@item user-provided transport layer can be used, provided they follow 
guidelines discussed in section @b{XXX}.
@end itemize
@end itemize

800
801


802
803
804
805
806
807
808
809
810
811
812
813
814
@c -------------------------------------------------------------------
@node AADL to C transformations
@appendix AADL to C transformations
@c -------------------------------------------------------------------

@menu
* Whole distributed application::  
* Distributed application nodes::  
* Hosts::                       
* Threads::                     
* Connections::                 
* Subprograms::                 
* Data::                        
815
* Devices::                        
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
@end menu

In the following, and for each component of the distributed
application, we give the AADL entities that are used to model this
component, and then the transformation rules used by the code
generator to generate C code from these entities.

The mapping rules will be illustrated using the following simple
example of a distributed application:

@image{fig/ping, 12cm}

The figure above shows the architecture of the @emph{Ping}
example: a client, which is a process containing one single
@i{periodic} thread, sends a message to the server which is a process
containing one @i{aperiodic cyclic} thread that handles incoming ping
messages from the client. Each node of the @emph{Ping} application
runs on a different machine.

@c -------------------------------------------------------------------
@node Whole distributed application
@section Whole distributed application
@c -------------------------------------------------------------------

A distributed application is an application which is composed by
interacting nodes. In this section, we give the AADL entities used to
model a distributed application. Then, we give the rules applied to
map AADL entities onto instances VM-level container, expressed as C
code.

In the following, we detail only the rules that are directly related
to the distributed application as a whole system. The rules that are
specific to the components of the distributed application are
explained in the sections that deals with these respective components.

@subsection AADL entities

To model a distributed application in AADL we use the @code{system}
component. The system implementation shown on the following example
models such system.

@include ping.texi

For each node (process) of the distributed application, we
instantiate a subcomponent in the system implementation.

We use the @code{properties} section of the AADL @code{system}
(see @ref{Hosts} for more details) to map the
different nodes on the different platforms of the distributed
application. The @code{connections} section of the system
implementation models the connections between the different nodes of
the application.

@subsection C mapping rules

A distributed application is mapped into a hierarchy of directories:
@itemize @bullet
  @item the root directory of the distributed application which has
  the same name as the system implementation that model the application,
  in lower case, all dot being converted into underscores. This
  directory is the root of the directory hierarchy of the generated C
  distributed application.

  @item for each node of the distributed application, a child
  directory having the same name as the corresponding process
  subcomponent (in lower case) is created inside the root
  directory. This child directory will contain all the code generated
  for the particular node it was created for (see
  @ref{Distributed application nodes} for more details).

@end itemize

@c -------------------------------------------------------------------
@node Distributed application nodes
@section Distributed application nodes (processes)
@c -------------------------------------------------------------------

In this section, we give the AADL entities used to model a node of
distributed application. Then, we give the rules applied to map C
code from these AADL entities. Only rules that are related directly to
a node as a whole subsystem are listed here. The rules that are
specific to the sub-components of a node are explained in the sections
that deal with these respective sub-components.

@subsection AADL entities

To model a distributed application node in AADL we use the
@code{process} component. The process implementation shown in the
listing below shows such system. For each node of the
distributed application, we add a process instantiation as
subcomponent in the system implementation that models the distributed
application.

@include node_a_model.texi

For each thread that belongs to a node of the distributed application,
we instantiate a subcomponent in the process implementation. For each
connection between a node and another, a @code{port} feature has to be
added to both nodes with the direction @code{out} for the source and
@code{in} for the destination (see @ref{Connections} for more details
on connections mapping).

@subsection C mapping rules

All the C entities mapped from a distributed application node, are
created in a child directory of the directory mapped from the
distributed application. This directory has the same name as the
process @emph{subcomponent} instance relative to the handled node in
the system implementation that model the distributed application, in
lower case.

For example, all the entities relative to the process @code{A} of the
@code{Ping} example are generated in the directory
@code{ping_impl/node_a}.

The following paragraphs list the C compilation units that are
created for each node of the distributed application.

@subsubsection Marshallers functions

The marshallers functions are used to put all request and types values in a
message in order to send them through a network connections. All marshalling
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
functions are declared in the file @code{marshallers.c}.

However, PolyORB-HI-C can also use third-party marshallers. It can rely on the
marshallers generated for ASN1 encoding. Details about ASN1 marshallers
are provided in the next section.


@subsubsection Using ASN1 marshallers

With the ASN1 tools from
Semantix (see. @url{http://www.semantix.gr/assert/}), you can convert ASN1
declarations into AADL models. Then, these models can be used with AADL
components and PolyORB-HI-C relies on Semantix tools to automatically generates
C code that implements the ASN1 types.

For that purpose, you need to install the program @code{asn2aadlPlus} and
@code{asn1cc}. These programs are freely available on
@url{http://www.semantix.gr/assert/}. Then, when you use ASN1 types with your
AADL model (with the AADL files generated with @code{asn2aadlPlus}),
PolyORB-HI-C uses the generated code from ASN1 descriptions and integrate it to
marshall data.
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000

@subsubsection Node activity

We denote ``activity'' the set of the actions performed by one
particular node which are not triggered by other nodes. All the
periodic threads of a node are part of the node activity.

The code related to the node activity is generated in an C file
with the name @file{activity.c}. An example is shown below :

@include activity.c.texi

All the naming rules explained in @ref{Whole distributed application}
are also applied to map the package name. This file
contains all the routines mapped from the periodic threads
that belong to the handled node (see @ref{Threads} for more details on
thread mapping). This package contains also the instances of shared
objects used in this node (see @ref{Data} for more details). If the
node does not contain any @i{periodic} thread nor shared objects,
there is no @file{activity.c} file generated for this node. Thus,
the node @code{B} in the @code{Ping} example does not have a
@file{activity.c} package.

@subsubsection Data types

All the data types mapped from AADL data components and used by a
particular node of a distributed application are gathered in a
separate C file called @file{types.h}. 

For more detail on the mapping of data components, see @ref{Data}.

@subsubsection Subprograms

The mapping of all AADL subprogram components used by a particular
node is generated in a separate file called @file{subprograms.c}. 
The content of the file is shown in the following example:

For more detail on the mapping of subprogram components, see
@ref{Subprograms}.


@subsubsection Deployment information
For faster browsing, not all history is shown. View entire blame