summaryrefslogtreecommitdiff
path: root/download.tcl
blob: 2e6486570bfece3f449afa0ffa342b2408d87d71 (plain) (blame)
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
#!/usr/bin/env expect

set core 0

if {$::argc > 0} {
    set core [lindex $::argv 0]
}

spawn nios2-terminal --instance 0
expect -ex "connected to hardware target"

send "@[format %x [expr $core * 32768]]\n"

while {[gets stdin line] >= 0} {
    send "$line\n"
    expect -ex "$line"
}

# It's likely we ended with a very large zero-memory operation. We want to see
# two command bytes echoed back to us in order to guarantee that the zero
# operation has completely flushed to memory.
send "?"
expect -ex "?"
send "?"
expect -ex "?"

send "\004"
expect -ex "exiting due to ^D on remote"