taste-edit-concurrency-view 4.76 KB
Newer Older
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
1
#!/bin/bash
Maxime Perrotin's avatar
Maxime Perrotin committed
2 3
# TASTE Concurrency View Creator

4 5 6
( cat ) | taste-progress-dialog.py &
log_pid=$!

Maxime Perrotin's avatar
Maxime Perrotin committed
7 8 9 10 11 12 13 14 15 16
# Logging with colors (only in a terminal)
if [ -t 1 ] ; then
    COLORON="\e[1m\e[32m"
    COLOROFF="\e[0m"
else
    COLORON=""
    COLOROFF=""
fi
INFO="${COLORON}[INFO]${COLOROFF}"
ERROR="${COLORON}[ERROR]${COLOROFF}"
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

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

Maxime Perrotin's avatar
Maxime Perrotin committed
50 51 52
# Check if models are from V2 and convert to V1_3 accordingly
V2=0
grep "version => \"2" InterfaceView.aadl >/dev/null && {
53
    echo '20 Analyse Interface View' > /proc/$log_pid/fd/0
Maxime Perrotin's avatar
Maxime Perrotin committed
54 55 56 57
    echo -e "${INFO} Converting interface view from V2 to V1.3"
    TASTE --load-interface-view InterfaceView.aadl --export-interface-view-to-1_3 __iv_1_3.aadl
    INTERFACEVIEW=__iv_1_3.aadl
    echo -e "${INFO} Converting deployment view from V2 to V1.3"
58
    echo '40 Analyse Deployment View' > /proc/$log_pid/fd/0
Maxime Perrotin's avatar
Maxime Perrotin committed
59 60 61 62 63 64
    TASTE --load-deployment-view "$DEPLOYMENTVIEW" --export-deployment-view-to-1_3 __dv_1_3.aadl
    DEPLOYMENTVIEW=__dv_1_3.aadl
    V2=1
};


Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
65 66
if [ $error -eq 1 ]
then
Maxime Perrotin's avatar
Maxime Perrotin committed
67 68
    echo -e "${ERROR} 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"
69 70 71
    echo '100 Error' > /proc/$log_pid/fd/0
    # Must kill the cat command still running in the background to release TASTE GUI
    kill $(pstree -p $(jobs -x echo %1) | grep cat | cut -d \( -f 3 | cut -d \) -f 1)
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
72 73 74 75 76 77 78 79
    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)
80
echo '60 Parse Data View' > /proc/$log_pid/fd/0
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
81
tempdir=$(mktemp -d)
82
mono $(which taste-extract-asn-from-design.exe) -i "$INTERFACEVIEW" -j "$tempdir"/dataview-uniq.asn
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
83
asn2aadlPlus "$tempdir"/dataview-uniq.asn "$tempdir"/dataview-uniq.aadl -aadlv2
84
mono $(which taste-extract-asn-from-design.exe) -i "$INTERFACEVIEW" -k "$tempdir"/dataview-uniq.asn
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
85
DATAVIEW="$tempdir"/dataview-uniq.aadl
86
echo '80 Generate Concurrency View' > /proc/$log_pid/fd/0
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
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
Maxime Perrotin's avatar
Maxime Perrotin committed
110
    echo -e "${ERROR} The following command failed:
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
111 112
${CMD}
"
Maxime Perrotin's avatar
Maxime Perrotin committed
113
    echo -e "${ERROR} Buildsupport reported errors - Fix your models before you can edit the Concurrency View"
114 115 116
    echo '100 Error' > /proc/$log_pid/fd/0
    # Must kill the cat command still running in the background to release TASTE GUI
    kill $(pstree -p $(jobs -x echo %1) | grep cat | cut -d \( -f 3 | cut -d \) -f 1)
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
117 118 119 120 121 122 123 124 125 126 127 128
    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
Maxime Perrotin's avatar
Maxime Perrotin committed
129 130 131 132

if [ $V2 -eq 0 ]
then
    TASTE-CV  --edit-aadl $PROCESS --update-properties $PROPERTIES 
133 134 135
else
    rm -rf ConcurrencyView
    mv "$tempdir"/ConcurrencyView .
Maxime Perrotin's avatar
Maxime Perrotin committed
136 137
fi

138 139 140 141 142
echo '100 Done' > /proc/$log_pid/fd/0

# Must kill the cat command still running in the background to release TASTE GUI
kill $(pstree -p $(jobs -x echo %1) | grep cat | cut -d \( -f 3 | cut -d \) -f 1)
exit 0