Kazoo

From TASTE
Revision as of 11:18, 12 December 2019 by Kgrochowski (talk | contribs) (Refactoring of introduction and installation)
Jump to: navigation, search

Kazoo is a part of the TASTE toolchain responsible for generating code and build scripts from AADL models.

Overview

Kazoo is a a command line tool which processes input AADL models and produces derived models, code and scripts used to build complete system. It facilitates Ocarina for AADL parsing and templates-parser for templates processing and files generation. Standard library of components used by templates is defined by TASTE common models from ocarina_components.aadl file, which includes supported processors, devices, drivers etc. Generated build scripts apart from calling code compilers also run other tools like ocarina and aadl2glueC to create rest of the source code.

Installation and updating

To update kazoo run the following commands in the terminal:

$ cd ~/tool-src/kazoo
$ git checkout master

When command succeeds, kazoo needs to be rebuild to complete installation.

To do so run the following commands in the terminal:

$ cd ~/tool-src/kazoo
$ make install

Using kazoo

How to use kazoo

Kazoo is a command line tool. Run following commands in the terminal. Kazoo reads input aadl files and usi Example of kazoo usage:

$ kazoo --output=out --gw --glue --polyorb-hi-c

After this, directory out will be created. To build the system run following commands in the terminal:

$ cd out
$ make

The output binary files will be located in the directory out/binaries.

How to use kazoo examples

Kazoo comes with a lot of examples, which are wery helpful. The examples are located in the directory /home/taste/tool-src/kazoo/test/. Every example project contains Makefile, which simpifies the process of build. For an example, to build project Demo_C run following commands int the terminal:

$ cd /home/taste/tool-src/kazoo/test/Demo_C
$ make

Input files for kazoo

  • InterfaceView.aadl
  • DeploymentView.aadl
  • DataView.aadl
  • DataView.asn
  • DataView.acn

Internal representation of system within kazoo

Taste uses Ocarina library to parse input aadl files. The internal representation of system consists of thre major structures:

  • InterfaceView
  • DeploymentView
  • ConcurrencyView

The InterfaceView representation contains of list of functions. Every function contains provided interfaces and required interfaces. Optionally a function may contain context parameters. The InterfaceView representation contains also connections between provided interfaces and required interfaces. The InterfaceView representation is used to create skeletons and glue code. See Code skeletons generation and Glue code generation.

The DeploymentView constists of Nodes, Buses and connections between them. The Node contains Partitions, Processors and Drivers. The Partition contains a list of bounded functions. The DeploymentView is not directly used for code generation.

The ConcurrencyView is generated from DeploymentView. The ConcurrencyView consists of list of Nodes. Every Node consists of list of Partitions and list of Drivers. Every Partition consists of list of Threads. Every Thread has a list of assigned functions from InterfaceView.

The ConcurrencyView is used for generation of rest of glue code and also middleware integration. See Concurrency View generation.

build-script.sh generation

The file build-script.sh is generated from build-script.tmplt. The template files: build-script-gen.tmplt, build-script-func.tmplt and build-script-zip.tmplt are evaluated earlier, and the output is passed to main template as parameters.

Code skeletons generation

Kazoo skeletons templates are processed according to the presented algorithm in pseudocode:

for every function from InterfaceView:
    for every subdirectory
        evaluate template trigger.tmplt
        if result is equal to “TRUE” then
            evaluate template function-filename.tmplt if exists
            evaluate template makefile-filename.tmplt if exists
            evaluate template interface.tmplt for required interfaces of function
            evaluate template interface.tmplt for provided interfaces of function
            evaluate template makefile.tmplt and optionally save output to file
            evaluate template function.tmplt and optionally save output to file
    if function has context parameters then
        evaluate template context_parameters.tmplt and save the output to file

Glue code generation

Kazoo glue templates are processed according to the presented algorithm in pseudocode: Algorithm in pseudocode:

for every function from InterfaceView:
    for every subdirectory
        evaluate template trigger.tmplt
        if result is equal to “TRUE” then
            evaluate template function-filename.tmplt if exists
            evaluate template makefile-filename.tmplt if exists
            evaluate template interface.tmplt for required interfaces of function
            evaluate template interface.tmplt for provided interfaces of function
            evaluate template makefile.tmplt and optionally save output to file
            evaluate template function.tmplt and optionally save output to file

Existing Glue templates

invoke_ri-body

This subdirectory creates files with name build/<function name>/<language>/<function name>_invoke_ri.c

mini-cv

