OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [dejagnu/] [baseboards/] [mcore-moto-sim.exp] - Blame information for rev 1778

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# This is a HACKED version of mcore-sim.exp that is intended to
2
# support running tests on Motorola's proprietry MCore simulator.
3
 
4
# It is quite likely that thia file will need to be modified in
5
# order for you to use Motorola's simulator.
6
 
7
# This is a list of toolchains that are supported on this board.
8
set_board_info target_install {mcore-elf, mcore-pe}
9
 
10
# Do general config stuff but do not load anything.  "jim" was
11
# chosen because it does not exist.
12
load_generic_config "jim"
13
 
14
process_multilib_options ""
15
 
16
# We only support newlib on this target. We assume that all multilib
17
# options have been specified before we get here.
18
set_board_info compiler  "[find_gcc]"
19
set_board_info cflags    "[libgloss_include_flags] [newlib_include_flags]"
20
set_board_info ldflags   "[libgloss_link_flags] [newlib_link_flags]"
21
 
22
# No linker script needed.
23
set_board_info ldscript "";
24
 
25
# The simulator doesn't return exit statuses and we need to indicate this;
26
# the standard GCC wrapper will work with this target.
27
set_board_info needs_status_wrapper  1
28
 
29
# Doesn't pass arguments or signals, can't return results, and doesn't
30
# do inferiorio.
31
set_board_info noargs 1
32
set_board_info gdb,nosignals 1
33
set_board_info gdb,noresults 1
34
set_board_info gdb,noinferiorio 1
35
 
36
# Rather than include the normal simulator support files,
37
# their functions are reproduced (and modified) here.
38
# --------------------------------------------------------------
39
proc sim_spawn { dest cmdline args } {
40
 
41
    # Choose whoch simulator to run
42
    ## XXX - fixme - this should be automatic based on the
43
    ## multilib option.
44
    ## XXX - fixme - this should not be hardcoded.
45
    set sim "/home/nickc/bin/linux/sim-be"
46
#   set sim "/home/nickc/bin/linux/sim-le"
47
 
48
    set simflags "-m abi"
49
 
50
    # Create a script to run the program
51
    set handle [open doit w]
52
    puts $handle "load $cmdline"
53
    puts $handle "reset"
54
    puts $handle "g 28"
55
    puts $handle "quit"
56
    close $handle
57
 
58
    return [eval remote_spawn host \{ $sim $simflags "-sdoit" \} $args];
59
}
60
 
61
proc sim_wait { dest timeout } {
62
    return [remote_wait host $timeout];
63
}
64
 
65
proc sim_load { dest prog args } {
66
 
67
    if ![file exists $prog] then {
68
        perror "sim.exp: $prog to be downloaded does not exist."
69
        verbose -log "$prog to be downloaded does not exist." 3
70
        return [list "untested" ""];
71
    }
72
 
73
    set sim_time_limit 240
74
 
75
    set output "";
76
 
77
    set res [remote_spawn target "${prog}"];
78
 
79
    if { $res <= 0 } {
80
        return [list "fail" "remote_spawn failed"];
81
    }
82
 
83
    set state [remote_wait target $sim_time_limit];
84
    set status [lindex $state 0];
85
    set output [lindex $state 1];
86
    verbose "Output is $output";
87
 
88
    set status2 [check_for_board_status output];
89
    if { $status2 >= 0 } {
90
        set status $status2
91
    }
92
 
93
    # FIXME: Do we need to examine $status?
94
    # Yes, we do--what if the simulator itself gets an error and coredumps?
95
 
96
    verbose "Return status was: $status" 2
97
    if { $status == 0 } {
98
        set result "pass"
99
    } else {
100
        set result "fail"
101
    }
102
    return [list $result $output];
103
}
104
 
105
set_board_info protocol  "sim";
106
 
107
# By default, assume the simulator is slow.  This causes some tests
108
# to either be simplified or skipped completely.
109
set_board_info slow_simulator 1
110
 
111
# -----------------------------------------------------------
112
# find_sim -- find a usable simulator
113
# This proc is local to this file and is used to locate a simulator to use.
114
# First we see if SIM=foo was specified on the command line.
115
# Otherwise we search the build tree, then $PATH.
116
 
117
proc find_sim { target_alias sim_dir sim_name } {
118
 
119
    ## XXX - fixme - this should not be hardcoded.
120
    ## XXX - fixme - this should vary depending upon endianism selected.
121
 
122
    return "/home/nickc/bin/linux/sim-be";
123
}
124
 
125
set_board_info is_simulator 1;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.