diff options
Diffstat (limited to 'download.tcl')
| -rwxr-xr-x | download.tcl | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/download.tcl b/download.tcl new file mode 100755 index 0000000..2e64865 --- /dev/null +++ b/download.tcl | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | #!/usr/bin/env expect | ||
| 2 | |||
| 3 | set core 0 | ||
| 4 | |||
| 5 | if {$::argc > 0} { | ||
| 6 | set core [lindex $::argv 0] | ||
| 7 | } | ||
| 8 | |||
| 9 | spawn nios2-terminal --instance 0 | ||
| 10 | expect -ex "connected to hardware target" | ||
| 11 | |||
| 12 | send "@[format %x [expr $core * 32768]]\n" | ||
| 13 | |||
| 14 | while {[gets stdin line] >= 0} { | ||
| 15 | send "$line\n" | ||
| 16 | expect -ex "$line" | ||
| 17 | } | ||
| 18 | |||
| 19 | # It's likely we ended with a very large zero-memory operation. We want to see | ||
| 20 | # two command bytes echoed back to us in order to guarantee that the zero | ||
| 21 | # operation has completely flushed to memory. | ||
| 22 | send "?" | ||
| 23 | expect -ex "?" | ||
| 24 | send "?" | ||
| 25 | expect -ex "?" | ||
| 26 | |||
| 27 | send "\004" | ||
| 28 | expect -ex "exiting due to ^D on remote" | ||