This subdirectory creates files with name build/<function name>/<language>/<function name>_mini_cv.c

system_config

This subdirectory creates files with name build/<function name>/<language>/<function name>_system_config.h

vm_if-body

This subdirectory creates files with name build/<function name>/<language>/<function name>_vm_if.c

vm_if-header

This subdirectory creates files with name build/<function name>/<language>/<function name>_vm_if.h

Concurrency View generation

Kazoo concurrency view templates are processed according to the presented algorithm in pseudocode:

for every subdirectory
    for every node from ConcurrencyView
        evaluate template filesys.tmplt
        evaluate template filenode.tmplt
        evaluate template trigger.tmplt
        if result is equal to “TRUE” then
            for every partition from node:
                evaluate template filepart.tmplt
                evaluate template thread.tmplt and optionally save output to the file
                evaluate template filethread.tmplt
                evaluate template fileblock.tmplt
                evaluate template pi.tmplt
                evaluate template pi.tmplt (with other parameters)
                evaluate template ri.tmplt
                evaluate template block.tmplt and optionally save output to file
                evaluate template partition.tmplt and optionally save output to file
        evaluate template node.tmplt and optionally save output to file
    evaluate template system.tmplt and optionally save output to file

Existing Concurrency View subdirectories

aadl_2_threads

This subdirectory creates file build/system.aadl, which is used by ocarina to create source code of Concurrency View. This subdirectory is processed always.

aadl_3_main

This subdirectory creates file build/main.aadl, which is used by ocarina to create source code of Concurrency View. This subdirectory is processed always.

aadl_4_makefile

This subdirectory creates file build/Makefile.taste. This subdirectory is processed always.

ada_pohi_gpr

This subdirectory creates following files:

  • for every node file with name Makefike.<node name>
  • for every partition file with name <partition name>.gpr

This subdirectory is processed when option -p or --polyorb-hi-c was not used.

ada_wrappers_body

This subdirectory creates files with name build/<partition name>/<partition name>_taste_interface.adb for every partition This subdirectory is processed when option -p or --polyorb-hi-c was not used.

ada_wrappers_source

This subdirectory creates files with name build/<partition name>/<partition name>_taste_interface.ads For every partition. This subdirectory is processed when option -p or --polyorb-hi-c was not used.

air_cgpr

This subdirectory creates files with name build/<node name>/air.cgpr for every partition. This subdirectory is processed when option -p or --polyorb-hi-c was used.

air_gpr

This subdirectory creates files with name build/<node name>/<parition name>_air.gpr for every partition. This subdirectory is processed when option -p or --polyorb-hi-c was used.

air_makefile

This subdirectory creates file build/Makefile.air. This subdirectory is processed when option -p or --polyorb-hi-c was used.

air_port_polling

This subdirectory creates files with name build/<node name>/<partition name>/air_polling.c for every partition. This subdirectory is processed when option -p or --polyorb-hi-c was used.

c_pohi_gpr

This subdirectory creates following files:

  • For every node build/<node name>/Makefile.<node name>
  • For every partition build/<node name>/<partition name>.gpr

This subdirectory is processed when option -p or --polyorb-hi-c was used.

c_pohi_rtems_with_ada_cgpr

This subdirectory creates files with name build/<node name>/rtems_ada.cgpr for every partition. This subdirectory is processed when option -p or --polyorb-hi-c was used.

c_pohi_rtems_with_ada_gpr

This subdirectory creates files with name build/<node name>/<partition name>_rtems_ada.gpr for every partition. This subdirectory is processed when option -p or --polyorb-hi-c was used.

drivers_config

This subdirectory creates file build/drivers_config.asn. This subdirectory is processed always.

pohic_makefile_workaround

This subdirectory creates files with name build/<node name>/gather_<partition name>_filelist.sh for every partition. This subdirectory is processed when option -p or --polyorb-hi-c was used.

pohic_wrappers_body

This subdirectory creates files with name build/<node name>/<partition name>/<partition name>_polyorb_interface.c for every partition. This subdirectory is processed when option -p or --polyorb-hi-c was used.

pohic_wrappers_header

This subdirectory creates files with name build/<node name>/<partition name>/<partition name>_polyorb_interface.h for every partition. This subdirectory is processed when option -p or --polyorb-hi-c was used.


How to create new template for kazoo

Copy existing template subdirectory:

$ cd /home/taste/tool-src/kazoo/templates/concurrency_view
$ cp -r aadl_2_threads <new subdirectory>

After editing new templates kazoo needs to be rebuild.