-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcmdlineTest6.sh
More file actions
executable file
·124 lines (100 loc) · 3.49 KB
/
Copy pathcmdlineTest6.sh
File metadata and controls
executable file
·124 lines (100 loc) · 3.49 KB
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
#!/bin/bash
# This file is part of progstm32.
#
# Copyright (C) 2018, Rishi Gupta. All rights reserved.
#
# The progstm32 is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# The progstm32 is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
# License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, write to the Free Software Foundation,Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Connect FTDI USB-UART converter and then run this test
source jar_names.sh
PORT=/dev/ttyUSB0
WRTBIN=$(dirname '$0')/../../../workspace/testhex/demo.bin
WRTHEX=$(dirname '$0')/../../../workspace/testhex/demo.hex
READFW=$(dirname '$0')/../../../workspace/testhex/rd.bin
ENSEQ="-er -dtr 0 0 -rts 1 0"
EXSEQ="-ex -dtr 0 0 -rts 0 0"
### Don't modify anything after this line, run this test from tests folder only ###
cd "$(dirname '$0')"/../build
x=0;
jars_in_classpath=".:$spttyjar:$spcorejar:$progstm32uart:$progstm32app"
# read unprotect
echo -e "\n---> read unprotect"
progstm32 -d $PORT -k $ENSEQ $EXSEQ
x=$((x+1))
# write unprotect
echo -e "\n---> write unprotect"
progstm32 -d $PORT -o $ENSEQ $EXSEQ
x=$((x+1))
# get pid
echo -e "\n---> get pid"
progstm32 -d $PORT -p $ENSEQ $EXSEQ
x=$((x+1))
# get blid
echo -e "\n---> get bootloader version"
progstm32 -d $PORT -i $ENSEQ $EXSEQ
x=$((x+1))
# get bootloader version
echo -e "\n---> get protocol version"
progstm32 -d $PORT -z $ENSEQ $EXSEQ
x=$((x+1))
# mass erase
echo -e "\n---> mass erase"
progstm32 -d $PORT -e m $ENSEQ $EXSEQ
x=$((x+1))
# page by page erase
echo -e "\n---> page by page erase"
progstm32 -d $PORT -e 2 5 $ENSEQ $EXSEQ
x=$((x+1))
# write bin firmware file
echo -e "\n---> write bin firmware file"
progstm32 -d $PORT -w $WRTBIN -s 08000000 -bn $ENSEQ $EXSEQ
x=$((x+1))
# verify + write bin firmware file
echo -e "\n---> verify + write bin firmware file"
progstm32 -d $PORT -w $WRTBIN -s 08000000 -v -bn $ENSEQ $EXSEQ
x=$((x+1))
# mass erase + verify + write bin firmware file
echo -e "\n---> mass erase + verify + write bin firmware file"
progstm32 -d $PORT -e m -w $WRTBIN -s 08000000 -v -bn $ENSEQ $EXSEQ
x=$((x+1))
# write hex firmware file
echo -e "\n---> write hex firmware file"
progstm32 -d $PORT -w $WRTHEX -s 08000000 -ih $ENSEQ $EXSEQ
x=$((x+1))
# verify + write hex firmware file
echo -e "\n---> verify + write hex firmware file"
progstm32 -d $PORT -w $WRTHEX -s 08000000 -v -ih $ENSEQ $EXSEQ
x=$((x+1))
# mass erase + verify + write hex firmware file
echo -e "\n---> mass erase + verify + write hex firmware file"
progstm32 -d $PORT -e m -w $WRTHEX -s 08000000 -v -ih $ENSEQ $EXSEQ
x=$((x+1))
# read memory to stdout
echo -e "\n---> read memory to stdout"
progstm32 -d $PORT -r stdout -s 08000000 -l 1024 $ENSEQ $EXSEQ
x=$((x+1))
# read memory to file in file system
echo -e "\n---> read memory to file in file system"
progstm32 -d $PORT -r $READFW -s 08000000 -l 1024 $ENSEQ $EXSEQ
x=$((x+1))
# write protect
echo -e "\n---> write protect"
progstm32 -d $PORT -n 0 8 $ENSEQ $EXSEQ
x=$((x+1))
# read protect
echo -e "\n---> read protect"
progstm32 -d $PORT -j $ENSEQ $EXSEQ
x=$((x+1))
echo -e "\n---All $x Test Done---"
exit 0