* infrun.c (handle_command): Don't print TARGET_SIGNAL_0,
[deliverable/binutils-gdb.git] / gdb / rom68k-rom.c
CommitLineData
50e183a2
RS
1/* Remote target glue for the rom68k ROM monitor. This was running on a
2Motorola IDP board.
3
4 Copyright 1988, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
5
6This file is part of GDB.
7
8This program is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 2 of the License, or
11(at your option) any later version.
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with this program; if not, write to the Free Software
20Foundation, 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 27
2081365f
SG
28static void rom68k_open PARAMS ((char *args, int from_tty));
29
30static void
31rom68k_supply_register (regname, regnamelen, val, vallen)
32 char *regname;
33 int regnamelen;
34 char *val;
35 int vallen;
36{
37 int numregs;
38 int regno;
39
40 numregs = 1;
41 regno = -1;
42
43 if (regnamelen == 2)
44 switch (regname[0])
45 {
46 case 'S':
47 if (regname[1] == 'R')
48 regno = PS_REGNUM;
49 break;
50 case 'P':
51 if (regname[1] == 'C')
52 regno = PC_REGNUM;
53 break;
54 case 'D':
55 if (regname[1] != 'R')
56 break;
57 regno = D0_REGNUM;
58 numregs = 8;
59 break;
60 case 'A':
61 if (regname[1] != 'R')
62 break;
63 regno = A0_REGNUM;
64 numregs = 7;
65 break;
66 }
67 else if (regnamelen == 3)
68 switch (regname[0])
69 {
70 case 'I':
71 if (regname[1] == 'S' && regname[2] == 'P')
72 regno = SP_REGNUM;
73 }
74
75 if (regno >= 0)
76 while (numregs-- > 0)
77 val = monitor_supply_register (regno++, val);
78}
06b8f5e4
RS
79
80/*
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".
85 */
1265e2d8
SG
86static char *rom68k_regnames[NUM_REGS] = {
87 "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
88 "A0", "A1", "A2", "A3", "A4", "A5", "A6", "ISP",
89 "SR", "PC" };
06b8f5e4
RS
90
91/*
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.
95 */
96
32fa4b59 97static struct target_ops rom68k_ops;
06b8f5e4 98
1265e2d8
SG
99static char *rom68k_loadtypes[] = {"none", "srec", "default", NULL};
100static char *rom68k_loadprotos[] = {"none", NULL};
101
102static struct monitor_ops rom68k_cmds =
103{
104 1, /* 1 for ASCII, 0 for binary */
105 ".\r\r", /* monitor init string */
106 "go \r", /* execute or usually GO command */
107 "go \r", /* continue command */
108 "st \r", /* single step */
109 "db %x\r", /* set a breakpoint */
110 "cb %x\r", /* clear a breakpoint */
111 0, /* 0 for number, 1 for address */
06b8f5e4 112 {
1265e2d8
SG
113 "pm %x %x\r", /* setmem.cmd (addr, value) */
114 NULL, /* setreg.resp_delim */
115 NULL, /* setreg.term */
116 NULL, /* setreg.term_cmd */
06b8f5e4
RS
117 },
118 {
2081365f 119 "dm %x %x\r", /* getmem.cmd (addr, len) */
1265e2d8
SG
120 " ", /* getmem.resp_delim */
121 NULL, /* getmem.term */
122 NULL, /* getmem.term_cmd */
06b8f5e4
RS
123 },
124 {
1265e2d8
SG
125 "pr %s %x\r", /* setreg.cmd (name, value) */
126 NULL, /* setreg.resp_delim */
127 NULL, /* setreg.term */
128 NULL /* setreg.term_cmd */
06b8f5e4
RS
129 },
130 {
1265e2d8
SG
131 "pr %s\r", /* getreg.cmd (name) */
132 ": ", /* getreg.resp_delim */
133 "= ", /* getreg.term */
134 ".\r" /* getreg.term_cmd */
06b8f5e4 135 },
2081365f
SG
136 /* register_pattern */
137 "\\(\\w+\\)=\\([0-9a-fA-F]+\\( +[0-9a-fA-F]+\\b\\)*\\)",
138 rom68k_supply_register, /* supply_register */
1265e2d8
SG
139 "dc\r", /* download command */
140 "ROM68K :->", /* monitor command prompt */
141 "=", /* end-of-command delimitor */
142 ".\r", /* optional command terminator */
143 &rom68k_ops, /* target operations */
144 rom68k_loadtypes, /* loadtypes */
145 rom68k_loadprotos, /* loadprotos */
146 "9600", /* supported baud rates */
147 SERIAL_1_STOPBITS, /* number of stop bits */
148 rom68k_regnames /* registers names */
149 };
06b8f5e4
RS
150
151void
152rom68k_open(args, from_tty)
153 char *args;
154 int from_tty;
155{
1265e2d8 156 monitor_open (args, &rom68k_cmds, from_tty);
06b8f5e4
RS
157}
158
159void
160_initialize_rom68k ()
161{
32fa4b59
SG
162 init_monitor_ops (&rom68k_ops);
163
164 rom68k_ops.to_shortname = "rom68k";
165 rom68k_ops.to_longname = "Rom68k debug monitor for the IDP Eval board";
166 rom68k_ops.to_doc = "Debug on a Motorola IDP eval board running the ROM68K monitor.\n\
167Specify the serial device it is connected to (e.g. /dev/ttya).";
168 rom68k_ops.to_open = rom68k_open;
169
06b8f5e4
RS
170 add_target (&rom68k_ops);
171
172 /* this is the default, since it's the only baud rate supported by the hardware */
173 baud_rate = 9600;
174}
This page took 0.046941 seconds and 4 git commands to generate.