ddb.exp   [plain text]


#   Copyright (C) 1997 - 2002, 2003 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:
# bug-dejagnu@gnu.org

# 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
}