|
Packit |
62fe53 |
# Copyright (C) 1997-2016 Free Software Foundation, Inc.
|
|
Packit |
62fe53 |
#
|
|
Packit |
62fe53 |
# This file is part of DejaGnu.
|
|
Packit |
62fe53 |
#
|
|
Packit |
62fe53 |
# DejaGnu is free software; you can redistribute it and/or modify it
|
|
Packit |
62fe53 |
# under the terms of the GNU General Public License as published by
|
|
Packit |
62fe53 |
# the Free Software Foundation; either version 3 of the License, or
|
|
Packit |
62fe53 |
# (at your option) any later version.
|
|
Packit |
62fe53 |
#
|
|
Packit |
62fe53 |
# DejaGnu is distributed in the hope that it will be useful, but
|
|
Packit |
62fe53 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
62fe53 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
62fe53 |
# General Public License for more details.
|
|
Packit |
62fe53 |
#
|
|
Packit |
62fe53 |
# You should have received a copy of the GNU General Public License
|
|
Packit |
62fe53 |
# along with DejaGnu; if not, write to the Free Software Foundation,
|
|
Packit |
62fe53 |
# Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
# This is a HACKED version of mcore-sim.exp that is intended to
|
|
Packit |
62fe53 |
# support running tests on Motorola's proprietary MCore simulator.
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
# It is quite likely that this file will need to be modified in
|
|
Packit |
62fe53 |
# order for you to use Motorola's simulator.
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
# This is a list of toolchains that are supported on this board.
|
|
Packit |
62fe53 |
set_board_info target_install {mcore-elf, mcore-pe}
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
# Do general config stuff but do not load anything. "jim" was
|
|
Packit |
62fe53 |
# chosen because it does not exist.
|
|
Packit |
62fe53 |
load_generic_config "jim"
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
process_multilib_options ""
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
# We only support newlib on this target. We assume that all multilib
|
|
Packit |
62fe53 |
# options have been specified before we get here.
|
|
Packit |
62fe53 |
set_board_info compiler "[find_gcc]"
|
|
Packit |
62fe53 |
set_board_info cflags "[libgloss_include_flags] [newlib_include_flags]"
|
|
Packit |
62fe53 |
set_board_info ldflags "[libgloss_link_flags] [newlib_link_flags]"
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
# No linker script needed.
|
|
Packit |
62fe53 |
set_board_info ldscript ""
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
# The simulator doesn't return exit statuses and we need to indicate this;
|
|
Packit |
62fe53 |
# the standard GCC wrapper will work with this target.
|
|
Packit |
62fe53 |
set_board_info needs_status_wrapper 1
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
# Doesn't pass arguments or signals, can't return results, and doesn't
|
|
Packit |
62fe53 |
# do inferiorio.
|
|
Packit |
62fe53 |
set_board_info noargs 1
|
|
Packit |
62fe53 |
set_board_info gdb,nosignals 1
|
|
Packit |
62fe53 |
set_board_info gdb,noresults 1
|
|
Packit |
62fe53 |
set_board_info gdb,noinferiorio 1
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
# Rather than include the normal simulator support files,
|
|
Packit |
62fe53 |
# their functions are reproduced (and modified) here.
|
|
Packit |
62fe53 |
# --------------------------------------------------------------
|
|
Packit |
62fe53 |
proc sim_spawn { dest cmdline args } {
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
# Choose whoch simulator to run
|
|
Packit |
62fe53 |
## XXX - fixme - this should be automatic based on the
|
|
Packit |
62fe53 |
## multilib option.
|
|
Packit |
62fe53 |
## XXX - fixme - this should not be hardcoded.
|
|
Packit |
62fe53 |
set sim "/home/nickc/bin/linux/sim-be"
|
|
Packit |
62fe53 |
# set sim "/home/nickc/bin/linux/sim-le"
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
set simflags "-m abi"
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
# Create a script to run the program
|
|
Packit |
62fe53 |
set handle [open doit w]
|
|
Packit |
62fe53 |
puts $handle "load $cmdline"
|
|
Packit |
62fe53 |
puts $handle "reset"
|
|
Packit |
62fe53 |
puts $handle "g 28"
|
|
Packit |
62fe53 |
puts $handle "quit"
|
|
Packit |
62fe53 |
close $handle
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
return [eval remote_spawn host \{ $sim $simflags "-sdoit" \} $args]
|
|
Packit |
62fe53 |
}
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
proc sim_wait { dest timeout } {
|
|
Packit |
62fe53 |
return [remote_wait host $timeout]
|
|
Packit |
62fe53 |
}
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
proc sim_load { dest prog args } {
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
if {![file exists $prog]} then {
|
|
Packit |
62fe53 |
perror "sim.exp: $prog to be downloaded does not exist."
|
|
Packit |
62fe53 |
verbose -log "$prog to be downloaded does not exist." 3
|
|
Packit |
62fe53 |
return [list "untested" ""]
|
|
Packit |
62fe53 |
}
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
set sim_time_limit 240
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
set output ""
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
set res [remote_spawn target "${prog}"]
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
if { $res <= 0 } {
|
|
Packit |
62fe53 |
return [list "fail" "remote_spawn failed"]
|
|
Packit |
62fe53 |
}
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
set state [remote_wait target $sim_time_limit]
|
|
Packit |
62fe53 |
set status [lindex $state 0]
|
|
Packit |
62fe53 |
set output [lindex $state 1]
|
|
Packit |
62fe53 |
verbose "Output is $output"
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
set status2 [check_for_board_status output]
|
|
Packit |
62fe53 |
if { $status2 >= 0 } {
|
|
Packit |
62fe53 |
set status $status2
|
|
Packit |
62fe53 |
}
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
verbose "Return status was: $status" 2
|
|
Packit |
62fe53 |
if { $status == 0 } {
|
|
Packit |
62fe53 |
set result "pass"
|
|
Packit |
62fe53 |
} else {
|
|
Packit |
62fe53 |
set result "fail"
|
|
Packit |
62fe53 |
}
|
|
Packit |
62fe53 |
return [list $result $output]
|
|
Packit |
62fe53 |
}
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
set_board_info protocol "sim"
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
# By default, assume the simulator is slow. This causes some tests
|
|
Packit |
62fe53 |
# to either be simplified or skipped completely.
|
|
Packit |
62fe53 |
set_board_info slow_simulator 1
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
# -----------------------------------------------------------
|
|
Packit |
62fe53 |
# find_sim -- find a usable simulator
|
|
Packit |
62fe53 |
# This proc is local to this file and is used to locate a simulator to use.
|
|
Packit |
62fe53 |
# First we see if SIM=foo was specified on the command line.
|
|
Packit |
62fe53 |
# Otherwise we search the build tree, then $PATH.
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
proc find_sim { target_alias sim_dir sim_name } {
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
## XXX - fixme - this should not be hardcoded.
|
|
Packit |
62fe53 |
## XXX - fixme - this should vary depending upon endianism selected.
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
return "/home/nickc/bin/linux/sim-be"
|
|
Packit |
62fe53 |
}
|
|
Packit |
62fe53 |
|
|
Packit |
62fe53 |
set_board_info is_simulator 1
|