aboutsummaryrefslogtreecommitdiff
path: root/baseboards/basic-sim.exp
blob: e952a6ce35d8d5ef451408c3dae89db989d4feab (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
# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
#
# This file is part of DejaGnu.
#
# DejaGnu 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 3 of the License, or
# (at your option) any later version.
#
# DejaGnu 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 DejaGnu; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.

# find_sim -- find a usable simulator
# This proc is local to this file and is used to locate a simulator to use.
# First we see if SIM=foo was specified on the command line.
# Otherwise we search the build tree, then $PATH.

proc find_sim { target_alias sim_dir sim_name } {
    global tool_root_dir
    global SIM

    if {[info exists SIM]} {
	return $SIM
    }

    if {[is_remote host]} {
	if {![board_info host exists no_transform_name]} {
	    return ${target_alias}-${sim_name}
	} else {
	    return ${sim_name}
	}
    }

    # We have to search because tool_root_dir may actually point to that blasted
    # "target" subdirectory.
    set try [lookfor_file ${tool_root_dir} sim/${sim_dir}/${sim_name}]
    if { $try != "" } {
	return $try
    }
    return ${target_alias}-${sim_name}
}

proc setup_sim { subdir_name } {
    global target_alias
    global tool_root_dir
    global board

    if {[info exists target_alias]} {
	set tmp $target_alias
    } else {
	if {[board_info $board exists target_install]} {
	    set tmp [lindex [board_info $board target_install] 0]
	}
    }

    if {![board_info $board exists sim]} {
	set_board_info sim [find_sim $tmp $subdir_name run]
    }

    verbose "Using simulator [board_info $board sim]\n"
}

set_board_info is_simulator 1

# Most simulators need the image reloaded and reinitialized to rerun.
set_board_info gdb,do_reload_on_run 1