Kazoo
Kazoo is a part of the TASTE toolchain responsible for generating code and build scripts from AADL models.
Contents
- 1 Overview
- 2 Installation and updating
- 3 Using kazoo
- 3.1 Basic usage
- 3.2 Kazoo example
- 3.3 Input files for kazoo
- 3.4 Internal representation of system within kazoo
- 3.5 build-script.sh generation
- 3.6 Code skeletons generation
- 3.7 Glue code generation
- 3.8 Concurrency View generation
- 3.8.1 Existing Concurrency View subdirectories
- 3.8.1.1 aadl_2_threads
- 3.8.1.2 aadl_3_main
- 3.8.1.3 aadl_4_makefile
- 3.8.1.4 ada_pohi_gpr
- 3.8.1.5 ada_wrappers_body
- 3.8.1.6 ada_wrappers_source
- 3.8.1.7 air_cgpr
- 3.8.1.8 air_gpr
- 3.8.1.9 air_makefile
- 3.8.1.10 air_port_polling
- 3.8.1.11 c_pohi_gpr
- 3.8.1.12 c_pohi_rtems_with_ada_cgpr
- 3.8.1.13 c_pohi_rtems_with_ada_gpr
- 3.8.1.14 drivers_config
- 3.8.1.15 pohic_makefile_workaround
- 3.8.1.16 pohic_wrappers_body
- 3.8.1.17 pohic_wrappers_header
- 3.8.1 Existing Concurrency View subdirectories
- 3.9 How to create new template for kazoo
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
Kazoo is a command line tool, executed from terminal and configured by a list o parameters.
Basic usage
Run the following commands in the terminal.
$ kazoo --output=out --gw --glue --polyorb-hi-c
Kazoo will read the default input AADL models and generate code to the selected output directory.
Parameter --output
chooses the output directory for generated files (out), --gw
enables models and code skeletons generation, --glue
enables glue code generation and --polyorb-hi-c
turns on use of PolyORB-HI-C runtime.
In the result directory out will be created and filled with generated models and source files.
To build the generated system run following commands in the terminal:
$ cd out $ make
The output binary files will be located in the directory out/binaries.
Kazoo example
Kazoo comes with a lot of helpful examples.The examples are located in the directory /home/taste/tool-src/kazoo/test/. Every example project contains Makefile, which simplifies the process of the build. For an example, to build project Demo_C run following commands in 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.