File tree 1 file changed +23
-1
lines changed
1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ usage()
32
32
echo " ## Options:"
33
33
echo " ## For SWD: no mandatory options"
34
34
echo " ## For DFU: no mandatory options"
35
+ echo " ## Use '-serport=<com_port>' to request reset to bootloader mode"
35
36
echo " ## For Serial: 'serport=<com_port>'"
36
37
echo " ## com_port: serial identifier (mandatory). Ex: /dev/ttyS0"
37
38
echo " ##"
@@ -60,6 +61,26 @@ check_tool() {
60
61
fi
61
62
}
62
63
64
+ bootloaderMode () {
65
+ if [ ! -z $SERPORT ]; then
66
+ # Try to configure it at 1200 to restart
67
+ # in Bootloader mode
68
+ if [ -c $SERPORT ]; then
69
+ count=0
70
+ res=1
71
+ while [ $res -ne 0 ] && (( count++ < 5 )) ; do
72
+ # echo "Try to set $SERPORT at 1200"
73
+ stty -F $SERPORT 1200 > /dev/null 2>&1
74
+ res=$?
75
+ sleep 0.1
76
+ done
77
+ if [ $res -eq 0 ]; then
78
+ sleep 0.5
79
+ fi
80
+ fi
81
+ fi
82
+ }
83
+
63
84
upload () {
64
85
count=0
65
86
STATUS=1
@@ -112,7 +133,8 @@ case $PROTOCOL in
112
133
fi
113
134
PORT=$SERPORT ;;
114
135
2)
115
- PORT=' USB1' ;;
136
+ PORT=' USB1'
137
+ bootloaderMode;;
116
138
* )
117
139
echo " Protocol unknown!"
118
140
usage 4;;
You can’t perform that action at this time.
0 commit comments