taste-edit-concurrency-view 3.84 KB
Newer Older
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
1
#!/bin/bash
Maxime Perrotin's avatar
Maxime Perrotin committed
2 3 4 5 6 7 8 9 10 11 12 13
# TASTE Concurrency View Creator

# 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
14 15 16 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

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
47 48 49 50 51 52 53 54 55 56 57 58 59
# Check if models are from V2 and convert to V1_3 accordingly
V2=0
grep "version => \"2" InterfaceView.aadl >/dev/null && {
    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"
    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
60 61
if [ $error -eq 1 ]
then
Maxime Perrotin's avatar
Maxime Perrotin committed
62 63
    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"
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
    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
Maxime Perrotin's avatar
Maxime Perrotin committed
100
    echo -e "${ERROR} The following command failed:
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
101 102
${CMD}
"
Maxime Perrotin's avatar
Maxime Perrotin committed
103
    echo -e "${ERROR} Buildsupport reported errors - Fix your models before you can edit the Concurrency View"
Thanassis Tsiodras's avatar
Thanassis Tsiodras committed
104 105 106 107 108 109 110 111 112 113 114 115
    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
116 117 118 119

if [ $V2 -eq 0 ]
then
    TASTE-CV  --edit-aadl $PROCESS --update-properties $PROPERTIES 
120 121 122
else
    rm -rf ConcurrencyView
    mv "$tempdir"/ConcurrencyView .
Maxime Perrotin's avatar
Maxime Perrotin committed
123 124
fi