blob: ac3ec74eaacfc50bda43b652c6a9aa020803b3e0 (
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
# This is a HACKED version of mcore-sim.exp that is intended to
# support running tests on Motorola's proprietry MCore simulator.
# It is quite likely that thia file will need to be modified in
# order for you to use Motorola's simulator.
# This is a list of toolchains that are supported on this board.
set_board_info target_install {mcore-elf, mcore-pe}
# Do general config stuff but do not load anything. "jim" was
# chosen because it does not exist.
load_generic_config "jim"
process_multilib_options ""
# We only support newlib on this target. We assume that all multilib
# options have been specified before we get here.
set_board_info compiler "[find_gcc]"
set_board_info cflags "[libgloss_include_flags] [newlib_include_flags]"
set_board_info ldflags "[libgloss_link_flags] [newlib_link_flags]"
# No linker script needed.
set_board_info ldscript ""
# The simulator doesn't return exit statuses and we need to indicate this;
# the standard GCC wrapper will work with this target.
set_board_info needs_status_wrapper 1
# Doesn't pass arguments or signals, can't return results, and doesn't
# do inferiorio.
set_board_info noargs 1
set_board_info gdb,nosignals 1
set_board_info gdb,noresults 1
set_board_info gdb,noinferiorio 1
# Rather than include the normal simulator support files,
# their functions are reproduced (and modified) here.
# --------------------------------------------------------------
proc sim_spawn { dest cmdline args } {
# Choose whoch simulator to run
## XXX - fixme - this should be automatic based on the
## multilib option.
## XXX - fixme - this should not be hardcoded.
set sim "/home/nickc/bin/linux/sim-be"
# set sim "/home/nickc/bin/linux/sim-le"
set simflags "-m abi"
# Create a script to run the program
set handle [open doit w]
puts $handle "load $cmdline"
puts $handle "reset"
puts $handle "g 28"
puts $handle "quit"
close $handle
return [eval remote_spawn host \{ $sim $simflags "-sdoit" \} $args]
}
proc sim_wait { dest timeout } {
return [remote_wait host $timeout]
}
proc sim_load { dest prog args } {
if ![file exists $prog] then {
perror "sim.exp: $prog to be downloaded does not exist."
verbose -log "$prog to be downloaded does not exist." 3
return [list "untested" ""]
}
set sim_time_limit 240
set output ""
set res [remote_spawn target "${prog}"]
if { $res <= 0 } {
return [list "fail" "remote_spawn failed"]
}
set state [remote_wait target $sim_time_limit]
set status [lindex $state 0]
set output [lindex $state 1]
verbose "Output is $output"
set status2 [check_for_board_status output]
if { $status2 >= 0 } {
set status $status2
}
# FIXME: Do we need to examine $status?
# Yes, we do--what if the simulator itself gets an error and coredumps?
verbose "Return status was: $status" 2
if { $status == 0 } {
set result "pass"
} else {
set result "fail"
}
return [list $result $output]
}
set_board_info protocol "sim"
# By default, assume the simulator is slow. This causes some tests
# to either be simplified or skipped completely.
set_board_info slow_simulator 1
# -----------------------------------------------------------
# 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 } {
## XXX - fixme - this should not be hardcoded.
## XXX - fixme - this should vary depending upon endianism selected.
return "/home/nickc/bin/linux/sim-be"
}
set_board_info is_simulator 1
|