Commit | Line | Data |
---|---|---|
50e183a2 RS |
1 | /* Remote target glue for the rom68k ROM monitor. This was running on a |
2 | Motorola IDP board. | |
3 | ||
4 | Copyright 1988, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. | |
5 | ||
6 | This file is part of GDB. | |
7 | ||
8 | This program is free software; you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation; either version 2 of the License, or | |
11 | (at your option) any later version. | |
12 | ||
13 | This program is distributed in the hope that it will be useful, | |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | GNU General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with this program; if not, write to the Free Software | |
20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
21 | ||
06b8f5e4 RS |
22 | #include "defs.h" |
23 | #include "gdbcore.h" | |
24 | #include "target.h" | |
25 | #include "monitor.h" | |
1265e2d8 | 26 | #include "serial.h" |
06b8f5e4 RS |
27 | |
28 | void rom68k_open(); | |
06b8f5e4 RS |
29 | |
30 | /* | |
31 | * this array of registers need to match the indexes used by GDB. The | |
32 | * whole reason this exists is cause the various ROM monitors use | |
33 | * different strings than GDB does, and doesn't support all the | |
34 | * registers either. So, typing "info reg sp" becomes a "r30". | |
35 | */ | |
1265e2d8 SG |
36 | static char *rom68k_regnames[NUM_REGS] = { |
37 | "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7", | |
38 | "A0", "A1", "A2", "A3", "A4", "A5", "A6", "ISP", | |
39 | "SR", "PC" }; | |
06b8f5e4 RS |
40 | |
41 | /* | |
42 | * Define the monitor command strings. Since these are passed directly | |
43 | * through to a printf style function, we need can include formatting | |
44 | * strings. We also need a CR or LF on the end. | |
45 | */ | |
46 | ||
f17aed8b SG |
47 | static struct target_ops rom68k_ops = { |
48 | "rom68k", /* to_shortname */ | |
49 | "Rom68k debug monitor for the IDP Eval board", /* to_longname */ | |
06b8f5e4 RS |
50 | "Debug on a Motorola IDP eval board running the ROM68K monitor.\n\ |
51 | Specify the serial device it is connected to (e.g. /dev/ttya).", | |
f17aed8b SG |
52 | rom68k_open, /* to_open */ |
53 | monitor_close, /* to_close */ | |
54 | NULL, /* to_attach */ | |
55 | monitor_detach, /* to_detach */ | |
56 | monitor_resume, /* to_resume */ | |
57 | monitor_wait, /* to_wait */ | |
58 | monitor_fetch_registers, /* to_fetch_registers */ | |
59 | monitor_store_registers, /* to_store_registers */ | |
60 | monitor_prepare_to_store, /* to_prepare_to_store */ | |
61 | monitor_xfer_memory, /* to_xfer_memory */ | |
62 | monitor_files_info, /* to_files_info */ | |
63 | monitor_insert_breakpoint, /* to_insert_breakpoint */ | |
64 | monitor_remove_breakpoint, /* to_remove_breakpoint */ | |
65 | 0, /* to_terminal_init */ | |
66 | 0, /* to_terminal_inferior */ | |
67 | 0, /* to_terminal_ours_for_output */ | |
68 | 0, /* to_terminal_ours */ | |
69 | 0, /* to_terminal_info */ | |
70 | monitor_kill, /* to_kill */ | |
71 | monitor_load, /* to_load */ | |
72 | 0, /* to_lookup_symbol */ | |
73 | NULL, /* to_create_inferior */ | |
74 | monitor_mourn_inferior, /* to_mourn_inferior */ | |
75 | 0, /* to_can_run */ | |
76 | 0, /* to_notice_signals */ | |
b3b8d9bf | 77 | 0, /* to_stop */ |
f17aed8b SG |
78 | process_stratum, /* to_stratum */ |
79 | 0, /* to_next */ | |
80 | 1, /* to_has_all_memory */ | |
81 | 1, /* to_has_memory */ | |
82 | 1, /* to_has_stack */ | |
83 | 1, /* to_has_registers */ | |
84 | 1, /* to_has_execution */ | |
85 | 0, /* sections */ | |
86 | 0, /* sections_end */ | |
87 | OPS_MAGIC /* to_magic */ | |
06b8f5e4 RS |
88 | }; |
89 | ||
1265e2d8 SG |
90 | static char *rom68k_loadtypes[] = {"none", "srec", "default", NULL}; |
91 | static char *rom68k_loadprotos[] = {"none", NULL}; | |
92 | ||
93 | static struct monitor_ops rom68k_cmds = | |
94 | { | |
95 | 1, /* 1 for ASCII, 0 for binary */ | |
96 | ".\r\r", /* monitor init string */ | |
97 | "go \r", /* execute or usually GO command */ | |
98 | "go \r", /* continue command */ | |
99 | "st \r", /* single step */ | |
100 | "db %x\r", /* set a breakpoint */ | |
101 | "cb %x\r", /* clear a breakpoint */ | |
102 | 0, /* 0 for number, 1 for address */ | |
06b8f5e4 | 103 | { |
1265e2d8 SG |
104 | "pm %x %x\r", /* setmem.cmd (addr, value) */ |
105 | NULL, /* setreg.resp_delim */ | |
106 | NULL, /* setreg.term */ | |
107 | NULL, /* setreg.term_cmd */ | |
06b8f5e4 RS |
108 | }, |
109 | { | |
1265e2d8 SG |
110 | "dm %x 1\r", /* getmem.cmd (addr) */ |
111 | " ", /* getmem.resp_delim */ | |
112 | NULL, /* getmem.term */ | |
113 | NULL, /* getmem.term_cmd */ | |
06b8f5e4 RS |
114 | }, |
115 | { | |
1265e2d8 SG |
116 | "pr %s %x\r", /* setreg.cmd (name, value) */ |
117 | NULL, /* setreg.resp_delim */ | |
118 | NULL, /* setreg.term */ | |
119 | NULL /* setreg.term_cmd */ | |
06b8f5e4 RS |
120 | }, |
121 | { | |
1265e2d8 SG |
122 | "pr %s\r", /* getreg.cmd (name) */ |
123 | ": ", /* getreg.resp_delim */ | |
124 | "= ", /* getreg.term */ | |
125 | ".\r" /* getreg.term_cmd */ | |
06b8f5e4 | 126 | }, |
1265e2d8 SG |
127 | "dc\r", /* download command */ |
128 | "ROM68K :->", /* monitor command prompt */ | |
129 | "=", /* end-of-command delimitor */ | |
130 | ".\r", /* optional command terminator */ | |
131 | &rom68k_ops, /* target operations */ | |
132 | rom68k_loadtypes, /* loadtypes */ | |
133 | rom68k_loadprotos, /* loadprotos */ | |
134 | "9600", /* supported baud rates */ | |
135 | SERIAL_1_STOPBITS, /* number of stop bits */ | |
136 | rom68k_regnames /* registers names */ | |
137 | }; | |
06b8f5e4 RS |
138 | |
139 | void | |
140 | rom68k_open(args, from_tty) | |
141 | char *args; | |
142 | int from_tty; | |
143 | { | |
1265e2d8 | 144 | monitor_open (args, &rom68k_cmds, from_tty); |
06b8f5e4 RS |
145 | } |
146 | ||
147 | void | |
148 | _initialize_rom68k () | |
149 | { | |
150 | add_target (&rom68k_ops); | |
151 | ||
152 | /* this is the default, since it's the only baud rate supported by the hardware */ | |
153 | baud_rate = 9600; | |
154 | } |