-
Notifications
You must be signed in to change notification settings - Fork 1
/
ImportGenProducts.sh
executable file
·174 lines (144 loc) · 5.58 KB
/
ImportGenProducts.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#!/bin/bash
# This script imports the following items into the cordetfw-pus:
# - The code outputs generated by the CORDET Editor
# - The data pool csv description file generated by the CORDET Editor
# - The constants csv description file generated by the CORDET Editor
# - The code generated by the FW Profile Editor
#
# The script assumes that the above outputs have been placed or expanded
# into a directory which passed to the script as an argument through the
# -d option.
#
# The script makes certain assumptions about the structure of the cordetfw-pus
# directory structure. If this changes, the script may have to be adapted.
#
# The script must be run from the top-level directory of the cordetfw-pus project
# (e.g. /home/Projects/cordetfw-pus).
#
# Example: ./ImportGenProducts.sh -f -d="/home/ap/Downloads"
#
#====================================================================================
showHelp() {
echo "Options: "
echo "-c, --constant process the csv constant description file"
echo "-p, --datapool process the csv data pool description file"
echo "-e, --editor process the code generated by the CORDET Editor"
echo "-f, --fwprofile process the code generated by the FW Profile Editor"
echo "-d=, --dir= path to directory holding inputs, defaults to current directory"
echo "-h, --help this help text"
exit 0
}
# Parsing of command line parameters
for i in "$@"
do
case $i in
-d=*|--dir=*)
EDITOR_PATH=`echo $i | sed 's/[-a-zA-Z0-9]*=//'`
;;
-h|--help)
showHelp
;;
-c|--constant)
CONSTANT="YES"
;;
-p|--datapool)
DATAPOOL="YES"
;;
-f|--fwprofile)
FWPROFILE="YES"
;;
-e|--editor)
EDITOR="YES"
;;
esac
done
if [ "$EDITOR_PATH" == "" ]
then
EDITOR_PATH="."
fi
# Copy the files holding the packet accessor functions
if [ "$EDITOR" == "YES" ]
then
echo "--Copy the files holding the packet accessor functions--"
cp $EDITOR_PATH/pck/CrPsPckt*.h ./src/Pckt
fi
# Copy the files with the definition of the types and of the constants
if [ "$EDITOR" == "YES" ]
then
echo "--Copy the files with the definition of the types and of the constants--"
cp $EDITOR_PATH/pck/CrPsConstants.h ./tests/PusConfig
cp $EDITOR_PATH/pck/CrPsTypes.h ./tests/PusConfig
cp $EDITOR_PATH/pck/CrPsServTypeId.h ./tests/PusConfig
fi
# Copy the files for the PUS Definition Documents
if [ "$EDITOR" == "YES" ]
then
echo "--Copy the files for the PUS Definition Document--"
cp $EDITOR_PATH/spec/CrPsSpec.tex ./doc/pus/GeneratedTables
cp $EDITOR_PATH/icd/PUSExtensionCrPsEvtIdt.csv ./doc/pus/GeneratedTables
cp $EDITOR_PATH/icd/PUSExtensionCrPsFailCodet.csv ./doc/pus/GeneratedTables
cp $EDITOR_PATH/icd/PUSExtensionServiceOverview.csv ./doc/pus/GeneratedTables
cp $EDITOR_PATH/icd/PUSExtensionServices.csv ./doc/pus/GeneratedTables
echo "--Copy the files for the PUS ICD--"
cp $EDITOR_PATH/icd/*.tex ./doc/icd/GeneratedTables
fi
if [ "$CONSTANT" == "YES" ]
then
echo "--Copy the csv constant definition file--"
cp $EDITOR_PATH/Constants.csv ./doc/pus/GeneratedTables
fi
if [ "$DATAPOOL" == "YES" ]
then
echo "--Copy the csv datapool definition file--"
cp $EDITOR_PATH/Datapool.csv ./doc/pus/GeneratedTables
fi
# Copy the files for the data pool
if [ "$EDITOR" == "YES" ]
then
echo "--Copy the files for the data pool--"
rsync $EDITOR_PATH/dp/*.* ./src/DataPool --exclude CrPsConstants.h --exclude CrPsTypes.h
fi
# Copy the headers of the files which define the commands and reports
if [ "$EDITOR" == "YES" ]
then
echo "--Copy the files which define the commands and reports--"
cp $EDITOR_PATH/cfw/Ver/*.h ./src/Ver
cp $EDITOR_PATH/cfw/Hk/*.h ./src/Hk
cp $EDITOR_PATH/cfw/Evt/*.h ./src/Evt
cp $EDITOR_PATH/cfw/Mon/*.h ./src/Mon
cp $EDITOR_PATH/cfw/Lpt/*.h ./src/Lpt
cp $EDITOR_PATH/cfw/Tst/*.h ./src/Tst
cp $EDITOR_PATH/cfw/Scd/*.h ./src/Scd
cp $EDITOR_PATH/cfw/Dum/*.h ./src/Dum
fi
# Copy the files which define the configuration of the CORDET Framework
if [ "$EDITOR" == "YES" ]
then
echo "--Copy the files which define the configuration of the CORDET Framework--"
cp $EDITOR_PATH/cfw/PusConfig/*.h ./tests/PusConfig
fi
# Copy the code generated by the FW Profile Editor
if [ "$FWPROFILE" == "YES" ]
then
echo "--Copy the code generated by the FW Profile Editor--"
cp $EDITOR_PATH/CrPsProcCTL/CrPsProcCTL.c ./src/Mon
cp $EDITOR_PATH/CrPsProcCTL/CrPsProcCTL.h ./src/Mon
cp $EDITOR_PATH/CrPsMonFncPr/CrPsMonFncPr.h ./src/Mon
cp $EDITOR_PATH/CrPsMonFncPr/CrPsMonFncPr.c ./src/Mon
cp $EDITOR_PATH/CrPsCmd17s3Prgr/CrPsCmd17s3Prgr.h ./src/Tst
cp $EDITOR_PATH/CrPsCmd17s3Prgr/CrPsCmd17s3Prgr.c ./src/Tst
cp $EDITOR_PATH/CrPsCmd17s3Start/CrPsCmd17s3Start.h ./src/Tst
cp $EDITOR_PATH/CrPsCmd17s3Start/CrPsCmd17s3Start.c ./src/Tst
cp $EDITOR_PATH/CrPsCmdPrgrFail/CrPsCmdPrgrFail.c ./src/Ver
cp $EDITOR_PATH/CrPsCmdPrgrSucc/CrPsCmdPrgrSucc.c ./src/Ver
cp $EDITOR_PATH/CrPsCmdPrg*/CrPsCmdPrg*.h ./src/Ver
cp $EDITOR_PATH/CrPsCmdVerFail/CrPsCmdVerFail.c ./src/Ver
cp $EDITOR_PATH/CrPsCmdVerSucc/CrPsCmdVerSucc.c ./src/Ver
cp $EDITOR_PATH/CrPsCmdVer*/CrPsCmdVer*.h ./src/Ver
cp $EDITOR_PATH/CrPsPcktReroutingFail/CrPsPcktReroutingFail.c ./src/Ver
cp $EDITOR_PATH/CrPsPcktReroutingFail/CrPsPcktReroutingFail.h ./src/Ver
cp $EDITOR_PATH/CrPsDataPool/CrPsDataPool.c ./src/DataPool
cp $EDITOR_PATH/CrPsDataPool/CrPsDataPool.h ./src/DataPool
cp $EDITOR_PATH/CrPs*/*.png ./doc/images
cp $EDITOR_PATH/CrPs*/*.json ./doc/json
fi