-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathqp_build
executable file
·143 lines (129 loc) · 3.57 KB
/
qp_build
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
#!/usr/bin/env bash
#
# Build Quartus Prime project in the current directory
#
# This script search Quartus Prime project and revision file(s) in the current directory
# and build it.
#
# Time-stamp: <2022-07-07 09:19:21>
echo "+------------------------------------------------------------------------+"
echo "| Build Quartus Prime project |"
echo "+------------------------------------------------------------------------+"
SCRIPT_NAME="${BASH_SOURCE##*/}"
if [ "$1" == '-h' ] || [ "$1" == '--help' ] || [ "$1" == '-help' ]; then
echo "Usage:"
echo " $SCRIPT_NAME [revision-number]"
echo ""
echo "ARGS:"
echo " <revision-number>"
echo " Quartus revision file number."
echo "OPTIONS:"
echo " -g"
echo " Run 'wish_msg' at the end of programming."
exit 0
fi
cnt=1
for p in `ls *.qpf 2>/dev/null`; do
prj[$cnt]=$p
cnt=`expr $cnt + 1`
done
if [ ${#prj[@]} -ne 1 ]; then
echo "ERROR! There must be only one *.qpf file in dir: $(pwd)"
exit 2
else
project=${prj[1]}
echo " project : '$project'"
fi
cnt=1
for p in `ls *.qsf 2>/dev/null`; do
rev[$cnt]=$p
cnt=`expr $cnt + 1`
done
EN_WISH_MSG=0
if [ "$1" == '-g' ] || [ "$2" == '-g' ]; then
EN_WISH_MSG=1
fi
revision="$1"
if [ "$1" == '-g' ] ; then
revision="$2"
fi
if [ ${#rev[@]} -gt 0 ]; then
case "$revision" in
1|2|3|4|5|6|7|8|9)
echo "Start compilation revision '${rev[$revision]}'"
num_revision=$revision
;;
0)
echo "Start compilation ALL revisions"
num_revision=$revision
;;
*)
if [ ${#rev[@]} -eq 1 ]; then
num_revision=1
else
echo " revisions:"
for (( i=1; i<${#rev[@]}+1; i++ )); do
echo "$i : ${rev[${i}]}"
done
echo "Select revision for build (0 - for all revision):"
read -r num_revision
fi
;;
esac
elif [ ${#rev[@]} -eq 0 ]; then
echo "ERROR! There must be at least one *.qsf file in dir: $(pwd)"
exit 3
fi
case "$num_revision" in
[1-9])
revision=${rev[$num_revision]}
;;
*)
echo "WARNING: will be build default revision"
revision=${rev[1]}
;;
esac
check_quartus_exit ()
{
if [ "$?" -ne 0 ]; then
echo "Error during compilation!"
if [ -z "$QP_END_CMSG_OFF" ]; then
wish_msg "ERROR!" "red" "$(pwd)/$project" &
fi
exit 4
fi
}
case "$num_revision" in
"")
echo "WARNING: Exit without compilation!"
exit 0
;;
0)
echo "Run compilation ..."
for (( i=1; i<${#rev[@]}+1; i++ )); do
echo "---------------------------------------------------"
echo "$i : ${rev[${i}]}"
quartus_sh --flow compile "$project" -c "${rev[${i}]}"
check_quartus_exit
done
;;
*)
echo " revision : '$revision'"
quartus_sh --flow compile "$project" -c "$revision"
check_quartus_exit
;;
esac
if [ "$EN_WISH_MSG" -eq 1 ]; then
if [ "$num_revision" -eq 0 ]; then
wish_msg "COMPILATION FINISHED" "green" "$(pwd)/$project" "revision: 'ALL revisions'" &
else
wish_msg "COMPILATION FINISHED" "green" "$(pwd)/$project" "revision: $revision" &
fi
fi
exit 0
# This is for the sake of Emacs.
# Local Variables:
# time-stamp-end: "$"
# time-stamp-format: "<%:y-%02m-%02d %02H:%02M:%02S>"
# time-stamp-start: "Time-stamp: "
# End: