1
# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software
4
# This file is part of DejaGnu.
6
# DejaGnu is free software; you can redistribute it and/or modify it
7
# under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
11
# DejaGnu is distributed in the hope that it will be useful, but
12
# WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
# General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with DejaGnu; if not, write to the Free Software Foundation,
18
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
# This file was written by Bob Manson (manson@cygnus.com)
22
# Reset the prompt to what GDB needs.
23
proc ${board}_init { dest } {
26
if ![info exists doing_ddb_init] {
30
for { set x 0 } { $x < 3 } { incr x } {
31
set shell_id [remote_open $dest]
32
if { $shell_id == "" || $shell_id < 0 } {
39
set shell_prompt [board_info $dest shell_prompt]
41
remote_send $dest "\n"
42
remote_expect $dest 10 {
44
remote_send $dest "set prompt \"$shell_prompt\"\n"
47
-re ".*${shell_prompt}$" { }
56
proc ddb_ether_load { dest prog args } {
57
for { set x 0 } { $x < 3 } { incr x } {
58
set result [eval remote_spawn \{$dest\} \{$prog\} $args]
62
set result [remote_wait $dest 300]
63
set status [lindex $result 0]
64
set output [lindex $result 1]
67
return [list "fail" $output]
69
return [list "pass" $output]
74
return [list "fail" ""]
77
proc ddb_ether_ld { dest prog } {
78
if ![board_info $dest exists tftpdir] {
79
perror "Must set_board_info tftpdir for [board_info $dest name]"
83
if ![board_info $dest exists fileid] {
84
set spawn_id [remote_open $dest]
85
if { $spawn_id == "" || $spawn_id < 0 } {
91
set shell_prompt [board_info $dest shell_prompt]
93
remote_send $dest "\n"
94
remote_expect $dest 10 {
95
-re ".*${shell_prompt}$" { }
100
set basename "a.out.[pid]"
101
set file "[board_info $dest tftpdir]/$basename"
102
set file [remote_download build $prog $file]
104
perror "download to tftp area failed"
109
remote_send $dest "boot /$basename\n"
111
remote_expect $dest 30 {
112
-re "Loading.*Entry address is.*${shell_prompt}$" { }
113
-re "invalid executable.*${shell_prompt}$" {
117
remote_send $dest "boot /$basename\n"
121
-re ".*${shell_prompt}$" {
128
remote_file build delete $file
129
if { $state == "fail" } {
135
proc ddb_ether_spawn { dest prog args } {
136
set state [ddb_ether_ld $dest $prog]
138
if { $state != "pass" } {
141
remote_send $dest "g\n"
142
remote_expect $dest 5 {
143
-re "g\[\r\n\]\[\r\n\]?" { }
147
return [board_info $dest fileid]
150
proc ddb_ether_wait { dest timeout } {
152
set shell_prompt [board_info $dest shell_prompt]
154
remote_expect $dest $timeout {
155
-re "^g\[\r\n\]\[\r\n\]?" {
156
if { $output != "" } {
157
append output $expect_out(buffer)
161
-re "(.*)$shell_prompt" {
162
append output $expect_out(1,string)
163
set status [check_for_board_status output]
165
return [list $status $output]
167
if [regexp "Exception Cause=" $output] {
169
return [list -1 $output]
171
return [list 0 $output]
175
append output $expect_out(buffer)
176
if { [string length $output] < 512000 } {
188
set_board_info send_initial_cr 1
189
set_board_info protocol "ddb_ether"
190
set_board_info shell_prompt "NEC010> "