1 /* Remote target glue for the Hitachi SH-3 ROM monitor.
2 Copyright 1995 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
27 static void sh3_open
PARAMS ((char *args
, int from_tty
));
30 sh3_supply_register (regname
, regnamelen
, val
, vallen
)
46 if (regname
[1] == 'R')
50 if (regname
[1] == 'C')
52 else if (regname
[1] == 'R')
56 else if (regnamelen
== 3)
61 if (regname
[1] == 'B' && regname
[2] == 'R')
62 if (regname
[0] == 'G')
69 if (regname
[1] == 'S' && regname
[2] == 'R')
71 else if (regname
[1] == 'P' && regname
[2] == 'C')
76 else if (regnamelen
== 4)
80 if (regname
[1] == 'A' && regname
[2] == 'C')
81 if (regname
[3] == 'H')
83 else if (regname
[3] == 'L')
87 if (regname
[1] == '0' && regname
[2] == '-' && regname
[3] == '7')
93 else if (regnamelen
== 5)
94 if (regname
[1] == '8' && regname
[2] == '-' && regname
[3] == '1'
97 regno
= R0_REGNUM
+ 8;
102 while (numregs
-- > 0)
103 val
= monitor_supply_register (regno
++, val
);
107 sh3_load (desc
, file
, hashmark
)
112 monitor_printf ("il;s:x\r");
113 monitor_expect ("\005", NULL
, 0); /* Look for ENQ */
114 SERIAL_WRITE (desc
, "\006", 1); /* Send ACK */
115 monitor_expect ("LO x\r", NULL
, 0); /* Look for filename */
117 load_srec (desc
, file
, 80, SREC_ALL
, hashmark
);
119 monitor_expect ("\005", NULL
, 0); /* Look for ENQ */
120 SERIAL_WRITE (desc
, "\006", 1); /* Send ACK */
121 monitor_expect_prompt (NULL
, 0);
124 /* This array of registers need to match the indexes used by GDB.
125 This exists because the various ROM monitors use different strings
126 than does GDB, and don't necessarily support all the registers
127 either. So, typing "info reg sp" becomes a "r30". */
129 static char *sh3_regnames
[NUM_REGS
] = {
130 "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7",
131 "R8", "R9", "R10","R11","R12","R13","R14","R15",
132 "PC", "PR", "GBR","VBR","MACH","MACL","SR",NULL
,
133 NULL
, NULL
, NULL
, NULL
};
135 /* Define the monitor command strings. Since these are passed directly
136 through to a printf style function, we may include formatting
137 strings. We also need a CR or LF on the end. */
139 static struct target_ops sh3_ops
;
141 static char *sh3_inits
[] = {"\003", NULL
}; /* Exits sub-command mode & download cmds */
143 static struct monitor_ops sh3_cmds
=
145 MO_CLR_BREAK_USES_ADDR
146 | MO_GETMEM_READ_SINGLE
, /* flags */
147 sh3_inits
, /* monitor init string */
148 "g\r", /* continue command */
149 "s\r", /* single step */
150 "\003", /* Interrupt program */
151 "b %x\r", /* set a breakpoint */
152 "b -%x\r", /* clear a breakpoint */
153 "b -\r", /* clear all breakpoints */
154 "f %x @%x %x\r", /* fill (start len val) */
156 "m %x %x\r", /* setmem.cmdb (addr, value) */
157 "m %x %x;w\r", /* setmem.cmdw (addr, value) */
158 "m %x %x;l\r", /* setmem.cmdl (addr, value) */
159 NULL
, /* setmem.cmdll (addr, value) */
160 NULL
, /* setreg.resp_delim */
161 NULL
, /* setreg.term */
162 NULL
, /* setreg.term_cmd */
165 "m %x\r", /* getmem.cmdb (addr, len) */
166 "m %x;w\r", /* getmem.cmdw (addr, len) */
167 "m %x;l\r", /* getmem.cmdl (addr, len) */
168 NULL
, /* getmem.cmdll (addr, len) */
169 "^ [0-9A-F]+ ", /* getmem.resp_delim */
170 "? ", /* getmem.term */
171 ".\r", /* getmem.term_cmd */
174 ".%s %x\r", /* setreg.cmd (name, value) */
175 NULL
, /* setreg.resp_delim */
176 NULL
, /* setreg.term */
177 NULL
/* setreg.term_cmd */
180 ".%s\r", /* getreg.cmd (name) */
181 "=", /* getreg.resp_delim */
182 "? ", /* getreg.term */
183 ".\r" /* getreg.term_cmd */
185 "r\r", /* dump_registers */
186 /* register_pattern */
187 "\\(\\w+\\)=\\([0-9a-fA-F]+\\( +[0-9a-fA-F]+\\b\\)*\\)",
188 sh3_supply_register
, /* supply_register */
189 sh3_load
, /* load_routine */
190 NULL
, /* download command */
191 NULL
, /* Load response */
192 "\n:", /* monitor command prompt */
193 "\r", /* end-of-line terminator */
194 ".\r", /* optional command terminator */
195 &sh3_ops
, /* target operations */
196 SERIAL_1_STOPBITS
, /* number of stop bits */
197 sh3_regnames
, /* registers names */
198 MONITOR_OPS_MAGIC
/* magic */
202 sh3_open (args
, from_tty
)
206 monitor_open (args
, &sh3_cmds
, from_tty
);
212 init_monitor_ops (&sh3_ops
);
214 sh3_ops
.to_shortname
= "sh3";
215 sh3_ops
.to_longname
= "Hitachi SH-3 rom monitor";
216 sh3_ops
.to_doc
= "Debug on a Hitachi eval board running the SH-3 rom monitor.\n\
217 Specify the serial device it is connected to (e.g. /dev/ttya).";
218 sh3_ops
.to_open
= sh3_open
;
220 add_target (&sh3_ops
);
This page took 0.050711 seconds and 4 git commands to generate.