1 /* Remote debugging interface for EST-300 ICE, for GDB
2 Copyright 1994 Free Software Foundation, Inc.
3 Contributed by Cygnus Support.
5 Written by Steve Chamberlain for Cygnus Support.
6 Re-written by Stu Grossman of Cygnus Support
8 This file is part of GDB.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
30 static void est_open
PARAMS ((char *args
, int from_tty
));
33 est_supply_register (regname
, regnamelen
, val
, vallen
)
47 if (regname
[1] != 'R')
52 if (regname
[1] != 'C')
57 if (regname
[1] < '0' || regname
[1] > '7')
59 regno
= regname
[1] - '0' + D0_REGNUM
;
62 if (regname
[1] < '0' || regname
[1] > '7')
64 regno
= regname
[1] - '0' + A0_REGNUM
;
70 monitor_supply_register (regno
, val
);
74 * This array of registers needs to match the indexes used by GDB. The
75 * whole reason this exists is because the various ROM monitors use
76 * different names than GDB does, and don't support all the
77 * registers either. So, typing "info reg sp" becomes a "r30".
80 static char *est_regnames
[NUM_REGS
] =
82 "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
83 "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
88 * Define the monitor command strings. Since these are passed directly
89 * through to a printf style function, we need can include formatting
90 * strings. We also need a CR or LF on the end.
93 static struct target_ops est_ops
;
95 static char *est_loadtypes
[] = {"none", "srec", "default", NULL
};
96 static char *est_loadprotos
[] = {"none", NULL
};
98 static char *est_inits
[] = {"he\r", /* Resets the prompt, and clears repeated cmds */
101 static struct monitor_ops est_cmds
=
103 MO_CLR_BREAK_USES_ADDR
| MO_FILL_USES_ADDR
| MO_NEED_REGDUMP_AFTER_CONT
,
104 est_inits
, /* Init strings */
105 "go\r", /* continue command */
106 "sidr\r", /* single step */
107 "\003", /* ^C interrupts the program */
108 "sb %x\r", /* set a breakpoint */
109 "rb %x\r", /* clear a breakpoint */
110 "rb\r", /* clear all breakpoints */
111 "bfb %x %x %x\r", /* fill (start end val) */
113 "smb %x %x\r", /* setmem.cmdb (addr, value) */
114 "smw %x %x\r", /* setmem.cmdw (addr, value) */
115 "sml %x %x\r", /* setmem.cmdl (addr, value) */
116 NULL
, /* setmem.cmdll (addr, value) */
117 NULL
, /* setreg.resp_delim */
118 NULL
, /* setreg.term */
119 NULL
, /* setreg.term_cmd */
122 "dmb %x %x\r", /* getmem.cmdb (addr, len) */
123 "dmw %x %x\r", /* getmem.cmdw (addr, len) */
124 "dml %x %x\r", /* getmem.cmdl (addr, len) */
125 NULL
, /* getmem.cmdll (addr, len) */
126 ": ", /* getmem.resp_delim */
127 NULL
, /* getmem.term */
128 NULL
, /* getmem.term_cmd */
131 "sr %s %x\r", /* setreg.cmd (name, value) */
132 NULL
, /* setreg.resp_delim */
133 NULL
, /* setreg.term */
134 NULL
/* setreg.term_cmd */
137 "dr %s\r", /* getreg.cmd (name) */
138 " = ", /* getreg.resp_delim */
139 NULL
, /* getreg.term */
140 NULL
/* getreg.term_cmd */
142 "dr\r", /* dump_registers */
143 "\\(\\w+\\) = \\([0-9a-fA-F]+\\)", /* register_pattern */
144 est_supply_register
, /* supply_register */
145 "dl\r", /* download command */
146 "+", /* load response */
147 ">BKM>", /* monitor command prompt */
148 NULL
, /* end-of-command delimitor */
149 NULL
, /* optional command terminator */
150 &est_ops
, /* target operations */
151 est_loadtypes
, /* loadtypes */
152 est_loadprotos
, /* loadprotos */
153 "9600", /* supported baud rates */
154 SERIAL_1_STOPBITS
, /* number of stop bits */
155 est_regnames
, /* registers names */
156 MONITOR_OPS_MAGIC
/* magic */
160 est_open(args
, from_tty
)
164 monitor_open (args
, &est_cmds
, from_tty
);
170 init_monitor_ops (&est_ops
);
172 est_ops
.to_shortname
= "est";
173 est_ops
.to_longname
= "EST background debug monitor";
174 est_ops
.to_doc
= "Debug via the EST BDM.\n\
175 Specify the serial device it is connected to (e.g. /dev/ttya).";
176 est_ops
.to_open
= est_open
;
178 add_target (&est_ops
);