Deos Topics
This appendix describes topics relevant to GNAT Pro for Deos.
Supported Run-Time Libraries
GNAT Pro for Deos is provided with a single runtime: the Cert runtime. This runtime allows the development of applications that require certification. The runtime is an extension of the Light runtime, providing support for features including exception propagation.
In addition, GNAT for Deos provides two bindings for the ARINC Specification 653 Part 1:
apex_thin_95
apex_thick_95
The thin bindings directly call the corresponding APEX API, whereas the thick bindings will register newly created APEX processes with the Ada runtime.
Deos Configuration and Component Dependencies
All applications built with GNAT depend on the following Deos components:
ansi
gnu-language
If your application uses the Ada.Numerics
packages you will need to add a
dependency on math
.
Applications using Ada.Calendar
require a dependency on deos-time
.
Please see the Deos Time User Guide for more information on
adding this dependency to your executable project.
Please see the section Ada.Text_IO on Deos for the requirements for using
Ada.Text_IO
and GNAT.IO
on Deos.
The size of the heap for a Deos process by default is zero. To size your heap for your Deos process, update your Deos Process Developer XML file by expanding the processInstances attribute and then the processInstance for your process. Set the envpCommandLineParameters attribute to MALLOC_PAGES=x where x is the size of the process’s heap in 4K pages. Finally, increase the argumentQuota by at least 30.
When using the APEX bindings the following is required:
A dependency on
deos-653-p1
Enable use thread_local in the
Project Properties (DDC-I Options)
If you are using the thick APEX bindings, ensure the following Deos 653 partition options are set:
The
BlockboardQuota
increased by the number of APEX processes to be created by the partition and theBlackboardMessageSpaceInBytes
increased by 16 bytes per additional blackboard.
The thick bindings use blackboards to communication configuration data when new APEX processes are created.
Getting Started with an Ada application on Deos
All development with GNAT Pro for Deos occurs within OpenArbor using the GNATbench plugin. To get started with building an Ada application for Deos, please see the Developing DDC-I Deos Ada Projects chapter in the GNATbench for Eclipse User’s Guide, available online at the AdaCore documentation page. This documentation contains tutorials for developing Ada applications for Deos processes and Deos 653 partitions.
Mixed Language Programming
GNAT Pro for Deos supports mixed Ada and C programming where the C code is compiled with the C compiler provided with OpenArbor. When building a mixed Ada and C application in OpenArbor, do not add C as the list of languages to your gpr file, as the C code will be compiled and linked by OpenArbor.
Ada.Text_IO on Deos
As Deos does not provide standard input and output, AdaCore has designed
Ada.Text_IO
and GNAT.IO
to accommodate different development scenarios
on Deos.
Note: as Ada.Text_IO
and GNAT.IO
are functionally identical they will
be referred together as Ada.Text_IO
in this section.
In the first instance, Ada.Text_IO
has been designed to work with the
Deos Virtual File Library (vfile). If the diagnostic/debug version of the
vfile and video libraries are included in the Deos Executable Project,
Ada.Text_IO
will automatically use the system video buffer to output text.
Note that text input is not support with the Deos video driver.
If the diagnostic/debug version of the vfile and video libraries are not
included in the Deos Executable Project, you have the option to use vfile
library to open a file for reading and writing via Ada.Text_IO.Open
or
provide your own custom I/O driver that implements open()
, read()
and
write()
.
The following sections document each Ada.Text_IO
usage scenario in more
detail.
Note: while Ada.Text_IO
is thread-safe, the atomicity of the Put operations
depends on the implementation of write()
function.
Using the Static Video Library
When the diagnostic/debug version of the vfile and video libraries are present in an Deos Executable Project, the default behaviour of the Put procedures is to output to system video buffer. If required, the Open command can be used to redirect the output to other vfile files. See Using the Virtual File Library for more details.
To include the diagnostic/debug versions of the vfile and video libraries
in your executable project, add the vfile and video libraries as
dependencies to your executable project. In your platform project, ensure
the debug variant of vfile
is selected. Finally, you need to add vfile
as a feature set to your executable project’s process developer XML file. How
you do this depends on whether you are developing a Deos process or a 653
partition:
Deos Process
For a Deos process, add the following to your Deos Process Developer XML file:
<usedFeatureSets>
<usedFeatureSet
name = "libansi"
versionRequirement = "none"
versionNumber = "none"
featureSetUndefinedAction = "ignore"
>
</usedFeatureSet>
<usedFeatureSet
name = "vfile"
versionRequirement = "none"
versionNumber = "none"
featureSetUndefinedAction = "error"
>
<usedFeature
name = "vfile"
>
<usedFeatureParameter
name = "ProcessInstanceName"
value = "!process_name!"
></usedFeatureParameter>
</usedFeature>
</usedFeatureSet>
</usedFeatureSets>
Replace !process_name!
with the name of your process.
If your XML lacks the <usedFeatureSets>
add it after the
</logicalMemoryPools>
section. To ensure the diagnostic version of vfile
is used, open your Platform Project, expand Complete Integration
and double
click on Components
. Expand platregd
in the window that opens and then
right click on vfile
and select Debug Variant
.
Deos 653 Partition
For a Deos 653 partition, create a blank feature provider XML file in your
executable project named after your partition. For example, create a feature
provider XML file called hellow_world.fp.xml
for a process called
hello_world
.
Add the following to your feature provider XML file, replacing !partition_name!
with the name of your partition:
<?xml version = "1.0" encoding="UTF-8"?>
<featureSet
name = "!partition_name!"
versionNumber = "1.0.0"
validityKey = "1891889728"
comment = "653 partition extensions to PD XML"
toolVersion = "3.61.3"
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation = "ddci:/xsd/fp.xsd"
>
<feature
name = "oncePerUsingProcessTemplate"
description = "usage required by partition"
>
<usedFeatureSetAction
featureSetName = "libansi"
featureName = "oncePerUsingProcessTemplate"
featureSetUndefinedAction = "error"
usingProcessTemplate = ""
></usedFeatureSetAction>
<usedFeatureSetAction
featureSetName = "vfile"
featureName = "oncePerUsingProcessTemplate"
featureSetUndefinedAction = "error"
usingProcessTemplate = ""
></usedFeatureSetAction>
<usedFeatureSetAction
featureSetName = "vfile"
featureName = "vfile"
featureSetUndefinedAction = "error"
usingProcessTemplate = ""
>
<methodParameter
parameterName = "ProcessInstanceName"
value = "!partition_name!"
></methodParameter>
</usedFeatureSetAction>
</feature>
</featureSet>
Using the Virtual File Library
Text can be sent to and received from any file opened via the vfile library,
including character device drivers. As Deos lacks standard I/O, you are
required to first use Ada.Text_IO.Open
procedure to open the file you wish
send to or receive from. Otherwise the default Get and Put procedures will
raise Status_Error
Files can be open as read-only, write-only or
read-write. For example, to read and write data to /deve/uart0
:
Open (Serial_Device, In_Out_File, "/dev/uart0");
The File_Type
returned by Open
can be used by the Get
and Put
procedures that take File_Type
as a parameter:
Put (Serial_Device, "A short message");
Alternatively, you can use the Ada.Text_IO
procedures Set_Input
and
Set_Output
to set the input and output files to be used by the default
Get and Put procedures:
Set_Output (Serial_Device);
Put ("A short message");
To use the vfile library in your executable project, follow the instructions in Using the Static Video Library.
Using Custom I/O Driver
It is possible to use Ada.Text_IO
without using the vfile library. In
this case you will need to implement the following functions:
function Open (Path : String; Oflags : Integer) return Integer
with Export, Convention => Ada, External_Name => "open";
procedure Write (Fd : Integer; Buffer : System.Address; Len : Integer)
with Export, Convention => C, External_Name => "write";
function Read (Fd : Integer; Buffer : System.Address; Maxbytes : Integer)
return Integer
with Export, Convention => C, External_Name => "read";
A call to Open
will be performed during the elaboration of Ada.Text_IO`.
This allows the custom driver to set the default input channels without
requiring explicit calls to ``Open
and Set_Input
.
Note, Open
will be called with the following parameters that can be
ignored by the customer driver:
Open ("/proc/videobuf/screen", Out_File)