-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathflash-3384.expect
92 lines (76 loc) · 1.42 KB
/
flash-3384.expect
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
#!/usr/bin/expect -f
# host/port for ip2ser
set host "localhost"
set port 2300
# network configuration for the target board
set ip "192.168.1.100"
set netmask "255.255.255.0"
set gateway "192.168.1.1"
set mac "00:10:18:12:34:56"
# TFTP server address
set tftp "192.168.1.10"
set tftp_image "zephyr.img"
proc waitfor { a } {
expect {
timeout {
puts "TIMEOUT"
exit 1
}
$a {
return
}
}
}
proc reset_board { } {
puts "*******************************************************"
puts "RESETTING BOARD"
puts "*******************************************************"
send "\x1eR"
}
proc magic_sysrq { c } {
send "\x1e"
send "B"
sleep 1
send $c
sleep 1
}
set send_slow {10 .100}
set timeout 10
set pid [spawn telnet $host $port]
reset_board
waitfor "Enter '1', '2'"
send "p"
waitfor "Board IP Address"
send "$ip\r"
waitfor "Board IP Mask"
send "$netmask\r"
waitfor "Board IP Gateway"
send "$gateway\r"
waitfor "Board MAC Address"
send "$mac\r"
waitfor "Internal/External"
send "\r"
waitfor "Main Menu"
send "d"
waitfor "Board TFTP Server IP"
send "$tftp\r"
waitfor "Enter filename"
send "$tftp_image\r"
waitfor "Destination image"
send "3\r"
set timeout 45
waitfor "Store parameters to flash"
send "y\r"
waitfor "Main Menu"
send "b"
set timeout 60
waitfor "Scanning DS Channel"
send "cd cm_hal\rscan_stop\r"
waitfor "CM"
send "cd /\r"
sleep 2
send "\x1d"
waitfor "telnet>"
send "quit\r"
waitfor "Connection closed"
exit 0