1 # Copyright (C) 1997-2019, 2020 Free Software Foundation, Inc.
3 # This file is part of DejaGnu.
5 # DejaGnu is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # DejaGnu is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with DejaGnu; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
19 # This is a HACKED version of mcore-sim.exp that is intended to
20 # support running tests on Motorola's proprietary MCore simulator.
22 # It is quite likely that this file will need to be modified in
23 # order for you to use Motorola's simulator.
25 # This is a list of toolchains that are supported on this board.
26 set_board_info target_install {mcore-elf, mcore-pe}
28 # Do general config stuff but do not load anything. "jim" was
29 # chosen because it does not exist.
30 load_generic_config "jim"
32 process_multilib_options ""
34 # We only support newlib on this target. We assume that all multilib
35 # options have been specified before we get here.
36 set_board_info cflags "[libgloss_include_flags] [newlib_include_flags]"
37 set_board_info ldflags "[libgloss_link_flags] [newlib_link_flags]"
39 # No linker script needed.
40 set_board_info ldscript ""
42 # The simulator doesn't return exit statuses and we need to indicate this;
43 # the standard GCC wrapper will work with this target.
44 set_board_info needs_status_wrapper 1
46 # Doesn't pass arguments or signals, can't return results, and doesn't
48 set_board_info noargs 1
49 set_board_info gdb,nosignals 1
50 set_board_info gdb,noresults 1
51 set_board_info gdb,noinferiorio 1
53 # Rather than include the normal simulator support files,
54 # their functions are reproduced (and modified) here.
55 # --------------------------------------------------------------
56 proc sim_spawn { dest cmdline args } {
58 # Choose whoch simulator to run
59 ## XXX - fixme - this should be automatic based on the
61 ## XXX - fixme - this should not be hardcoded.
62 set sim "/home/nickc/bin/linux/sim-be"
63 # set sim "/home/nickc/bin/linux/sim-le"
67 # Create a script to run the program
68 set handle [open doit w]
69 puts $handle "load $cmdline"
75 return [eval remote_spawn host \{ $sim $simflags "-sdoit" \} $args]
78 proc sim_wait { dest timeout } {
79 return [remote_wait host $timeout]
82 proc sim_load { dest prog args } {
84 if {![file exists $prog]} then {
85 perror "sim.exp: $prog to be downloaded does not exist."
86 verbose -log "$prog to be downloaded does not exist." 3
87 return [list "untested" ""]
90 set sim_time_limit 240
94 set res [remote_spawn target $prog]
97 return [list "fail" "remote_spawn failed"]
100 set state [remote_wait target $sim_time_limit]
101 set status [lindex $state 0]
102 set output [lindex $state 1]
103 verbose "Output is $output"
105 set status2 [check_for_board_status output]
106 if { $status2 >= 0 } {
110 verbose "Return status was: $status" 2
111 if { $status == 0 } {
116 return [list $result $output]
119 set_board_info protocol "sim"
121 # By default, assume the simulator is slow. This causes some tests
122 # to either be simplified or skipped completely.
123 set_board_info slow_simulator 1
125 # -----------------------------------------------------------
126 # find_sim -- find a usable simulator
127 # This proc is local to this file and is used to locate a simulator to use.
128 # First we see if SIM=foo was specified on the command line.
129 # Otherwise we search the build tree, then $PATH.
131 proc find_sim { target_alias sim_dir sim_name } {
133 ## XXX - fixme - this should not be hardcoded.
134 ## XXX - fixme - this should vary depending upon endianism selected.
136 return "/home/nickc/bin/linux/sim-be"
139 set_board_info is_simulator 1