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" | |
26 | ||
27 | extern int baud_rate; | |
28 | ||
29 | void rom68k_open(); | |
30 | void monitor_open(); | |
31 | ||
32 | /* | |
33 | * this array of registers need to match the indexes used by GDB. The | |
34 | * whole reason this exists is cause the various ROM monitors use | |
35 | * different strings than GDB does, and doesn't support all the | |
36 | * registers either. So, typing "info reg sp" becomes a "r30". | |
37 | */ | |
38 | static char *rom68k_regnames[] = { | |
39 | "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "a0", "a1", | |
40 | "a2", "a3", "a4", "a5", "a6", "usp", "ssp","pc", "", "", | |
41 | "", "", "", "", "", "", "", "", "", "", | |
42 | "", "", "", "", "", "", "", | |
43 | "", "", "", "", "", "", "", "", "", "", | |
44 | "", "", "", "", "", "", "", "", "", "", | |
45 | "", "", "", "", "", "", "", | |
46 | "", "", "", "", "", "", "", "", | |
47 | "", "", "", "", "", "", "", "", | |
48 | "", "", "", "", "", "", "", "", | |
49 | "", "", "", "", "", "", "", "", | |
50 | "", "", "", "", "", "", "", "", | |
51 | "", "", "", "", "", "", "", "", | |
52 | "", "", "", "", "", "", "", "", | |
53 | "", "", "", "", "", "", "", "" | |
54 | }; | |
55 | ||
56 | /* | |
57 | * Define the monitor command strings. Since these are passed directly | |
58 | * through to a printf style function, we need can include formatting | |
59 | * strings. We also need a CR or LF on the end. | |
60 | */ | |
61 | ||
62 | struct target_ops rom68k_ops = { | |
63 | "rom68k", | |
cf0c2bc1 | 64 | "Rom68k debug monitor for the IDP Eval board", |
06b8f5e4 RS |
65 | "Debug on a Motorola IDP eval board running the ROM68K monitor.\n\ |
66 | Specify the serial device it is connected to (e.g. /dev/ttya).", | |
67 | rom68k_open, | |
68 | monitor_close, | |
69 | monitor_attach, | |
70 | monitor_detach, | |
71 | monitor_resume, | |
72 | monitor_wait, | |
73 | monitor_fetch_register, | |
74 | monitor_store_register, | |
75 | monitor_prepare_to_store, | |
76 | monitor_xfer_inferior_memory, | |
77 | monitor_files_info, | |
78 | monitor_insert_breakpoint, | |
79 | monitor_remove_breakpoint, /* Breakpoints */ | |
80 | 0, | |
81 | 0, | |
82 | 0, | |
83 | 0, | |
84 | 0, /* Terminal handling */ | |
85 | monitor_kill, | |
86 | monitor_load, /* load */ | |
87 | 0, /* lookup_symbol */ | |
88 | monitor_create_inferior, | |
89 | monitor_mourn_inferior, | |
90 | 0, /* can_run */ | |
91 | 0, /* notice_signals */ | |
b3b8d9bf | 92 | 0, /* to_stop */ |
06b8f5e4 RS |
93 | process_stratum, |
94 | 0, /* next */ | |
95 | 1, | |
96 | 1, | |
97 | 1, | |
98 | 1, | |
99 | 1, /* all mem, mem, stack, regs, exec */ | |
100 | 0, | |
101 | 0, /* Section pointers */ | |
b3b8d9bf | 102 | OPS_MAGIC /* Always the last thing */ |
06b8f5e4 RS |
103 | }; |
104 | ||
105 | struct monitor_ops rom68k_cmds = { | |
106 | 1, /* 1 for ASCII, 0 for binary */ | |
107 | "\n", /* monitor init string */ | |
108 | "go \n", /* execute or usually GO command */ | |
109 | "go \n", /* continue command */ | |
110 | "st \n", /* single step */ | |
111 | "db %x\n", /* set a breakpoint */ | |
112 | "cb %x\r", /* clear a breakpoint */ | |
113 | 0, /* 0 for number, 1 for address */ | |
114 | { | |
115 | "pm %x %x\r", /* set memory */ | |
116 | "=", /* delimiter */ | |
117 | "", /* the result */ | |
118 | }, | |
119 | { | |
120 | "dm %x 1\r", /* get memory */ | |
121 | "", /* delimiter */ | |
122 | "", /* the result */ | |
123 | }, | |
124 | { | |
125 | "pr %s %x\r", /* set a register */ | |
126 | "", /* delimiter between registers */ | |
127 | "", /* the result */ | |
128 | }, | |
129 | { | |
130 | "pr %s\n", /* get a register */ | |
131 | ":", /* delimiter between registers */ | |
132 | "", /* the result */ | |
133 | }, | |
134 | "dc\n", /* download command */ | |
135 | "ROM68K :->", /* monitor command prompt */ | |
136 | "=", /* end-of-command delimitor */ | |
137 | ".\n", /* optional command terminator */ | |
138 | &rom68k_ops, /* target operations */ | |
b3b8d9bf RS |
139 | "none,srec,default", /* load types */ |
140 | "none", /* load protocols */ | |
cf51c601 RS |
141 | "9600", /* supported baud rates */ |
142 | 1, /* number of stop bits */ | |
06b8f5e4 RS |
143 | rom68k_regnames /* registers names */ |
144 | }; | |
145 | ||
146 | void | |
147 | rom68k_open(args, from_tty) | |
148 | char *args; | |
149 | int from_tty; | |
150 | { | |
151 | target_preopen(from_tty); | |
152 | push_target (&rom68k_ops); | |
153 | push_monitor (&rom68k_cmds); | |
154 | monitor_open (args, "rom68k", from_tty); | |
155 | } | |
156 | ||
157 | void | |
158 | _initialize_rom68k () | |
159 | { | |
160 | add_target (&rom68k_ops); | |
161 | ||
162 | /* this is the default, since it's the only baud rate supported by the hardware */ | |
163 | baud_rate = 9600; | |
164 | } |