aboutsummaryrefslogtreecommitdiff
path: root/config/tic80.exp
blob: ef12778309e47a9640c6af47b636d627e2ed3edf (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
#
# Nasty ugly stuff.
#
# We have to maintain two connections to the DOS box where the board
# is being held. One of them runs an I/O monitor process, while the other
# is used to actually start the program under test running on the board.
#

proc tic80_load { dest prog args } {
    set dos_box [board_info $dest dos_host];

    remote_spawn $dos_box [board_info $dest io_program];

    set status [remote_ld $dest $prog];

    if { $status != "pass" } {
	return $status;
    }

    set result [remote_wait $dos_box 300];
    set output [lindex $result 1];
    if { [lindex $result 0] < 0 } {
	if [board_info $dos_box exists fileid] {
	    dos_interrupt_job $dos_box;
	} else {
	    remote_close $dos_box;
	}
    }

    set status "fail";
    regsub "(\\*\\*\\* EXIT code \[0-9\]+\[\r\n]+).*$" "$output" "\\1" output;
    verbose "board out is $output";
    set bstatus [check_for_board_status output];
    if { [lindex $result 0] >= 0 } {
	if { $bstatus == 0 } {
	    set status "pass";
	}
    }
    remote_file build delete "a.fix";
    return [list $status $output];
}

proc tic80_ld { dest prog } {
    set dos_box [board_info $dest dos_host];
    set dopush 0;

    if { [remote_swap_conn $dos_box] == "fail" } {
	if { [remote_push_conn $dos_box] == "fail" } {
	    set dopush 1;
	}
	remote_open $dos_box;
    }
    set prog [remote_download $dos_box $prog "a.fix"];

    remote_spawn $dos_box "[board_info $dest start_program] $prog";
    remote_expect $dos_box 10 {
	-re "file\[(\]s\[)\] copied" {}
    }
    sleep 3;
    dos_interrupt_job $dos_box;
    if { $dopush } {
	remote_push_conn $dos_box;
    } else {
	remote_swap_conn $dos_box;
    }
    return "pass";
}
#
# Close the connection to the DOS box.
#
proc tic80_close { host } {
    set dos_box [board_info $host dos_host];

    return [remote_close $dos_box];
}

set_board_info protocol "tic80";
set_board_info gdb,use_standard_load 1;
set_board_info gdb,no_push_conn 1;
set_board_info gdb,do_reload_on_run 1;
set_board_info gdb,use_breakpoint_for_stub 1