Commit f76d0b55 authored by Thanassis Tsiodras's avatar Thanassis Tsiodras

Install helper scripts

parent 01288731
#!/usr/bin/perl -w
use strict;
if (scalar @ARGV != 1) {
die "Usage: $0 deploymentView.aadl\n";
}
$/=undef;
my $allText = <>;
my $anchor = "-- copied aadl libraries";
$allText =~ s/$anchor.*$//s;
print $allText.$anchor;
#!/bin/bash
POHIC=$(taste-config --prefix)/include/ocarina/runtime/polyorb-hi-c/make
POHIADA=$(taste-config --prefix)/include/ocarina/runtime/polyorb-hi-ada/make
RTEMS_MAKEFILE_PATH=$RTEMS_MAKEFILE_PATH_LEON
MTMP=${TMP:-/tmp}
mkdir -p $MTMP
for target in "$POHIC" "$POHIADA"
do
cd "$target" && for f in Makefile.*
do
cat << EOF > ${MTMP}/Makefile.tmp.$$
include ${f}
all:
@echo \$(CC)
EOF
export RTEMS_MAKEFILE_PATH=$RTEMS_MAKEFILE_PATH_LEON && make -f $MTMP/Makefile.tmp.$$ all 2>/dev/null
rm -f $MTMP/Makefile.tmp.$$
done
done | awk '{print $1}' | sort | uniq | grep -v your_c_compiler | grep -v '^$'
#!/bin/bash
# from a RTDS generated code directory, get the list of SDL processes
# based on the filenames (process code ends with _p.c)
echo '#ifdef NO_RTDS_SCHEDULER' > list_process.def
ls *_p.c 2>/dev/null | cut -f 1 -d _ | xargs -L 1 -I {} echo DECLARE \("{}"\) >> list_process.def
echo '#endif' >> list_process.def
#!/bin/bash
xterm -e "./build-script.sh ; read -p 'Press Enter to close'" || exit 1
#!/bin/bash -e
# Run the tracer daemon - make sure only one instance exists at a time
if [ ! -f "$1" ]
then
echo 'Usage: taste-collect-coverage binary'
else
echo Executing binary for 10 seconds...
"$1" &
pid=$!
sleep 10
kill -SIGUSR2 $pid
lcov --capture --directory .. --output-file coverage.info
genhtml coverage.info --output-directory coverage
xdg-open coverage/index.html
fi
#!/bin/bash -e
echo TASTE ACN Editor - Use only the SAVE button - not \"Save as..\" !
DATAVIEW=DataView.asn
if [ ! -z $(which kate) ]
then
EDITOR="kate -n"
elif [ ! -z $(which gvim) ]
then
EDITOR="gvim -f"
else
EDITOR=vi
fi
if [ ! -z "$1" ]
then
if [ -f "$1" ]
then
DATAVIEW="$1"
else
echo Invalid dataview filename - use $(basename "$0") \<filename.asn\>
exit -1
fi
fi
if [ -f "$DATAVIEW" ]
then
echo Creating dummy ACN file from existing DataView.asn
else
echo First create your ASN.1 data model: run taste-create-data-view
exit -1
fi
TASTE_TYPES=$(taste-config --prefix)/share/taste-types/taste-types.asn
mono $(which asn1.exe) -ACND "$DATAVIEW" "$TASTE_TYPES"
ACNFILENAME=${DATAVIEW%.*}.acn
if [ -z $NONINTERACTIVE ]
then
$EDITOR "$ACNFILENAME"
fi
taste-update-data-view $1
echo 'Everything went fine.
If you want to edit your ACN model, run taste-edit-acn-model
'
#!/bin/bash -e
echo TASTE Dataview Editor - Use only the SAVE button - not \"Save as..\" !
# Find a suitable text editor, in order of priority: kate, gvim, vi
if [ ! -z $(which kate) ]
then
EDITOR="kate -n"
elif [ ! -z $(which gvim) ]
then
EDITOR="gvim -f"
else
EDITOR=vi
fi
if [ -f "DataView.asn" ];
then echo Opening existing DataView.asn;
else
echo Creating a dummy ASN.1 file with a few type examples - feel free to add, edit, delete...
echo 'TASTE-Dataview DEFINITIONS ::=
BEGIN
IMPORTS T-Int32, T-UInt32, T-Int8, T-UInt8, T-Boolean FROM TASTE-BasicTypes;
-- A few simple types to start with ASN.1
MyInteger ::= T-UInt8
MyReal ::= REAL (0.0 .. 1000.0)
MyBool ::= BOOLEAN
MyEnum ::= ENUMERATED { hello, world, howareyou }
MySeq ::= SEQUENCE {
input-data MyInteger,
output-data MyInteger,
validity ENUMERATED { valid, invalid }
}
MyChoice ::= CHOICE {
a BOOLEAN,
b MySeq
}
MySeqOf ::= SEQUENCE (SIZE (2)) OF MyEnum
MyOctStr ::= OCTET STRING (SIZE (3))
-- You can also declare constants
myVar MySeqOf ::= { hello, world }
END
' > DataView.asn
fi
if [ -z $NONINTERACTIVE ]
then
$EDITOR DataView.asn
echo Converting the data view to AADL...
fi
cp $(taste-config --prefix)/share/taste-types/taste-types.asn .
taste-update-data-view
if [ -z $NONINTERACTIVE ]
then
echo 'Everything went fine.
You can now run taste-create-interface-view or if you want to edit your data view, run taste-edit-data-view
You can also create an ACN model of your data view by typing taste-create-acn-model
'
fi
#!/bin/bash -e
# Build an SQL database for the current TASTE project
# (1) First check if a project name is given as first argument, othewise take current directory
if [ "$1" ]
then
DBNAME="$1"
else
DBNAME=$(pwd | sed 's,^.*/,,g' | tr '[A-Z]' '[a-z]' | tr '-' '_')
fi
echo Creating a TASTE SQL Database for project $DBNAME
# (2) Create the DB output directory
mkdir -p sql_db
# (3) Retrieve ASN.1 file and create a single ASN.1 file with all types inside
INTERFACEVIEW=InterfaceView.aadl
AADL_PROPERTIES="$(taste-config --prefix)/share/config_ellidiss/TASTE_IV_Properties.aadl"
if [ ! -f InterfaceView.aadl ]
then
echo 'Error: InterfaceView.aadl not found'
exit -1
fi
taste-extract-asn-from-design.exe -i "$INTERFACEVIEW" -j sql_db/$DBNAME.asn
# (4) create Python and SQL Alchemy interfaces
cd sql_db
asn2dataModel -toPython $DBNAME.asn
asn2dataModel -toSqlalchemy $DBNAME.asn
# Build the Python interface
make -f Makefile.python
# (5) Create postgresql database
echo "drop database if exists $DBNAME; create database $DBNAME;" | psql -h localhost -U taste postgres
cat > initdb.py <<OEF
from sqlalchemy import create_engine
from ${DBNAME}_model import Base
engine = create_engine(
'postgresql+psycopg2://taste:tastedb@localhost/${DBNAME}', echo=False)
Base.metadata.create_all(engine)
OEF
python initdb.py
cat > db.info << OEF2
postgresql+psycopg2://taste:tastedb@localhost/${DBNAME}
${DBNAME}
OEF2
#!/bin/bash
if [ ! -f "$1" ]
then
if [ -f InterfaceView.aadl ]
then
echo 'Loading InterfaceView.aadl'
INTERFACEVIEW=InterfaceView.aadl
else
echo 'Error: no interface view found
Usage: taste-create-deployment-view InterfaceView.aadl'
exit -1
fi
else
echo 'Loading interface view: "$1"'
INTERFACEVIEW="$1"
fi
grep -i taste-directives.aadl "$INTERFACEVIEW" >/dev/null && {
echo Your interface view needs to be upgraded\!
echo Please upgrade it with:
echo
echo " taste-upgrade-IF-view oldIFview newIFview"
echo
echo ...and use the newIFview instead.
exit 1
}
TASTE-DV --aadl-library $(taste-config --prefix)/share/ocarina/AADLv2/ocarina_components.aadl --load-interface-view "$INTERFACEVIEW" --edit-aadl DeploymentView.aadl
#!/bin/bash
echo 'TASTE Interface view Editor - Use only the SAVE button - not \"Save as..\" !'
if [ ! -f "$1" ]
then
if [ ! -f DataView.aadl ]
then
echo 'No dataview found. Creating one for you.'
NONINTERACTIVE=1 taste-create-data-view
fi
AADLFILES+=,DataView.aadl
else
echo Using dataview file "$1"
AADLFILES+=,"$1"
fi
TASTE-IV --data-view "$AADLFILES" --edit-aadl InterfaceView.aadl
#!/bin/bash -e
echo 'TASTE Project Creator - Use only the SAVE button - not \"Save as..\" !'
if [ -f InterfaceView.aadl ]
then
echo 'InterfaceView.aadl already exists. Use taste-edit-project instead.'
exit 0
fi
if [ ! -f DataView.aadl ]
then
echo 'Creating a default ASN.1 data model.'
NONINTERACTIVE=1 taste-create-data-view
NONINTERACTIVE=1 taste-create-acn-model
else
echo Using existing DataView.aadl
fi
# Invoke the GUI from Ellidiss
TASTE --data-view DataView.aadl \
--load-interface-view InterfaceView.aadl \
--load-deployment-view DeploymentView.aadl \
--aadl-library $(taste-config --prefix)/share/ocarina/AADLv2/ocarina_components.aadl
#!/bin/bash -e
echo TASTE ACN Editor - Use only the SAVE button - not \"Save as..\" !
if [ ! -z $(which kate) ]
then
EDITOR="kate -n"
elif [ ! -z $(which gvim) ]
then
EDITOR="gvim -f"
else
EDITOR=vi
fi
if [ ! -z "$1" ]
then
ACNFILENAME="$1"
else
ACNFILENAME=DataView.acn
fi
if [ ! -f "$ACNFILENAME" ]
then
echo No proper ACN model found. Use taste-create-acn-model first or use $(basename "$0") DataView.acn
exit -1
fi
DATAVIEW=${ACNFILENAME%.*}.asn
if [ ! -f "$DATAVIEW" ]
then
echo No dataview corresponding to your ACN model was found. Make sure "$DATAVIEW" is present
exit -1
fi
if [ -z $NONINTERACTIVE ]
then
before=$(md5sum "$ACNFILENAME")
$EDITOR "$ACNFILENAME"
after=$(md5sum "$ACNFILENAME")
fi
if [ ! -f DataView.aadl ]
then
before=
fi
if [ "$before" != "$after" ]
then
taste-update-data-view $1
echo 'Everything went fine. Your dataview was properly updated.'
else
echo File unchanged
fi
#!/bin/bash
error=0
NB_ARGS=3
AUTO=0
# If there are no parameters, take default names for Interface, Deployment and Data view
if [ $# -eq $AUTO ]
then
if [[ -f InterfaceView.aadl && -f DeploymentView.aadl && -f DataView.aadl ]]
then
echo 'Using InterfaceView.aadl, DeploymentView.aadl, DataView.aadl (defaults)'
INTERFACEVIEW=InterfaceView.aadl
DEPLOYMENTVIEW=DeploymentView.aadl
DATAVIEW=DataView.aadl
else
error=1
echo 'Error: Missing files (need InterfaceView.aadl, DeploymentView.aadl, DataView.aadl)'
fi
else
# Check if there are 3 parameters and that the files are all present
if [[ $# -eq $NB_ARGS && -f "$1" && -f "$2" && -f "$3" ]]
then
echo 'Loading interface, deployment and data views: "$1" "$2" "$3"'
INTERFACEVIEW="$1"
DEPLOYMENTVIEW="$2"
DATAVIEW="$3"
else
error=1
echo 'Error: specified files missing or wrong number of parameters'
fi
fi
if [ $error -eq 1 ]
then
echo 'If you are using custom names for interface, deployment and data views, please specify them in order:
Usage: taste-edit-concurrency-view InterfaceView.aadl DeploymentView.aadl DataView.aadl'
exit -1
fi
AADL_PROPERTIES="$(taste-config --prefix)/share/config_ellidiss/TASTE_IV_Properties.aadl "
AADL_PROPERTIES+="$(taste-config --prefix)/share/config_ellidiss/TASTE_DV_Properties.aadl"
OCARINA_COMPONENTS="$(taste-config --prefix)/share/ocarina/AADLv2/ocarina_components.aadl"
# Tempdir will not be deleted - OS shall make the cleanup (likely at reboot)
tempdir=$(mktemp -d)
taste-extract-asn-from-design.exe -i "$INTERFACEVIEW" -j "$tempdir"/dataview-uniq.asn
asn2aadlPlus "$tempdir"/dataview-uniq.asn "$tempdir"/dataview-uniq.aadl -aadlv2
taste-extract-asn-from-design.exe -i "$INTERFACEVIEW" -k "$tempdir"/dataview-uniq.asn
DATAVIEW="$tempdir"/dataview-uniq.aadl
CMD="buildsupport -i ${INTERFACEVIEW}
-c ${DEPLOYMENTVIEW}
-d ${DATAVIEW}
${AADL_PROPERTIES}
${OCARINA_COMPONENTS}
-glue
-gw
-o ${tempdir}"
[ ! -z $DEBUG ] && echo "${CMD}"
# Execute buildsupport:
$CMD
if [ $? -eq 0 ]
then
PROCESS="$tempdir"/ConcurrencyView/process.aadl
for file in "$tempdir"/ConcurrencyView/*_Thread.aadl
do
PROCESS+=,$file
done
PROCESS+=,$OCARINA_COMPONENTS
else
echo "The following command failed:
${CMD}
"
echo 'Buildsupport reported errors - Fix your models before you can edit the Concurrency View'
exit -2
fi
echo 'Running the Concurrency View editor from TASTE
From this tool you may:
- Verify the schedulability of your system with CHEDDAR
- Simulate the real-time architecture with MARZHIN
- Edit the thread priorities, stack size and offset/phase'
PROPERTIES=ConcurrencyView.pro
[ ! -z $DEBUG ] && echo TASTE-CV --edit-aadl $PROCESS --update-properties $PROPERTIES
TASTE-CV --edit-aadl $PROCESS --update-properties $PROPERTIES
#!/bin/bash -e
echo TASTE Data View Editor - Use only the SAVE button - not \"Save as..\" !
if [ ! -z $(which kate) ]
then
EDITOR="kate -n"
elif [ ! -z $(which gvim) ]
then
EDITOR="gvim -f"
else
EDITOR=vi
fi
if [ ! -f "$1" ]
then
if [ -f DataView.asn ]
then
echo 'Opening DataView.asn'
DATAVIEW=DataView.asn
else
echo Error: no data view found
echo Usage: taste-edit-data-view DataView.asn
exit 1
fi
else
echo Opening "$1"
DATAVIEW="$1"
fi
before=$(md5sum "$DATAVIEW")
$EDITOR "$DATAVIEW" 2>/dev/null
after=$(md5sum "$DATAVIEW")
if [ ! -f DataView.aadl ]
then
before=
fi
cp $(taste-config --prefix)/share/taste-types/taste-types.asn .
if [ "$before" != "$after" ] ; then
taste-update-data-view $1
else
echo File unchanged
exit 0
fi
#!/bin/bash
if [ ! -f "$1" ]
then
if [ -f DeploymentView.aadl ]
then
echo Opening DeploymentView.aadl
DEPLOYMENTVIEW=DeploymentView.aadl
else
echo 'Error: no deployment view found
Usage: taste-edit-deployment-view DeploymentView.aadl'
exit 1
fi
else
echo Opening "$1"
DEPLOYMENTVIEW="$1"
fi
# To be compatible with older versions (1.2) call cleanupDV to delete hard copy
# of the component library from inside DeployementView.aadl
echo TASTE Deployment view Editor - Use only the SAVE button - not \"Save as..\" !
cleanupDV.pl "$DEPLOYMENTVIEW" > "/tmp/newDV.aadl.$$" && \
mv "/tmp/newDV.aadl.$$" "$DEPLOYMENTVIEW" && \
TASTE-DV --edit-aadl "$DEPLOYMENTVIEW" --aadl-library $(taste-config --prefix)/share/ocarina/AADLv2/ocarina_components.aadl
#!/bin/bash
if [ ! -f "$1" ]
then
if [ -f InterfaceView.aadl ]
then
echo 'Opening InterfaceView.aadl'
INTERFACEVIEW=InterfaceView.aadl
else
echo Error: no interface view found
echo Usage: taste-edit-interface-view InterfaceView.aadl
exit 1
fi
else
echo Opening "$1"
INTERFACEVIEW="$1"
fi
grep -i taste-directives.aadl "$INTERFACEVIEW" >/dev/null && {
echo Your interface view needs to be upgraded\!
echo Please upgrade it with:
echo
echo " taste-upgrade-IF-view oldIFview newIFview"
echo
echo ...and use the newIFview instead.
exit 1
}
echo TASTE Interface view Editor - Use only the SAVE button - not \"Save as..\" !
TASTE-IV --edit-aadl "$INTERFACEVIEW"
#!/bin/bash
if [ -f InterfaceView.aadl ]
then
echo 'Opening TASTE project'
INTERFACEVIEW=InterfaceView.aadl
else
echo Error: missing InterfaceView.aadl
echo First use taste-create-project to start a new project
exit 1
fi
grep -i taste-directives.aadl "$INTERFACEVIEW" >/dev/null && {
echo Your interface view needs to be upgraded\!
echo Please upgrade it with:
echo
echo " taste-upgrade-IF-view oldIFview newIFview"
echo
echo ...and use the newIFview instead.
exit 1
}
echo TASTE Project Editor - Use only the SAVE button - not \"Save as..\" !
# If there is no deployment view, only load interface view
EXTRA_CMD=
if [ ! -f DeploymentView.aadl ]
then
EXTRA_CMD+=--load-interface-view
EXTRA_CMD+=' InterfaceView.aadl'
EXTRA_CMD+=' --aadl-library $(taste-config --prefix)/share/ocarina/AADLv2/ocarina_components.aadl'
else
EXTRA_CMD=
fi
echo TASTE $EXTRA_CMD --data-view DataView.aadl --load-deployment-view DeploymentView.aadl
TASTE $EXTRA_CMD --data-view DataView.aadl --load-deployment-view DeploymentView.aadl
#!/bin/bash -e
# $1 may be the interfaceview in AADL (optional if a file called InterfaceView.aadl is present)
# $2 is the output directory
# this script builds a unique dataview.aadl file and calls buildsupport with --gw --aadlv2 -o $2 --keep-case
[ -z "$DMT" ] && { echo You must set the DMT environment variable before you can execute this command.; exit 1 ; }
# First check if an existing file is given as first argument (interface view)
# If not, check for the presence of a file called "InterfaceView.aadl".
# If no file is present or given, return an error with the command line.
if [ ! -f "$1" ]
then
if [ -f InterfaceView.aadl ]
then
INTERFACEVIEW=InterfaceView.aadl
else
echo 'Error: interface view not found
Usage: [FORCE=1] taste-generate-skeletons [InterfaceView.aadl] [output-directory]'
exit -1
fi
else
INTERFACEVIEW="$1"
shift
fi
grep -i taste-directives.aadl "$INTERFACEVIEW" >/dev/null && {
echo Your interface view needs to be upgraded\!
echo Please upgrade it with:
echo
echo " taste-upgrade-IF-view oldIFview newIFview"
echo
echo ...and use the newIFview instead.
exit 1
}
# Second, check if an output directory is passed as second argument
if [ -z "$1" ]
then
output_dir=.
else
output_dir="$1"
fi
AADL_PROPERTIES="$(taste-config --prefix)/share/config_ellidiss/TASTE_IV_Properties.aadl"
if [[ -f InterfaceView.md5 && -z $FORCE ]]
then
before=$(cat InterfaceView.md5)
after=$(md5sum "$INTERFACEVIEW")
if [ "$before" == "$after" ]
then
echo 'Interface View has not changed, nothing to do
If you want to force generation of the skeletons anyway, type:
$ FORCE=1 taste-generate-skeletons
'
exit 0
fi
fi
# Detect models from Ellidiss tools v2, and convert them to 1.3
grep "version => \"2" "$INTERFACEVIEW" >/dev/null && {
echo '[INFO] Converting interface view from V2 to V1.3'
cp -f "$INTERFACEVIEW" "$output_dir"/__interfaceview-v2.aadl
TASTE --load-interface-view "$output_dir"/__interfaceview-v2.aadl --export-interface-view-to-1_3 "$INTERFACEVIEW"
};
md5sum "$INTERFACEVIEW" > InterfaceView.md5
mkdir -p "$output_dir" 2>/dev/null && shift || output_dir=.
echo '[INFO] Collecting ASN.1 files'
taste-extract-asn-from-design.exe -i "$INTERFACEVIEW" -j "$output_dir"/dataview-uniq.asn
echo '[INFO] Generating AADL data view'
asn2aadlPlus "$output_dir"/dataview-uniq.asn "$output_dir"/dataview-uniq.aadl -aadlv2
asn2aadlPlus "$output_dir"/dataview-uniq.asn "$output_dir"/dataview-uniq-v1.aadl
taste-extract-asn-from-design.exe -i "$INTERFACEVIEW" -k "$output_dir"/dataview-uniq.asn
echo '[INFO] Parsing AADL and generating skeletons with buildsupport'
buildsupport -i "$INTERFACEVIEW" -d "$output_dir"/dataview-uniq.aadl --gw --aadlv2 -o "$output_dir" --keep-case "$AADL_PROPERTIES" "$@"
cp -f __interfaceview-v2.aadl "$INTERFACEVIEW" 2>/dev/null || :
rm -f "$output_dir"/dataview-uniq.asn "$output_dir"/dataview-uniq.aadl "$output_dir"/dataview-uniq-v1.aadl \
"$output_dir"/__interfaceview-v2.aadl
#!/usr/bin/env python3
import sys
import re
try:
from typing import Tuple, List
except ImportError: