* dwarf1.c (alloc_dwarf1_unit): Allocate using bfd_zalloc.
[deliverable/binutils-gdb.git] / gdb / rom68k-rom.c
CommitLineData
c906108c
SS
1/* Remote target glue for the ROM68K ROM monitor.
2 Copyright 1988, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
3
4This file is part of GDB.
5
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
18Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19
20#include "defs.h"
21#include "gdbcore.h"
22#include "target.h"
23#include "monitor.h"
24#include "serial.h"
25
26static void rom68k_open PARAMS ((char *args, int from_tty));
27
28static void
29rom68k_supply_register (regname, regnamelen, val, vallen)
30 char *regname;
31 int regnamelen;
32 char *val;
33 int vallen;
34{
35 int numregs;
36 int regno;
37
38 numregs = 1;
39 regno = -1;
40
41 if (regnamelen == 2)
42 switch (regname[0])
43 {
44 case 'S':
45 if (regname[1] == 'R')
46 regno = PS_REGNUM;
47 break;
48 case 'P':
49 if (regname[1] == 'C')
50 regno = PC_REGNUM;
51 break;
52 case 'D':
53 if (regname[1] != 'R')
54 break;
55 regno = D0_REGNUM;
56 numregs = 8;
57 break;
58 case 'A':
59 if (regname[1] != 'R')
60 break;
61 regno = A0_REGNUM;
62 numregs = 7;
63 break;
64 }
65 else if (regnamelen == 3)
66 switch (regname[0])
67 {
68 case 'I':
69 if (regname[1] == 'S' && regname[2] == 'P')
70 regno = SP_REGNUM;
71 }
72
73 if (regno >= 0)
74 while (numregs-- > 0)
75 val = monitor_supply_register (regno++, val);
76}
77
78/* This array of registers need to match the indexes used by GDB.
79 This exists because the various ROM monitors use different strings
80 than does GDB, and don't necessarily support all the registers
81 either. So, typing "info reg sp" becomes a "r30". */
82
83static char *rom68k_regnames[NUM_REGS] = {
84 "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
85 "A0", "A1", "A2", "A3", "A4", "A5", "A6", "ISP",
86 "SR", "PC" };
87
88/* Define the monitor command strings. Since these are passed directly
89 through to a printf style function, we may include formatting
90 strings. We also need a CR or LF on the end. */
91
92static struct target_ops rom68k_ops;
93
94static char *rom68k_inits[] = {".\r\r", NULL}; /* Exits pm/pr & download cmds */
95
96static struct monitor_ops rom68k_cmds ;
97
98static void
7a292a7a 99init_rom68k_cmds (void)
c906108c
SS
100{
101 rom68k_cmds.flags = 0;
102 rom68k_cmds.init = rom68k_inits; /* monitor init string */
103 rom68k_cmds.cont = "go\r";
104 rom68k_cmds.step = "st\r";
105 rom68k_cmds.stop = NULL;
106 rom68k_cmds.set_break = "db %x\r";
107 rom68k_cmds.clr_break = "cb %x\r";
108 rom68k_cmds.clr_all_break = "cb *\r";
109 rom68k_cmds.fill = "fm %x %x %x\r";
110 rom68k_cmds.setmem.cmdb = "pm %x %x\r";
7a292a7a
SS
111 rom68k_cmds.setmem.cmdw = "pm.w %x %x\r";
112 rom68k_cmds.setmem.cmdl = "pm.l %x %x\r";
c906108c
SS
113 rom68k_cmds.setmem.cmdll = NULL;
114 rom68k_cmds.setmem.resp_delim = NULL;
115 rom68k_cmds.setmem.term = NULL;
116 rom68k_cmds.setmem.term_cmd = NULL;
117 rom68k_cmds.getmem.cmdb = "dm %x %x\r";
7a292a7a
SS
118 rom68k_cmds.getmem.cmdw = "dm.w %x %x\r";
119 rom68k_cmds.getmem.cmdl = "dm.l %x %x\r";
c906108c
SS
120 rom68k_cmds.getmem.cmdll = NULL;
121 rom68k_cmds.getmem.resp_delim = " ";
122 rom68k_cmds.getmem.term = NULL;
7a292a7a 123 rom68k_cmds.getmem.term_cmd = NULL;
c906108c
SS
124 rom68k_cmds.setreg.cmd = "pr %s %x\r";
125 rom68k_cmds.setreg.resp_delim = NULL;
126 rom68k_cmds.setreg.term = NULL;
7a292a7a
SS
127 rom68k_cmds.setreg.term_cmd = NULL;
128 rom68k_cmds.getreg.cmd = "pr %s\r";
129 rom68k_cmds.getreg.resp_delim = ": ";
130 rom68k_cmds.getreg.term = "= ";
131 rom68k_cmds.getreg.term_cmd = ".\r";
132 rom68k_cmds.dump_registers = "dr\r";
c906108c 133 rom68k_cmds.register_pattern =
7a292a7a 134 "\\(\\w+\\)=\\([0-9a-fA-F]+\\( +[0-9a-fA-F]+\\b\\)*\\)";
c906108c
SS
135 rom68k_cmds.supply_register = rom68k_supply_register;
136 rom68k_cmds.load_routine = NULL;
137 rom68k_cmds.load = "dc\r";
7a292a7a 138 rom68k_cmds.loadresp = "Waiting for S-records from host... ";
c906108c
SS
139 rom68k_cmds.prompt = "ROM68K :-> ";
140 rom68k_cmds.line_term = "\r";
7a292a7a 141 rom68k_cmds.cmd_end = ".\r";
c906108c
SS
142 rom68k_cmds.target = &rom68k_ops;
143 rom68k_cmds.stopbits = SERIAL_1_STOPBITS;
144 rom68k_cmds.regnames = rom68k_regnames;
7a292a7a 145 rom68k_cmds.magic = MONITOR_OPS_MAGIC;
c906108c
SS
146} /* init_rom68k_cmds */
147
148static void
149rom68k_open (args, from_tty)
150 char *args;
151 int from_tty;
152{
153 monitor_open (args, &rom68k_cmds, from_tty);
154}
155
156void
157_initialize_rom68k ()
158{
159 init_rom68k_cmds() ;
160 init_monitor_ops (&rom68k_ops);
161
162 rom68k_ops.to_shortname = "rom68k";
163 rom68k_ops.to_longname = "Rom68k debug monitor for the IDP Eval board";
164 rom68k_ops.to_doc = "Debug on a Motorola IDP eval board running the ROM68K monitor.\n\
165Specify the serial device it is connected to (e.g. /dev/ttya).";
166 rom68k_ops.to_open = rom68k_open;
167
168 add_target (&rom68k_ops);
169}
This page took 0.032014 seconds and 4 git commands to generate.