OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 2 # Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
4 # BSD-style license that can be found in the LICENSE.md file. | 4 # BSD-style license that can be found in the LICENSE.md file. |
5 | 5 |
6 source $(dirname $(readlink -f $0))/devdiscovery.shlib | 6 source $(dirname $(readlink -f $0))/devdiscovery.shlib |
7 | 7 |
8 if [ -z "$1" -o ! -s "$1" ]; then | 8 if [ -z "$1" -o ! -s "$1" ]; then |
9 echo "$0: Expecting a snapshot file as fist argument." | 9 echo "$0: Expecting a snapshot file as fist argument." |
10 exit 1 | 10 exit 1 |
11 fi | 11 fi |
12 | 12 |
13 if [ -z "$PORT" ]; then | 13 if [ -z "$PORT" ]; then |
14 discover_devices | 14 discover_devices |
15 PORT=${STLINKPORT} | 15 PORT=${STLINKPORT} |
16 fi | 16 fi |
17 | 17 |
18 if [ ! -c "$PORT" ]; then | 18 if [ ! -c "$PORT" ]; then |
19 echo "$0: $PORT is not a valid character device." | 19 echo "$0: $PORT is not a valid character device." |
20 exit 2 | 20 exit 2 |
21 fi | 21 fi |
22 | 22 |
23 # Configure the port to LK's default tty speed. | 23 # Configure the port to LK's default tty speed. |
24 stty -F $PORT 115200 | 24 stty -F $PORT 115200 |
25 | 25 |
26 SIZE=`cat $1 | wc -c` | 26 SIZE=`cat $1 | wc -c` |
27 | 27 |
28 echo "fletch" >$PORT | 28 echo "dartino" >$PORT |
29 sleep 1 | 29 sleep 1 |
30 echo $SIZE >$PORT | 30 echo $SIZE >$PORT |
31 sleep 1 | 31 sleep 1 |
32 cat $1 >$PORT | 32 cat $1 >$PORT |
OLD | NEW |