aboutsummaryrefslogtreecommitdiff
path: root/config/ddb.exp
blob: 13a18e0dc08dfc31f83c7b182f2a795e7f95ad82 (plain)
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
93
94
95
96
#   Copyright (C) 1997 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  

# Please email any bugs, comments, and/or additions to this file to:
# DejaGnu@cygnus.com

# This file was written by Bob Manson (manson@cygnus.com)

# We use GDB to talk to a vr4300 board.
load_generic_config "base68k";

set_board_info shell_prompt "NEC010> ";
set_board_info download_command "load tty0\n";
set_board_info download_response "Downloading from";
set_board_info go_command "g -e";
set_board_info startaddr "a0100000"
set_board_info hex_startaddr "0xa0100000"
set_board_info go_response "(^|\[\r\n\])(Exception Cause|\[0-9a-z\]+ \[0-9a-z\]+ break|\\*\\*\\*EXIT code )\[^\r\n\]*\[\r\n\]"
set_board_info output_end "\[\r\n\](Exception Cause|\[0-9a-z\]+ \[0-9a-z\]+ break).*$"

# Reset the prompt to what GDB needs.
proc ${board}_init { dest } {
    global doing_ddb_init;
    if [is_remote host] {
	return;
    }

    if ![info exists doing_ddb_init] {
	set doing_ddb_init 1;

	for { set i 1; } { $i <= 3 } {incr i } {
	    remote_close $dest;
	    for { set x 0; } { $x < 3 } { incr x; } {
		set shell_id [remote_open $dest];
		if { $shell_id == "" || $shell_id < 0 } {
		    remote_reboot $dest;
		} else {
		    break;
		}
	    }

	    set count 0;
	    remote_send $dest "\n";
	    remote_expect $dest 20 {
		-re ".*PMON> $" {
		    remote_send $dest "set prompt \"NEC010> \"\n";
		    exp_continue;
		}
		-re "NEC010> $" { 
		    set i 10;
		}
		timeout { }
		-re "0x0" {
		    count++;
		    if(count<5) {
			exp_continue;
		    }
		}
	    }
	    if { $i < 3 }  {
		remote_reboot $dest;
	    }
	}
	remote_close $dest;
	unset doing_ddb_init;
    } else {
	return;
    }
}

set_board_info send_initial_cr  1
set_board_info dont_wait_for_prompt 1

# If no output format is specified, use objcopy.
if ![board_info $board exists output_format] {
    set tempfil [lookfor_file $tool_root_dir binutils/objcopy];
    if { $tempfil != "" } {
	set_board_info objcopy $tempfil
    } else {
	set_board_info objcopy [transform objcopy]
    }
    unset tempfil
}