home *** CD-ROM | disk | FTP | other *** search
- # Copyright (C) 1988, 1990, 1991, 1992, 1993 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
- # Please email any bugs, comments, and/or additions to this file to:
- # bug-dejagnu@prep.ai.mit.edu
-
- # This file was written by Rob Savoye. (rob@cygnus.com)
-
- #load_lib remote.exp
-
- #
- # set target variables only if needed.
- #
- global targetname
- global connectmode
- global env
-
- if ![info exists targetname] then {
- if [info exists env(TARGETNAME)] then {
- set targetname $env(TARGETNAME)
- } else {
- puts stderr "ERROR: Need a target name for the board."
- puts stderr " Use the --name option\n"
- exit 1
- }
- }
-
- # the default connect program to use
- if ![info exists connectmode] then {
- set connectmode "tip"
- warning "Using default of $connectmode for target communication."
- }
-
- #
- # bug_load -- load a file into the bug monitor
- #
- proc bug_load { shell_id file } {
- global OBJCOPY
-
- if $shell_id<0 then {
- warning "$file not executed because there is no target."
- return -1
- }
-
- # NOTE: this requires OBJCOPY to be tested first
- catch "exec $OBJCOPY -O srec $file $file.srec" result
- if ![string match "" $result] then {
- perror "Couldn't convert to srecord for downloading"
- return -1
- }
-
- send -i $shell_id "lo 0\r"
- expect {
- -i $shell_id "lo 0*" {
- verbose "Got load command echo" 0
- }
- -i $shell_id timeout {
- perror "Load command didn't echo back"
- return -1
- }
- }
-
- if [download $file.srec $shell_id]<0 then {
- return -1
- }
- catch "exec rm -foreach $file.srec"
- return 0
- }
-
- #
- # bug_execute -- execute a program
- #
- proc bug_execute { shell_id addr } {
- global shell_prompt
-
- if $shell_id<0 then {
- warning "$arg not executed because there is no target."
- return -1
- }
- send -i $shell_id "go $addr\r"
- verbose "Sent execute command"
- expect {
- -i $shell_id "*Effective address: $addr" {
- exp_continue
- }
- -i $shell_id -re "$shell_prompt.*$" {
- return 0
- }
- -i $shell_id timeout {
- error "Couldn't execute program (timed out)."
- return 1
- }
- }
- }
-
-