Commit c1bfd4df authored by Thanassis Tsiodras's avatar Thanassis Tsiodras
parents d68aa908 bbabaf97
......@@ -6,3 +6,5 @@ sudo apt-get install -y --force-yes libusb-dev || exit 1
cd ${DIR} || exit 1
make -C ../misc/ZestSC1/linux/ || exit 1
mkdir -p ${PREFIX}/share/ZestSC1
cp -u ../misc/ZestSC1/linux/Lib/libZestSC1.a ${PREFIX}/share/ZestSC1/
......@@ -42,39 +42,51 @@ else
BEGIN
IMPORTS T-Int32, T-UInt32, T-Int8, T-UInt8, T-Boolean FROM TASTE-BasicTypes;
TASTE-Boolean ::= BOOLEAN
-- ASN.1 Type definitions must start with an uppercase
-- Field names in records (SEQUENCE) must start with a lowercase
-- Underscores are not allowed: use dash (hyphen)
-- Simple types:
MyInteger ::= INTEGER (0..255)
MyReal ::= REAL (0.0 .. 1000.0)
MyBool ::= BOOLEAN
MyEnum ::= ENUMERATED { hello, world, how-are-you }
-- MyInteger ::= INTEGER (0..255)
-- MyReal ::= REAL (0.0 .. 1000.0)
-- MyBool ::= BOOLEAN
-- MyEnum ::= ENUMERATED { hello, world, how-are-you }
-- Complex types:
MySeq ::= SEQUENCE {
input-data MyInteger,
output-data MyInteger,
validity ENUMERATED { valid, invalid }
}
MyChoice ::= CHOICE {
a BOOLEAN,
b MySeq
}
MySeqOf ::= SEQUENCE (SIZE (2)) OF MyEnum
-- 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 }
MyOctStr ::= OCTET STRING (SIZE (3))
END
' > DataView.asn
echo 'TASTE-Dataview DEFINITIONS ::= BEGIN
-- You can also declare constants
myVar MySeqOf ::= { hello, world }
-- In this ACN model, you can specify custom binary encoding rules for
-- your data types. For example if you require a specific memory layout
-- for a record, or need to add padding fields, define endianness, etc.
-- you can do that with ACN. Refer to the ACN user manual for details.
-- TASTE-Boolean []
END
' > DataView.asn
' > DataView.acn
fi
if [ -z $NONINTERACTIVE ]
......@@ -83,7 +95,7 @@ then
echo -e "${INFO} Converting the data view to AADL..."
fi
cp $(taste-config --prefix)/share/taste-types/taste-types.asn .
# cp $(taste-config --prefix)/share/taste-types/taste-types.asn .
taste-update-data-view
......
......@@ -25,7 +25,7 @@ if [ ! -f DataView.aadl ]
then
echo -e "${INFO} Creating a default ASN.1 data model."
NONINTERACTIVE=1 taste-create-data-view
NONINTERACTIVE=1 taste-create-acn-model
#NONINTERACTIVE=1 taste-create-acn-model
else
echo -e "${INFO} Using existing DataView.aadl"
fi
......
#!/bin/bash
# TASTE Concurrency View Creator
( cat ) | taste-progress-dialog.py &
log_pid=$!
# Initialise the progress bar
myfifo=/tmp/$$$RANDOM
mkfifo $myfifo
tail -f $myfifo | taste-progress-dialog.py &
function quit {
rm $myfifo
tailps=$(pstree -p $$ | grep tail | python -c "import sys, re; print re.search(r'tail\((.*)\)', [x for x in sys.stdin][0]).group(1)")
kill $tailps || xterm -e "echo Internal Error, unable to kill subprocess. Open a terminal and type 'pkill tail' to (hopefully) recover"
exit $1
}
# Logging with colors (only in a terminal)
if [ -t 1 ] ; then
COLORON="\e[1m\e[32m"
REDCOLORON="\e[1m\e[31m"
COLOROFF="\e[0m"
else
COLORON=""
REDCOLORON=""
COLOROFF=""
fi
INFO="${COLORON}[INFO]${COLOROFF}"
ERROR="${COLORON}[ERROR]${COLOROFF}"
ERROR="${REDCOLORON}[ERROR]${COLOROFF}"
error=0
NB_ARGS=3
......@@ -24,38 +35,37 @@ if [ $# -eq $AUTO ]
then
if [[ -f InterfaceView.aadl && -f DeploymentView.aadl && -f DataView.aadl ]]
then
echo 'Using InterfaceView.aadl, DeploymentView.aadl, DataView.aadl (defaults)'
echo -e "${INFO} 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)'
echo -e "${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"'
echo -e "${INFO} 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'
echo -e "${ERROR} Specified files missing or wrong number of parameters"
fi
fi
# Check if models are from V2 and convert to V1_3 accordingly
V2=0
grep "version => \"2" InterfaceView.aadl >/dev/null && {
echo '20 Analyse Interface View' > /proc/$log_pid/fd/0
echo '0-40 Analyse Interface View' > $myfifo
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"
echo '40 Analyse Deployment View' > /proc/$log_pid/fd/0
echo '40-60 Analyse Deployment View' > $myfifo
TASTE --load-deployment-view "$DEPLOYMENTVIEW" --export-deployment-view-to-1_3 __dv_1_3.aadl
DEPLOYMENTVIEW=__dv_1_3.aadl
V2=1
......@@ -66,10 +76,8 @@ if [ $error -eq 1 ]
then
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"
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)
exit -1
echo '100 Error' > $myfifo
quit 1
fi
AADL_PROPERTIES="$(taste-config --prefix)/share/config_ellidiss/TASTE_IV_Properties.aadl "
......@@ -77,13 +85,13 @@ AADL_PROPERTIES+="$(taste-config --prefix)/share/config_ellidiss/TASTE_DV_Proper
OCARINA_COMPONENTS="$(taste-config --prefix)/share/ocarina/AADLv2/ocarina_components.aadl"
# Tempdir will not be deleted - OS shall make the cleanup (likely at reboot)
echo '60 Parse Data View' > /proc/$log_pid/fd/0
echo '60-80 Parse Data View' > $myfifo
tempdir=$(mktemp -d)
mono $(which taste-extract-asn-from-design.exe) -i "$INTERFACEVIEW" -j "$tempdir"/dataview-uniq.asn
asn2aadlPlus "$tempdir"/dataview-uniq.asn "$tempdir"/dataview-uniq.aadl -aadlv2
mono $(which taste-extract-asn-from-design.exe) -i "$INTERFACEVIEW" -k "$tempdir"/dataview-uniq.asn
DATAVIEW="$tempdir"/dataview-uniq.aadl
echo '80 Generate Concurrency View' > /proc/$log_pid/fd/0
echo '80-100 Generate Concurrency View' > $myfifo
CMD="buildsupport -i ${INTERFACEVIEW}
-c ${DEPLOYMENTVIEW}
-d ${DATAVIEW}
......@@ -111,10 +119,8 @@ else
${CMD}
"
echo -e "${ERROR} Buildsupport reported errors - Fix your models before you can edit the Concurrency View"
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)
exit -2
echo '100 Error' > $myfifo
quit 2
fi
echo 'Running the Concurrency View editor from TASTE
......@@ -135,8 +141,6 @@ else
mv "$tempdir"/ConcurrencyView .
fi
echo '100 Done' > /proc/$log_pid/fd/0
echo '100 Done' > $myfifo
# 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
quit 0
......@@ -4,8 +4,30 @@
# this script builds a unique dataview.aadl file and calls buildsupport with --gw --aadlv2 -o $2 --keep-case
# Initialise the progress bar
( cat ) | taste-progress-dialog.py &
log_pid=$!
myfifo=/tmp/$$$RANDOM
mkfifo $myfifo
tail -f $myfifo | taste-progress-dialog.py &
function quit {
rm $myfifo
tailps=$(pstree -p $$ | grep tail | python -c "import sys, re; print re.search(r'tail\((.*)\)', [x for x in sys.stdin][0]).group(1)")
kill $tailps || xterm -e "echo Internal Error, unable to kill subprocess. Open a terminal and type 'pkill tail' to (hopefully) recover"
exit $1
}
# Logging with colors (only in a terminal)
if [ -t 1 ] ; then
COLORON="\e[1m\e[32m"
REDCOLORON="\e[1m\e[31m"
COLOROFF="\e[0m"
else
COLORON=""
REDCOLORON=""
COLOROFF=""
fi
INFO="${COLORON}[INFO]${COLOROFF}"
ERROR="${REDCOLORON}[ERROR]${COLOROFF}"
# 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".
......@@ -16,11 +38,9 @@ then
then
INTERFACEVIEW=InterfaceView.aadl
else
echo 'Error: interface view not found
Usage: [FORCE=1] taste-generate-skeletons [InterfaceView.aadl] [output-directory]'
# 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 -1
echo -e "${ERROR} Interface view not found
Usage: [FORCE=1] taste-generate-skeletons [InterfaceView.aadl] [output-directory]"
quit 1
fi
else
INTERFACEVIEW="$1"
......@@ -28,15 +48,13 @@ else
fi
grep -i taste-directives.aadl "$INTERFACEVIEW" >/dev/null && {
echo Your interface view needs to be upgraded\!
echo Please upgrade it with:
echo -e "${ERROR} Your interface view needs to be upgraded\!"
echo -e " Please upgrade it with:"
echo
echo " taste-upgrade-IF-view oldIFview newIFview"
echo -e " taste-upgrade-IF-view oldIFview newIFview"
echo
echo ...and use the newIFview instead.
# 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 1
echo -e " ...and use the newIFview instead."
quit 1
}
# Second, check if an output directory is passed as second argument
......@@ -55,13 +73,10 @@ then
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
'
# 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
echo -e "${INFO} Interface View has not changed since last call"
echo -e "${INFO} If you want to force generation of the skeletons anyway, type:"
echo -e "${INFO} $ FORCE=1 taste-generate-skeletons"
quit 0
fi
fi
......@@ -69,37 +84,37 @@ md5sum "$INTERFACEVIEW" > InterfaceView.md5
# 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'
echo '20 Analyse Interface View' > /proc/$log_pid/fd/0
echo -e "${INFO} Converting interface view from V2 to V1.3"
echo '0-40 Analysing Interface View' > $myfifo
cp -f "$INTERFACEVIEW" "$output_dir"/__interfaceview-v2.aadl
TASTE --load-interface-view "$output_dir"/__interfaceview-v2.aadl --export-interface-view-to-1_3 "$INTERFACEVIEW"
};
mkdir -p "$output_dir" 2>/dev/null && shift || output_dir=.
echo '[INFO] Collecting ASN.1 files'
echo '40 Collect and process ASN.1 models' > /proc/$log_pid/fd/0
echo -e "${INFO} Collecting ASN.1 files"
echo '40-80 Collecting ASN.1 models' > $myfifo
mono $(which taste-extract-asn-from-design.exe) -i "$INTERFACEVIEW" -j "$output_dir"/dataview-uniq.asn
echo '[INFO] Generating AADL data view'
echo -e "${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
mono $(which taste-extract-asn-from-design.exe) -i "$INTERFACEVIEW" -k "$output_dir"/dataview-uniq.asn
echo '[INFO] Parsing AADL and generating skeletons with buildsupport'
echo '80 Generate code skeletons' > /proc/$log_pid/fd/0
echo -e "${INFO} Parsing AADL and generating skeletons with buildsupport"
echo '80-100 Generate code skeletons' > $myfifo
buildsupport -i "$INTERFACEVIEW" -d "$output_dir"/dataview-uniq.aadl --gw --aadlv2 -o "$output_dir" --keep-case "$AADL_PROPERTIES" "$@"
if [ $? -eq 0 ]
then
echo '100 Done' > /proc/$log_pid/fd/0
echo -e "${INFO} Completed generation of code skeletons"
ret=0
else
echo -e "${ERROR} Generation of code skeletons failed"
ret=1
fi
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
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 $ret
echo '100 Done' > $myfifo
quit $ret
......@@ -9,7 +9,7 @@ from collections import deque
import PySide
from PySide import QtGui
from PySide.QtCore import QThread, Signal, QObject, Qt, Slot
from PySide.QtCore import QThread, Signal, QObject, Qt, Slot, QTimer
from PySide.QtGui import (QApplication,
QMessageBox,
......@@ -20,51 +20,63 @@ from PySide.QtGui import (QApplication,
log = deque()
class MyThread(QThread, QObject):
''' Thread waiting for data on stdin and sending signals to the prgress
bar in case something came in.
Text can be formatted:
* if the line starts with a number, it will use the value (range 0..100)
to update the progress bar, and it will display the text above the bar.
* if the line starts with @ERROR@ the process will stop and all the
history will be dispayed in a log dialog.
* in all other cases, the line is appended to the log
To update the bar, the line shall start with either a range or a numer.
e.g.
0-50 Doing something # The bar will progress from 0 to 49%
70 Something else # The bar will remain at 70%
Without a number/range, the text is only appended to the log
If the line starts with @ERROR@ the thread will stop
'''
text = Signal(str)
progress = Signal(int)
progress = Signal(int, int)
end = Signal()
error = Signal()
force_quit = False
def update_bar(self, from_value, to_value, text):
''' Request an update of the progress bar (value/range and text) '''
if 100 < from_value < 0 or 100 < to_value < 0:
return
self.progress.emit(from_value, to_value)
self.text.emit(text)
if from_value == 100:
self.end.emit()
self.force_quit = True
def run(self):
value = 10
while True:
# read from stdin without any buffering
if self.force_quit:
return
line = sys.stdin.readline()
if len(line) == 0:
print("Bye")
self.end.emit()
return
else:
split = line.split()
split = line.split(' ', 1)
try:
# check for format "NUMBER text"
possible_val = split[0]
value = int(possible_val)
if 100 < value < 0:
# check for a range format (e.g. 10-20)
left, right = split[0].split('-')
from_v, to_v = int(left), int(right)
if from_v > to_v:
raise ValueError
text = ' '.join(split[1:])
self.progress.emit(value)
self.text.emit(text)
if value == 100:
self.end.emit()
return
if 100 < from_v < 0 or 100 < to_v < 0:
raise ValueError
text = split[1]
self.update_bar(from_v, to_v, text)
except (ValueError, IndexError):
text = line
try:
# check for format "NUMBER text"
possible_val = split[0]
value = int(possible_val)
text = split[1]
self.update_bar(value, value, text)
except (ValueError, IndexError):
text = line
log.append(text)
try:
if split[0] == '@ERROR@':
......@@ -73,6 +85,7 @@ class MyThread(QThread, QObject):
except IndexError:
pass
class MyDialog(QDialog):
def __init__(self):
super(MyDialog, self).__init__()
......@@ -111,6 +124,21 @@ class MyDialog(QDialog):
def complete_or_cancel(self):
self.done = True
def periodic_update(self):
self.current_value += 5
if self.current_value >= self.target_value:
self.current_value = self.target_value
else:
QTimer.singleShot(200, self.periodic_update)
self.bar.setValue(self.current_value)
@Slot(int, int)
def reach_target(self, from_value, to_value):
self.current_value = from_value
self.target_value = to_value
self.bar.setValue(self.current_value)
QTimer.singleShot(100, self.periodic_update)
def closeEvent(self, e):
if not self.done:
e.ignore()
......@@ -129,11 +157,11 @@ def run_gui():
progress.setValue(0)
thread.text.connect (dialog.label.setText)
thread.end.connect (dialog.complete_or_cancel)
thread.end.connect (dialog.close)
thread.progress.connect (progress.setValue)
thread.error.connect (handle_error)
thread.text.connect (dialog.label.setText)
thread.end.connect (dialog.complete_or_cancel)
thread.end.connect (dialog.close)
thread.progress.connect (dialog.reach_target)
thread.error.connect (handle_error)
thread.start()
dialog.exec_()
......
......@@ -2,6 +2,18 @@
echo TASTE Data View Convertor - From ASN.1 to AADLV2
# Initialise the progress bar
myfifo=/tmp/$$$RANDOM
mkfifo $myfifo
tail -f $myfifo | taste-progress-dialog.py &
function quit {
rm $myfifo
tailps=$(pstree -p $$ | grep tail | python -c "import sys, re; print re.search(r'tail\((.*)\)', [x for x in sys.stdin][0]).group(1)")
kill $tailps || xterm -e "echo Internal Error, unable to kill subprocess. Open a terminal and type 'pkill tail' to (hopefully) recover"
exit $1
}
if [ -t 1 ] ; then
COLORON="\e[1m\e[32m"
REDCOLORON="\e[1m\e[31m"
......@@ -25,7 +37,7 @@ do
if [ ! -f "$f" ]
then
echo -e "${INFO} File not found: ${f}"
exit 1
quit 1
else
echo -e "${INFO} Using file: ${f}"
filename=$(readlink -e "$f")
......@@ -50,7 +62,7 @@ then
else
>&2 echo -e "${ERROR} No data view found"
echo -e "${INFO} Usage: taste-update-data-view <set of ASN.1 files>"
exit 1
quit 1
fi
if [ -f DataView.acn ]
then
......@@ -79,15 +91,17 @@ DATAVIEW+=" $(taste-config --prefix)/share/taste-types/taste-types.asn"
# can asn2aadlPlus with a call to uniq to filter out duplicate outputs
# due to multiple calls to the ASN.1 compiler
#asn2aadlPlus $DATAVIEW "$AADL" -aadlv2 2>&1 | uniq >&2
echo '0-100 Updating data view' > $myfifo
asn2aadlPlus $DATAVIEW "$AADL" -aadlv2 2>&1 > >(uniq >&2)
echo '100 Completed' > $myfifo
if [ "$?" = "1" ]
then
>&2 echo -e "${ERROR} Impossible to convert the dataview from ASN.1 to AADL"
echo -e "${INFO} Command: asn2aadlPlus ${DATAVIEW} ${AADL} -aadlv2"
exit 1
quit 1
else
echo -e "${INFO} All OK"
exit 0
quit 0
fi
......@@ -2150,7 +2150,7 @@ end crazyflie_v2.gnat;
processor stm32f4_discovery extends arm
properties
Deployment::Execution_Platform => GNAT_Runtime;
Deployment::Ada_Runtime => "stm32f407_discovery";
Deployment::Ada_Runtime => "stm32f407_discovery_full";
end stm32f4_discovery;
processor implementation stm32f4_discovery.gnat
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment