-
Notifications
You must be signed in to change notification settings - Fork 2
/
qp_show_prg_files
executable file
·73 lines (62 loc) · 1.64 KB
/
qp_show_prg_files
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
#!/usr/bin/env bash
# Show list of Quartus Prime program files
# Time-stamp: <2024-01-25 11:31:13>
SCRIPT_NAME="${BASH_SOURCE##*/}"
if [ "$1" = '-h' ] || [ "$1" = '--help' ] || [ "$1" = '-help' ]; then
echo "Usage:"
echo " $SCRIPT_NAME [-v|--verbosity] [-s|--md5sum]"
echo " [-sv|vs]"
echo
echo "OPTIONS:"
echo " -v|--verbosity"
echo " Show compiler and target device."
echo " -s|--md5sum"
echo " Show md5sum for program file."
exit 0
fi
VERBOSITY=0
MD5SUM=0
for i in "$@"
do
case "$i" in
-v|--verbosity)
VERBOSITY=1;;
-s|--md5sum)
MD5SUM=1;;
-sv|-vs)
VERBOSITY=1
MD5SUM=1;;
*)
echo "ERROR! Unknown options!"
exit 1;;
esac
done
if [ "$(ls -A output_files 2>/dev/null)" ]; then
OUTDIR="./output_files/"
else
OUTDIR=""
fi
for i in `ls $OUTDIR 2>/dev/null | grep -e '.*\.\(sof\|pof\|jic\)$'`; do
FILE="$OUTDIR$i";
TIMESTAMP=$(date +%c -r "$FILE");
echo "$FILE : $TIMESTAMP";
if [ "$VERBOSITY" -eq 1 ]; then
if [[ "$FILE" =~ .*jic ]]; then
strings "$FILE" 2>/dev/null | (head -2 && tail -1)
else
strings "$FILE" 2>/dev/null | head -2
fi
fi
if [ "$MD5SUM" -eq 1 ]; then
echo "md5sum: $(md5sum "$FILE" | cut -d' ' -f1)"
fi
if [ "$MD5SUM" -eq 1 ] || [ "$VERBOSITY" -eq 1 ]; then
echo
fi
done
# 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: