Technical topic: Extend your models with your own property sets to hook your own tools

From TASTE
Jump to: navigation, search

Introduction

This page describes how you can easily extend the default property sets used in the TASTE models, for various purposes such as making connection to external tools or simply adding information to the models.

There are two extensibility options that fit two different needs:

1) You can add your own editable fields in the graphical editors and save the properties as a formal AADL property. For example you can add a "Version" property to a function.

2) You can add special "directives" to your functions which are then translated to XML files during the build. This allows you to hook an external tool that can do something with this information, without having to parse manually the AADL models to extract the data you need. We use these directives for instance to allow the user to explicitly provide specific compilation or link flags for a single function.


Add your own property sets to the AADL models

Our graphical editors (TASTE-IV and TASTE-DV) look very simple and user friendly. But they are also powerful and extensible.

There are two configuration files that allow you to add your own property sets to any element of the model (either the Interface or Deployment views). When the tool parses these files, it automatically adds the fields in the graphical editor to let the user set his values.

Look for the TASTE_IV_Properties.aadl or TASTE_DV_Properties files. They contain the syntax and example of use:

  $ cat /opt/Ellidiss-TASTE-linux/config/TASTE_IV_Properties.aadl
   -- mapping TASTE : AADL
   -- Container : Package
   -- Function : System
   -- Interface : Subprogram
   property set TASTE_IV_Properties is
   --  MyBoolean: aadlboolean applies to (System, Package);
   --  MyString: aadlstring applies to (System, Subprogram);
       Version: aadlstring applies to (System);
   --  MyInt: aadlinteger applies to (System);
   --  MyReal: aadlreal applies to (System);
   --  MyEnum: enumeration  (val1, val2, val3, val4) applies to (System);
   end TASTE_IV_Properties;

If you uncomment the fields, you will see them appear when editing a function or an interface of the Interface view. The values are then saved in the AADL files as standard AADL properties.

Important

If you modify the file in /opt/Ellidiss-TASTE-linux/config you must then copy it to ~/tool-inst/share/config-ellidiss

Add your own directives to the functions

The second extensibility feature comes with the "Context parameters" that can be associated to a function.

A special type you can choose, when adding a context parameter, is called "Taste-directive". TASTE directives are specified in an ASN.1 data type which can be extended for your own purposes.

   $ cat $(taste-config --directive)
   Taste-directive ::= CHOICE
   {
      compiler-option            IA5String (SIZE(1..512)),
      linker-option              IA5String (SIZE(1..512))
   }

By default, TASTE use the directives to give the possibility to add compiler or linker flags to the build of a single function. This is particularly useful when working with Simulink-generated code. But you can add any directive - just add a field to the CHOICE construct.

When the build is done, the values of the directives are generated in the form of an ASN.1 XER-encoded file (i.e. a simple XML file). You may add to the build script a call to an external program that reads and processes the XML file - no need to parse the AADL or ASN.1 value.

There is an example of use in `/home/assert/tool-src/testSuites/Regression_AADLv2/Demo_Directives`

Edit the interface view and edit the properties of the function0 block. The "Context parameters" tab has the following directive set:

Example of a TASTE directive

(We have extended the TASTE-directives.asn files with a simple value - you can check it in your VM)

If you then build the system and look at the binary directory you will find this file:

   $ cat binary/function0/directives/directives.xml
   <?xml version="1.0" encoding="UTF-8"?><Directive-function0><hello><simulink-script><filename>world</filename></simulink-script></hello></Directive-function0>

As you can see it contains the value that was set in the editor. You can do anything you like with it.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox