Commit adad5e84 authored by Maxime Perrotin's avatar Maxime Perrotin

Improve helper scripts

parent 6aaeabf6
#!/bin/bash
INSTALLED_RTEMS_INFO="/opt/rtems_LATEST"
if [ -f "$INSTALLED_RTEMS_INFO" ] ; then
read OLD_RTEMS_MTIME OLD_RTEMS_FOLDER <<< $(cat "$INSTALLED_RTEMS_INFO")
else
OLD_RTEMS_MTIME=0
OLD_RTEMS_FOLDER=""
fi
echo Checking for new version of the RTEMS compiler...
URL_OF_NEW_RTEMS_INFO=http://download.tuxfamily.org/taste/RTEMS/LATEST
if wget -q -O /tmp/syncup.$$ "$URL_OF_NEW_RTEMS_INFO" ; then
read NEW_RTEMS_MTIME NEW_RTEMS_FOLDER NEW_RTEMS_URL <<< $(cat /tmp/syncup.$$)
rm -f /tmp/syncup.$$
if [ "$OLD_RTEMS_MTIME" -lt "$NEW_RTEMS_MTIME" ] ; then
echo Downloading updated version of the RTEMS compiler...
cd /opt
NEW_COMPILER_TARBALL=/tmp/newCompiler.$$.tar.bz2
if wget -O $NEW_COMPILER_TARBALL "$NEW_RTEMS_URL" ; then
if [ ! -z "$OLD_RTEMS_FOLDER" ] ; then
echo Removing old RTEMS compiler...
sudo rm -rf "$OLD_RTEMS_FOLDER"
fi
sudo tar jxvf $NEW_COMPILER_TARBALL || {
echo Failed to extract $NEW_COMPILER_TARBALL...
echo Aborting.
exit 1
}
rm -f $NEW_COMPILER_TARBALL
NEWBIN=$NEW_RTEMS_FOLDER/bin
if ! grep "^export PATH=.*$NEWBIN" $HOME/.bashrc.taste ; then
echo Adding new compiler "$NEWBIN" to PATH...
echo "export PATH=$NEWBIN:\$PATH" >> "$HOME/.bashrc.taste"
fi
echo $NEW_RTEMS_MTIME $NEW_RTEMS_FOLDER | \
sudo tee "$INSTALLED_RTEMS_INFO"
else
echo Failed to download the new compiler... Aborting.
exit 1
fi
fi
else
echo Failed to get "$URL_OF_NEW_RTEMS_INFO" ...
echo Aborting.
exit 1
fi
# Make sure the RTEMS_MAKEFILE_PATH_LEON is set
grep RTEMS_MAKEFILE_PATH_LEON $HOME/.bashrc.taste >/dev/null || {
read UNUSED FINAL_RTEMS_FOLDER <<< $(cat "$INSTALLED_RTEMS_INFO")
LEON2_FOLDER="$(find $FINAL_RTEMS_FOLDER -type d -name leon2)"
echo Adding RTEMS_MAKEFILE_PATH_LEON env var to settings.
echo "export RTEMS_MAKEFILE_PATH_LEON=\"$LEON2_FOLDER\"" >> $HOME/.bashrc.taste
}
#!/bin/bash -e #!/bin/bash -e
echo TASTE ACN Editor - Use only the SAVE button - not \"Save as..\" !
# TASTE ACN File creator
if [ -t 0 ] ; then
COLORON="\e[1m\e[32m"
REDCOLORON="\e[1m\e[31m"
COLOROFF="\e[0m"
else
COLORON=""
REDCOLORON=""
COLOROFF=""
fi
DATAVIEW=DataView.asn DATAVIEW=DataView.asn
...@@ -19,16 +30,17 @@ then ...@@ -19,16 +30,17 @@ then
then then
DATAVIEW="$1" DATAVIEW="$1"
else else
echo Invalid dataview filename - use $(basename "$0") \<filename.asn\> echo -e -n "${ERROR} Invalid dataview filename - "
echo use $(basename "$0") \<filename.asn\>
exit -1 exit -1
fi fi
fi fi
if [ -f "$DATAVIEW" ] if [ -f "$DATAVIEW" ]
then then
echo Creating dummy ACN file from existing DataView.asn echo -e "${INFO} Creating dummy ACN file from existing DataView.asn"
else else
echo First create your ASN.1 data model: run taste-create-data-view echo -e "${INFO} First create your ASN.1 data model: run taste-create-data-view"
exit -1 exit -1
fi fi
...@@ -44,6 +56,8 @@ fi ...@@ -44,6 +56,8 @@ fi
taste-update-data-view $1 taste-update-data-view $1
echo 'Everything went fine. if [ -z $NONINTERACTIVE ]
If you want to edit your ACN model, run taste-edit-acn-model then
' echo -e "${INFO} All OK"
echo -e "${INFO} If you want to edit your ACN model, run taste-edit-acn-model"
fi
#!/bin/bash -e #!/bin/bash -e
echo TASTE Dataview Editor - Use only the SAVE button - not \"Save as..\" ! # TASTE Dataview Editor
if [ -t 0 ] ; then
COLORON="\e[1m\e[32m"
REDCOLORON="\e[1m\e[31m"
COLOROFF="\e[0m"
else
COLORON=""
REDCOLORON=""
COLOROFF=""
fi
# Find a suitable text editor, in order of priority: kate, gvim, vi # Find a suitable text editor, in order of priority: kate, gvim, vi
...@@ -14,22 +25,33 @@ else ...@@ -14,22 +25,33 @@ else
EDITOR=vi EDITOR=vi
fi fi
if [ -f "DataView.asn" ]; if [ -f "DataView.asn" ]
then echo Opening existing DataView.asn; then
if [ -z $NONINTERACTIVE ]
then
echo -e "${INFO} Opening existing DataView.asn"
fi
else else
echo Creating a dummy ASN.1 file with a few type examples - feel free to add, edit, delete... if [ -z $NONINTERACTIVE ]
then
echo -e "${INFO} Creating a dummy ASN.1 file with a few type examples - feel free to add, edit, delete..."
fi
echo 'TASTE-Dataview DEFINITIONS ::= echo 'TASTE-Dataview DEFINITIONS ::=
BEGIN BEGIN
IMPORTS T-Int32, T-UInt32, T-Int8, T-UInt8, T-Boolean FROM TASTE-BasicTypes; IMPORTS T-Int32, T-UInt32, T-Int8, T-UInt8, T-Boolean FROM TASTE-BasicTypes;
-- A few simple types to start with ASN.1 -- ASN.1 Type definitions must start with an uppercase
MyInteger ::= T-UInt8 -- Field names in records (SEQUENCE) must start with a lowercase
-- Underscores are not allowed: use dash (hyphen)
MyReal ::= REAL (0.0 .. 1000.0) -- Simple types:
MyInteger ::= INTEGER (0..255)
MyReal ::= REAL (0.0 .. 1000.0)
MyBool ::= BOOLEAN MyBool ::= BOOLEAN
MyEnum ::= ENUMERATED { hello, world, how-are-you }
MyEnum ::= ENUMERATED { hello, world, howareyou } -- Complex types:
MySeq ::= SEQUENCE { MySeq ::= SEQUENCE {
input-data MyInteger, input-data MyInteger,
...@@ -56,7 +78,7 @@ fi ...@@ -56,7 +78,7 @@ fi
if [ -z $NONINTERACTIVE ] if [ -z $NONINTERACTIVE ]
then then
$EDITOR DataView.asn $EDITOR DataView.asn
echo Converting the data view to AADL... echo -e "${INFO} Converting the data view to AADL..."
fi fi
cp $(taste-config --prefix)/share/taste-types/taste-types.asn . cp $(taste-config --prefix)/share/taste-types/taste-types.asn .
...@@ -65,8 +87,8 @@ taste-update-data-view ...@@ -65,8 +87,8 @@ taste-update-data-view
if [ -z $NONINTERACTIVE ] if [ -z $NONINTERACTIVE ]
then then
echo 'Everything went fine. echo -e "${INFO} Data View created"
You can now run taste-create-interface-view or if you want to edit your data view, run taste-edit-data-view echo -e "${INFO} Run taste-edit-data-view to edit"
You can also create an ACN model of your data view by typing taste-create-acn-model echo -e "${INFO} taste-create-acn-model to specify binary encodings with ACN"
' echo -e "${INFO} taste-create-project to create a new TASTE project"
fi fi
#!/bin/bash -e #!/bin/bash -e
echo 'TASTE Project Creator - Use only the SAVE button - not \"Save as..\" !' echo 'TASTE Project Creator'
if [ -t 0 ] ; 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}"
if [ -f InterfaceView.aadl ] if [ -f InterfaceView.aadl ]
then then
echo 'InterfaceView.aadl already exists. Use taste-edit-project instead.' echo -e "${ERROR} InterfaceView.aadl already exists. Use taste-edit-project instead."
exit 0 exit 1
fi fi
if [ ! -f DataView.aadl ] if [ ! -f DataView.aadl ]
then then
echo 'Creating a default ASN.1 data model.' echo -e "${INFO} Creating a default ASN.1 data model."
NONINTERACTIVE=1 taste-create-data-view NONINTERACTIVE=1 taste-create-data-view
NONINTERACTIVE=1 taste-create-acn-model NONINTERACTIVE=1 taste-create-acn-model
else else
echo Using existing DataView.aadl echo -e "${INFO} Using existing DataView.aadl"
fi fi
# Add the components from the components library
FIRST=1
LIBDIR=$(taste-config --prefix)/share/components_library
for each in $LIBDIR/*
do
if [ $FIRST -eq 1 ]
then
EXTRA_CMD+='--edit-aadl '
else
EXTRA_CMD+=,
fi
EXTRA_CMD+=$each/interfaceview.aadl
FIRST=0
done
# Invoke the GUI from Ellidiss # Invoke the GUI from Ellidiss
TASTE --data-view DataView.aadl \ TASTE $EXTRA_CMD \
--data-view DataView.aadl \
--load-interface-view InterfaceView.aadl \ --load-interface-view InterfaceView.aadl \
--load-deployment-view DeploymentView.aadl \ --load-deployment-view DeploymentView.aadl \
--aadl-library $(taste-config --prefix)/share/ocarina/AADLv2/ocarina_components.aadl --aadl-library $(taste-config --prefix)/share/ocarina/AADLv2/ocarina_components.aadl
......
#!/bin/bash #!/bin/bash
if [ -t 0 ] ; then
COLORON="\e[1m\e[32m"
REDCOLORON="\e[1m\e[31m"
COLOROFF="\e[0m"
else
COLORON=""
REDCOLORON=""
COLOROFF=""
fi
if [ -f InterfaceView.aadl ] if [ -f InterfaceView.aadl ]
then then
echo 'Opening TASTE project' echo -e "${INFO} Opening TASTE project"
INTERFACEVIEW=InterfaceView.aadl INTERFACEVIEW=InterfaceView.aadl
else else
echo Error: missing InterfaceView.aadl echo -e "${ERROR} Missing InterfaceView.aadl"
echo First use taste-create-project to start a new project echo -e "${ERROR} First use taste-create-project to start a new project"
exit 1 exit 1
fi fi
grep -i taste-directives.aadl "$INTERFACEVIEW" >/dev/null && { grep -i taste-directives.aadl "$INTERFACEVIEW" >/dev/null && {
echo Your interface view needs to be upgraded\! echo -e "${ERROR} Your interface view needs to be upgraded\!"
echo Please upgrade it with: echo " Please upgrade it with:"
echo echo
echo " taste-upgrade-IF-view oldIFview newIFview" echo " taste-upgrade-IF-view oldIFview newIFview"
echo echo
echo ...and use the newIFview instead. echo " ...and use the newIFview instead."
exit 1 exit 1
} }
echo TASTE Project Editor - Use only the SAVE button - not \"Save as..\" !
# If there is no deployment view, only load interface view # If there is no deployment view, only load interface view
EXTRA_CMD= EXTRA_CMD=
if [ ! -f DeploymentView.aadl ] if [ ! -f DeploymentView.aadl ]
...@@ -47,5 +57,5 @@ do ...@@ -47,5 +57,5 @@ do
FIRST=0 FIRST=0
done done
echo TASTE $EXTRA_CMD --data-view DataView.aadl --load-deployment-view DeploymentView.aadl # 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 TASTE $EXTRA_CMD --data-view DataView.aadl --load-deployment-view DeploymentView.aadl
...@@ -45,7 +45,7 @@ if [ -z "$(echo -n $DATAVIEW)" ] ...@@ -45,7 +45,7 @@ if [ -z "$(echo -n $DATAVIEW)" ]
then then
if [ -f DataView.asn ] if [ -f DataView.asn ]
then then
echo -e '${INFO} Using file: DataView.asn' echo -e "${INFO} Using file: DataView.asn"
DATAVIEW=$(readlink -e DataView.asn) DATAVIEW=$(readlink -e DataView.asn)
else else
>&2 echo -e "${ERROR} No data view found" >&2 echo -e "${ERROR} No data view found"
......
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