1 /* Remote target glue for the rom68k ROM monitor. This was running on a
4 Copyright 1988, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
6 This file is part of GDB.
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.
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.
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. */
28 static void rom68k_open PARAMS ((char *args, int from_tty));
31 rom68k_supply_register (regname, regnamelen, val, vallen)
47 if (regname[1] == 'R')
51 if (regname[1] == 'C')
55 if (regname[1] != 'R')
61 if (regname[1] != 'R')
67 else if (regnamelen == 3)
71 if (regname[1] == 'S' && regname[2] == 'P')
77 val = monitor_supply_register (regno++, val);
81 * this array of registers need to match the indexes used by GDB. The
82 * whole reason this exists is cause the various ROM monitors use
83 * different strings than GDB does, and doesn't support all the
84 * registers either. So, typing "info reg sp" becomes a "r30".
86 static char *rom68k_regnames[NUM_REGS] = {
87 "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
88 "A0", "A1", "A2", "A3", "A4", "A5", "A6", "ISP",
92 * Define the monitor command strings. Since these are passed directly
93 * through to a printf style function, we need can include formatting
94 * strings. We also need a CR or LF on the end.
97 static struct target_ops rom68k_ops;
99 static char *rom68k_loadtypes[] = {"srec", NULL};
100 static char *rom68k_loadprotos[] = {"none", NULL};
102 static char *rom68k_inits[] = {".\r\r", NULL}; /* Exits pm/pr & download cmds */
104 static struct monitor_ops rom68k_cmds =
107 rom68k_inits, /* monitor init string */
108 "go\r", /* continue command */
109 "st\r", /* single step */
110 NULL, /* No way to interrupt program */
111 "db %x\r", /* set a breakpoint */
112 "cb %x\r", /* clear a breakpoint */
113 "cb *\r", /* clear all breakpoints */
114 "fm %x %x %x\r", /* fill (start len val) */
116 "pm %x %x\r", /* setmem.cmdb (addr, value) */
117 "pm.w %x %x\r", /* setmem.cmdw (addr, value) */
118 "pm.l %x %x\r", /* setmem.cmdl (addr, value) */
119 NULL, /* setmem.cmdll (addr, value) */
120 NULL, /* setreg.resp_delim */
121 NULL, /* setreg.term */
122 NULL, /* setreg.term_cmd */
125 "dm %x %x\r", /* getmem.cmdb (addr, len) */
126 "dm.w %x %x\r", /* getmem.cmdw (addr, len) */
127 "dm.l %x %x\r", /* getmem.cmdl (addr, len) */
128 NULL, /* getmem.cmdll (addr, len) */
129 " ", /* getmem.resp_delim */
130 NULL, /* getmem.term */
131 NULL, /* getmem.term_cmd */
134 "pr %s %x\r", /* setreg.cmd (name, value) */
135 NULL, /* setreg.resp_delim */
136 NULL, /* setreg.term */
137 NULL /* setreg.term_cmd */
140 "pr %s\r", /* getreg.cmd (name) */
141 ": ", /* getreg.resp_delim */
142 "= ", /* getreg.term */
143 ".\r" /* getreg.term_cmd */
145 "dr\r", /* dump_registers */
146 /* register_pattern */
147 "\\(\\w+\\)=\\([0-9a-fA-F]+\\( +[0-9a-fA-F]+\\b\\)*\\)",
148 rom68k_supply_register, /* supply_register */
149 "dc\r", /* download command */
150 "Waiting for S-records from host... ", /* Load response */
151 "ROM68K :->", /* monitor command prompt */
152 "=", /* end-of-command delimitor */
153 ".\r", /* optional command terminator */
154 &rom68k_ops, /* target operations */
155 rom68k_loadtypes, /* loadtypes */
156 rom68k_loadprotos, /* loadprotos */
157 "9600", /* supported baud rates */
158 SERIAL_1_STOPBITS, /* number of stop bits */
159 rom68k_regnames, /* registers names */
160 MONITOR_OPS_MAGIC /* magic */
164 rom68k_open(args, from_tty)
168 monitor_open (args, &rom68k_cmds, from_tty);
172 _initialize_rom68k ()
174 init_monitor_ops (&rom68k_ops);
176 rom68k_ops.to_shortname = "rom68k";
177 rom68k_ops.to_longname = "Rom68k debug monitor for the IDP Eval board";
178 rom68k_ops.to_doc = "Debug on a Motorola IDP eval board running the ROM68K monitor.\n\
179 Specify the serial device it is connected to (e.g. /dev/ttya).";
180 rom68k_ops.to_open = rom68k_open;
182 add_target (&rom68k_ops);
184 /* this is the default, since it's the only baud rate supported by the hardware */