* configure.in: Add specific case for cris-*-linux-gnu* with
[deliverable/binutils-gdb.git] / gdb / m32r-rom.c
CommitLineData
05d57f6f
AC
1// OBSOLETE /* Remote debugging interface to m32r and mon2000 ROM monitors for GDB,
2// OBSOLETE the GNU debugger.
3// OBSOLETE Copyright 1996, 1997, 1998, 1999, 2000, 2001
4// OBSOLETE Free Software Foundation, Inc.
5// OBSOLETE
6// OBSOLETE Adapted by Michael Snyder of Cygnus Support.
7// OBSOLETE
8// OBSOLETE This file is part of GDB.
9// OBSOLETE
10// OBSOLETE This program is free software; you can redistribute it and/or modify
11// OBSOLETE it under the terms of the GNU General Public License as published by
12// OBSOLETE the Free Software Foundation; either version 2 of the License, or
13// OBSOLETE (at your option) any later version.
14// OBSOLETE
15// OBSOLETE This program is distributed in the hope that it will be useful,
16// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
17// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// OBSOLETE GNU General Public License for more details.
19// OBSOLETE
20// OBSOLETE You should have received a copy of the GNU General Public License
21// OBSOLETE along with this program; if not, write to the Free Software
22// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
23// OBSOLETE Boston, MA 02111-1307, USA. */
24// OBSOLETE
25// OBSOLETE /* This module defines communication with the Mitsubishi m32r monitor */
26// OBSOLETE
27// OBSOLETE #include "defs.h"
28// OBSOLETE #include "gdbcore.h"
29// OBSOLETE #include "target.h"
30// OBSOLETE #include "monitor.h"
31// OBSOLETE #include "serial.h"
32// OBSOLETE #include "symtab.h"
33// OBSOLETE #include "command.h"
34// OBSOLETE #include "gdbcmd.h"
35// OBSOLETE #include "symfile.h" /* for generic load */
36// OBSOLETE #include <time.h> /* for time_t */
37// OBSOLETE #include "gdb_string.h"
38// OBSOLETE #include "objfiles.h" /* for ALL_OBJFILES etc. */
39// OBSOLETE #include "inferior.h" /* for write_pc() */
40// OBSOLETE #include <ctype.h>
41// OBSOLETE #include "regcache.h"
42// OBSOLETE
43// OBSOLETE extern void report_transfer_performance (unsigned long, time_t, time_t);
44// OBSOLETE
45// OBSOLETE /*
46// OBSOLETE * All this stuff just to get my host computer's IP address!
47// OBSOLETE */
48// OBSOLETE #include <sys/types.h>
49// OBSOLETE #include <netdb.h> /* for hostent */
50// OBSOLETE #include <netinet/in.h> /* for struct in_addr */
51// OBSOLETE #if 1
52// OBSOLETE #include <arpa/inet.h> /* for inet_ntoa */
53// OBSOLETE #endif
54// OBSOLETE
55// OBSOLETE static char *board_addr; /* user-settable IP address for M32R-EVA */
56// OBSOLETE static char *server_addr; /* user-settable IP address for gdb host */
57// OBSOLETE static char *download_path; /* user-settable path for SREC files */
58// OBSOLETE
59// OBSOLETE
60// OBSOLETE /*
61// OBSOLETE * Function: m32r_load_1 (helper function)
62// OBSOLETE */
63// OBSOLETE
64// OBSOLETE static void
65// OBSOLETE m32r_load_section (bfd *abfd, asection *s, void *obj)
66// OBSOLETE {
67// OBSOLETE unsigned int *data_count = obj;
68// OBSOLETE if (s->flags & SEC_LOAD)
69// OBSOLETE {
70// OBSOLETE bfd_size_type section_size = bfd_section_size (abfd, s);
71// OBSOLETE bfd_vma section_base = bfd_section_lma (abfd, s);
72// OBSOLETE unsigned int buffer, i;
73// OBSOLETE
74// OBSOLETE *data_count += section_size;
75// OBSOLETE
76// OBSOLETE printf_filtered ("Loading section %s, size 0x%lx lma ",
77// OBSOLETE bfd_section_name (abfd, s), section_size);
78// OBSOLETE print_address_numeric (section_base, 1, gdb_stdout);
79// OBSOLETE printf_filtered ("\n");
80// OBSOLETE gdb_flush (gdb_stdout);
81// OBSOLETE monitor_printf ("%s mw\r", paddr_nz (section_base));
82// OBSOLETE for (i = 0; i < section_size; i += 4)
83// OBSOLETE {
84// OBSOLETE QUIT;
85// OBSOLETE monitor_expect (" -> ", NULL, 0);
86// OBSOLETE bfd_get_section_contents (abfd, s, (char *) &buffer, i, 4);
87// OBSOLETE monitor_printf ("%x\n", buffer);
88// OBSOLETE }
89// OBSOLETE monitor_expect (" -> ", NULL, 0);
90// OBSOLETE monitor_printf ("q\n");
91// OBSOLETE monitor_expect_prompt (NULL, 0);
92// OBSOLETE }
93// OBSOLETE }
94// OBSOLETE
95// OBSOLETE static int
96// OBSOLETE m32r_load_1 (void *dummy)
97// OBSOLETE {
98// OBSOLETE int data_count = 0;
99// OBSOLETE
100// OBSOLETE bfd_map_over_sections ((bfd *) dummy, m32r_load_section, &data_count);
101// OBSOLETE return data_count;
102// OBSOLETE }
103// OBSOLETE
104// OBSOLETE /*
105// OBSOLETE * Function: m32r_load (an alternate way to load)
106// OBSOLETE */
107// OBSOLETE
108// OBSOLETE static void
109// OBSOLETE m32r_load (char *filename, int from_tty)
110// OBSOLETE {
111// OBSOLETE bfd *abfd;
112// OBSOLETE asection *s;
113// OBSOLETE unsigned int i, data_count = 0;
114// OBSOLETE time_t start_time, end_time; /* for timing of download */
115// OBSOLETE
116// OBSOLETE if (filename == NULL || filename[0] == 0)
117// OBSOLETE filename = get_exec_file (1);
118// OBSOLETE
119// OBSOLETE abfd = bfd_openr (filename, 0);
120// OBSOLETE if (!abfd)
121// OBSOLETE error ("Unable to open file %s\n", filename);
122// OBSOLETE if (bfd_check_format (abfd, bfd_object) == 0)
123// OBSOLETE error ("File is not an object file\n");
124// OBSOLETE start_time = time (NULL);
125// OBSOLETE #if 0
126// OBSOLETE for (s = abfd->sections; s; s = s->next)
127// OBSOLETE if (s->flags & SEC_LOAD)
128// OBSOLETE {
129// OBSOLETE bfd_size_type section_size = bfd_section_size (abfd, s);
130// OBSOLETE bfd_vma section_base = bfd_section_vma (abfd, s);
131// OBSOLETE unsigned int buffer;
132// OBSOLETE
133// OBSOLETE data_count += section_size;
134// OBSOLETE
135// OBSOLETE printf_filtered ("Loading section %s, size 0x%lx vma ",
136// OBSOLETE bfd_section_name (abfd, s), section_size);
137// OBSOLETE print_address_numeric (section_base, 1, gdb_stdout);
138// OBSOLETE printf_filtered ("\n");
139// OBSOLETE gdb_flush (gdb_stdout);
140// OBSOLETE monitor_printf ("%x mw\r", section_base);
141// OBSOLETE for (i = 0; i < section_size; i += 4)
142// OBSOLETE {
143// OBSOLETE monitor_expect (" -> ", NULL, 0);
144// OBSOLETE bfd_get_section_contents (abfd, s, (char *) &buffer, i, 4);
145// OBSOLETE monitor_printf ("%x\n", buffer);
146// OBSOLETE }
147// OBSOLETE monitor_expect (" -> ", NULL, 0);
148// OBSOLETE monitor_printf ("q\n");
149// OBSOLETE monitor_expect_prompt (NULL, 0);
150// OBSOLETE }
151// OBSOLETE #else
152// OBSOLETE if (!(catch_errors (m32r_load_1, abfd, "Load aborted!\n", RETURN_MASK_ALL)))
153// OBSOLETE {
154// OBSOLETE monitor_printf ("q\n");
155// OBSOLETE return;
156// OBSOLETE }
157// OBSOLETE #endif
158// OBSOLETE end_time = time (NULL);
159// OBSOLETE printf_filtered ("Start address 0x%lx\n", bfd_get_start_address (abfd));
160// OBSOLETE report_transfer_performance (data_count, start_time, end_time);
161// OBSOLETE
162// OBSOLETE /* Finally, make the PC point at the start address */
163// OBSOLETE if (exec_bfd)
164// OBSOLETE write_pc (bfd_get_start_address (exec_bfd));
165// OBSOLETE
166// OBSOLETE inferior_ptid = null_ptid; /* No process now */
167// OBSOLETE
168// OBSOLETE /* This is necessary because many things were based on the PC at the
169// OBSOLETE time that we attached to the monitor, which is no longer valid
170// OBSOLETE now that we have loaded new code (and just changed the PC).
171// OBSOLETE Another way to do this might be to call normal_stop, except that
172// OBSOLETE the stack may not be valid, and things would get horribly
173// OBSOLETE confused... */
174// OBSOLETE
175// OBSOLETE clear_symtab_users ();
176// OBSOLETE }
177// OBSOLETE
178// OBSOLETE static void
179// OBSOLETE m32r_load_gen (char *filename, int from_tty)
180// OBSOLETE {
181// OBSOLETE generic_load (filename, from_tty);
182// OBSOLETE }
183// OBSOLETE
184// OBSOLETE static void m32r_open (char *args, int from_tty);
185// OBSOLETE static void mon2000_open (char *args, int from_tty);
186// OBSOLETE
187// OBSOLETE /* This array of registers needs to match the indexes used by GDB. The
188// OBSOLETE whole reason this exists is because the various ROM monitors use
189// OBSOLETE different names than GDB does, and don't support all the registers
190// OBSOLETE either. So, typing "info reg sp" becomes an "A7". */
191// OBSOLETE
192// OBSOLETE static char *m32r_regnames[] =
193// OBSOLETE {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
194// OBSOLETE "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
195// OBSOLETE "psw", "cbr", "spi", "spu", "bpc", "pc", "accl", "acch",
196// OBSOLETE };
197// OBSOLETE
198// OBSOLETE static void
199// OBSOLETE m32r_supply_register (char *regname, int regnamelen, char *val, int vallen)
200// OBSOLETE {
201// OBSOLETE int regno;
202// OBSOLETE int num_regs = sizeof (m32r_regnames) / sizeof (m32r_regnames[0]);
203// OBSOLETE
204// OBSOLETE for (regno = 0; regno < num_regs; regno++)
205// OBSOLETE if (strncmp (regname, m32r_regnames[regno], regnamelen) == 0)
206// OBSOLETE break;
207// OBSOLETE
208// OBSOLETE if (regno >= num_regs)
209// OBSOLETE return; /* no match */
210// OBSOLETE
211// OBSOLETE if (regno == ACCL_REGNUM)
212// OBSOLETE { /* special handling for 64-bit acc reg */
213// OBSOLETE monitor_supply_register (ACCH_REGNUM, val);
214// OBSOLETE val = strchr (val, ':'); /* skip past ':' to get 2nd word */
215// OBSOLETE if (val != NULL)
216// OBSOLETE monitor_supply_register (ACCL_REGNUM, val + 1);
217// OBSOLETE }
218// OBSOLETE else
219// OBSOLETE {
220// OBSOLETE monitor_supply_register (regno, val);
221// OBSOLETE if (regno == PSW_REGNUM)
222// OBSOLETE {
223// OBSOLETE unsigned long psw = strtoul (val, NULL, 16);
224// OBSOLETE char *zero = "00000000", *one = "00000001";
225// OBSOLETE
226// OBSOLETE #ifdef SM_REGNUM
227// OBSOLETE /* Stack mode bit */
228// OBSOLETE monitor_supply_register (SM_REGNUM, (psw & 0x80) ? one : zero);
229// OBSOLETE #endif
230// OBSOLETE #ifdef BSM_REGNUM
231// OBSOLETE /* Backup stack mode bit */
232// OBSOLETE monitor_supply_register (BSM_REGNUM, (psw & 0x8000) ? one : zero);
233// OBSOLETE #endif
234// OBSOLETE #ifdef IE_REGNUM
235// OBSOLETE /* Interrupt enable bit */
236// OBSOLETE monitor_supply_register (IE_REGNUM, (psw & 0x40) ? one : zero);
237// OBSOLETE #endif
238// OBSOLETE #ifdef BIE_REGNUM
239// OBSOLETE /* Backup interrupt enable bit */
240// OBSOLETE monitor_supply_register (BIE_REGNUM, (psw & 0x4000) ? one : zero);
241// OBSOLETE #endif
242// OBSOLETE #ifdef COND_REGNUM
243// OBSOLETE /* Condition bit (carry etc.) */
244// OBSOLETE monitor_supply_register (COND_REGNUM, (psw & 0x1) ? one : zero);
245// OBSOLETE #endif
246// OBSOLETE #ifdef CBR_REGNUM
247// OBSOLETE monitor_supply_register (CBR_REGNUM, (psw & 0x1) ? one : zero);
248// OBSOLETE #endif
249// OBSOLETE #ifdef BPC_REGNUM
250// OBSOLETE monitor_supply_register (BPC_REGNUM, zero); /* KLUDGE: (???????) */
251// OBSOLETE #endif
252// OBSOLETE #ifdef BCARRY_REGNUM
253// OBSOLETE monitor_supply_register (BCARRY_REGNUM, zero); /* KLUDGE: (??????) */
254// OBSOLETE #endif
255// OBSOLETE }
256// OBSOLETE
257// OBSOLETE if (regno == SPI_REGNUM || regno == SPU_REGNUM)
258// OBSOLETE { /* special handling for stack pointer (spu or spi) */
259// OBSOLETE unsigned long stackmode = read_register (PSW_REGNUM) & 0x80;
260// OBSOLETE
261// OBSOLETE if (regno == SPI_REGNUM && !stackmode) /* SP == SPI */
262// OBSOLETE monitor_supply_register (SP_REGNUM, val);
263// OBSOLETE else if (regno == SPU_REGNUM && stackmode) /* SP == SPU */
264// OBSOLETE monitor_supply_register (SP_REGNUM, val);
265// OBSOLETE }
266// OBSOLETE }
267// OBSOLETE }
268// OBSOLETE
269// OBSOLETE /* m32r RevC board monitor */
270// OBSOLETE
271// OBSOLETE static struct target_ops m32r_ops;
272// OBSOLETE
273// OBSOLETE static char *m32r_inits[] =
274// OBSOLETE {"\r", NULL};
275// OBSOLETE
276// OBSOLETE static struct monitor_ops m32r_cmds;
277// OBSOLETE
278// OBSOLETE static void
279// OBSOLETE init_m32r_cmds (void)
280// OBSOLETE {
281// OBSOLETE m32r_cmds.flags = MO_CLR_BREAK_USES_ADDR | MO_REGISTER_VALUE_FIRST;
282// OBSOLETE m32r_cmds.init = m32r_inits; /* Init strings */
283// OBSOLETE m32r_cmds.cont = "go\r"; /* continue command */
284// OBSOLETE m32r_cmds.step = "step\r"; /* single step */
285// OBSOLETE m32r_cmds.stop = NULL; /* interrupt command */
286// OBSOLETE m32r_cmds.set_break = "%x +bp\r"; /* set a breakpoint */
287// OBSOLETE m32r_cmds.clr_break = "%x -bp\r"; /* clear a breakpoint */
288// OBSOLETE m32r_cmds.clr_all_break = "bpoff\r"; /* clear all breakpoints */
289// OBSOLETE m32r_cmds.fill = "%x %x %x fill\r"; /* fill (start length val) */
290// OBSOLETE m32r_cmds.setmem.cmdb = "%x 1 %x fill\r"; /* setmem.cmdb (addr, value) */
291// OBSOLETE m32r_cmds.setmem.cmdw = "%x 1 %x fillh\r"; /* setmem.cmdw (addr, value) */
292// OBSOLETE m32r_cmds.setmem.cmdl = "%x 1 %x fillw\r"; /* setmem.cmdl (addr, value) */
293// OBSOLETE m32r_cmds.setmem.cmdll = NULL; /* setmem.cmdll (addr, value) */
294// OBSOLETE m32r_cmds.setmem.resp_delim = NULL; /* setmem.resp_delim */
295// OBSOLETE m32r_cmds.setmem.term = NULL; /* setmem.term */
296// OBSOLETE m32r_cmds.setmem.term_cmd = NULL; /* setmem.term_cmd */
297// OBSOLETE m32r_cmds.getmem.cmdb = "%x %x dump\r"; /* getmem.cmdb (addr, len) */
298// OBSOLETE m32r_cmds.getmem.cmdw = NULL; /* getmem.cmdw (addr, len) */
299// OBSOLETE m32r_cmds.getmem.cmdl = NULL; /* getmem.cmdl (addr, len) */
300// OBSOLETE m32r_cmds.getmem.cmdll = NULL; /* getmem.cmdll (addr, len) */
301// OBSOLETE m32r_cmds.getmem.resp_delim = ": "; /* getmem.resp_delim */
302// OBSOLETE m32r_cmds.getmem.term = NULL; /* getmem.term */
303// OBSOLETE m32r_cmds.getmem.term_cmd = NULL; /* getmem.term_cmd */
304// OBSOLETE m32r_cmds.setreg.cmd = "%x to %%%s\r"; /* setreg.cmd (name, value) */
305// OBSOLETE m32r_cmds.setreg.resp_delim = NULL; /* setreg.resp_delim */
306// OBSOLETE m32r_cmds.setreg.term = NULL; /* setreg.term */
307// OBSOLETE m32r_cmds.setreg.term_cmd = NULL; /* setreg.term_cmd */
308// OBSOLETE m32r_cmds.getreg.cmd = NULL; /* getreg.cmd (name) */
309// OBSOLETE m32r_cmds.getreg.resp_delim = NULL; /* getreg.resp_delim */
310// OBSOLETE m32r_cmds.getreg.term = NULL; /* getreg.term */
311// OBSOLETE m32r_cmds.getreg.term_cmd = NULL; /* getreg.term_cmd */
312// OBSOLETE m32r_cmds.dump_registers = ".reg\r"; /* dump_registers */
313// OBSOLETE m32r_cmds.register_pattern = "\\(\\w+\\) += \\([0-9a-fA-F]+\\b\\)"; /* register_pattern */
314// OBSOLETE m32r_cmds.supply_register = m32r_supply_register; /* supply_register */
315// OBSOLETE m32r_cmds.load_routine = NULL; /* load_routine (defaults to SRECs) */
316// OBSOLETE m32r_cmds.load = NULL; /* download command */
317// OBSOLETE m32r_cmds.loadresp = NULL; /* load response */
318// OBSOLETE m32r_cmds.prompt = "ok "; /* monitor command prompt */
319// OBSOLETE m32r_cmds.line_term = "\r"; /* end-of-line terminator */
320// OBSOLETE m32r_cmds.cmd_end = NULL; /* optional command terminator */
321// OBSOLETE m32r_cmds.target = &m32r_ops; /* target operations */
322// OBSOLETE m32r_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
323// OBSOLETE m32r_cmds.regnames = m32r_regnames; /* registers names */
324// OBSOLETE m32r_cmds.magic = MONITOR_OPS_MAGIC; /* magic */
325// OBSOLETE } /* init_m32r_cmds */
326// OBSOLETE
327// OBSOLETE static void
328// OBSOLETE m32r_open (char *args, int from_tty)
329// OBSOLETE {
330// OBSOLETE monitor_open (args, &m32r_cmds, from_tty);
331// OBSOLETE }
332// OBSOLETE
333// OBSOLETE /* Mon2000 monitor (MSA2000 board) */
334// OBSOLETE
335// OBSOLETE static struct target_ops mon2000_ops;
336// OBSOLETE static struct monitor_ops mon2000_cmds;
337// OBSOLETE
338// OBSOLETE static void
339// OBSOLETE init_mon2000_cmds (void)
340// OBSOLETE {
341// OBSOLETE mon2000_cmds.flags = MO_CLR_BREAK_USES_ADDR | MO_REGISTER_VALUE_FIRST;
342// OBSOLETE mon2000_cmds.init = m32r_inits; /* Init strings */
343// OBSOLETE mon2000_cmds.cont = "go\r"; /* continue command */
344// OBSOLETE mon2000_cmds.step = "step\r"; /* single step */
345// OBSOLETE mon2000_cmds.stop = NULL; /* interrupt command */
346// OBSOLETE mon2000_cmds.set_break = "%x +bp\r"; /* set a breakpoint */
347// OBSOLETE mon2000_cmds.clr_break = "%x -bp\r"; /* clear a breakpoint */
348// OBSOLETE mon2000_cmds.clr_all_break = "bpoff\r"; /* clear all breakpoints */
349// OBSOLETE mon2000_cmds.fill = "%x %x %x fill\r"; /* fill (start length val) */
350// OBSOLETE mon2000_cmds.setmem.cmdb = "%x 1 %x fill\r"; /* setmem.cmdb (addr, value) */
351// OBSOLETE mon2000_cmds.setmem.cmdw = "%x 1 %x fillh\r"; /* setmem.cmdw (addr, value) */
352// OBSOLETE mon2000_cmds.setmem.cmdl = "%x 1 %x fillw\r"; /* setmem.cmdl (addr, value) */
353// OBSOLETE mon2000_cmds.setmem.cmdll = NULL; /* setmem.cmdll (addr, value) */
354// OBSOLETE mon2000_cmds.setmem.resp_delim = NULL; /* setmem.resp_delim */
355// OBSOLETE mon2000_cmds.setmem.term = NULL; /* setmem.term */
356// OBSOLETE mon2000_cmds.setmem.term_cmd = NULL; /* setmem.term_cmd */
357// OBSOLETE mon2000_cmds.getmem.cmdb = "%x %x dump\r"; /* getmem.cmdb (addr, len) */
358// OBSOLETE mon2000_cmds.getmem.cmdw = NULL; /* getmem.cmdw (addr, len) */
359// OBSOLETE mon2000_cmds.getmem.cmdl = NULL; /* getmem.cmdl (addr, len) */
360// OBSOLETE mon2000_cmds.getmem.cmdll = NULL; /* getmem.cmdll (addr, len) */
361// OBSOLETE mon2000_cmds.getmem.resp_delim = ": "; /* getmem.resp_delim */
362// OBSOLETE mon2000_cmds.getmem.term = NULL; /* getmem.term */
363// OBSOLETE mon2000_cmds.getmem.term_cmd = NULL; /* getmem.term_cmd */
364// OBSOLETE mon2000_cmds.setreg.cmd = "%x to %%%s\r"; /* setreg.cmd (name, value) */
365// OBSOLETE mon2000_cmds.setreg.resp_delim = NULL; /* setreg.resp_delim */
366// OBSOLETE mon2000_cmds.setreg.term = NULL; /* setreg.term */
367// OBSOLETE mon2000_cmds.setreg.term_cmd = NULL; /* setreg.term_cmd */
368// OBSOLETE mon2000_cmds.getreg.cmd = NULL; /* getreg.cmd (name) */
369// OBSOLETE mon2000_cmds.getreg.resp_delim = NULL; /* getreg.resp_delim */
370// OBSOLETE mon2000_cmds.getreg.term = NULL; /* getreg.term */
371// OBSOLETE mon2000_cmds.getreg.term_cmd = NULL; /* getreg.term_cmd */
372// OBSOLETE mon2000_cmds.dump_registers = ".reg\r"; /* dump_registers */
373// OBSOLETE mon2000_cmds.register_pattern = "\\(\\w+\\) += \\([0-9a-fA-F]+\\b\\)"; /* register_pattern */
374// OBSOLETE mon2000_cmds.supply_register = m32r_supply_register; /* supply_register */
375// OBSOLETE mon2000_cmds.load_routine = NULL; /* load_routine (defaults to SRECs) */
376// OBSOLETE mon2000_cmds.load = NULL; /* download command */
377// OBSOLETE mon2000_cmds.loadresp = NULL; /* load response */
378// OBSOLETE mon2000_cmds.prompt = "Mon2000>"; /* monitor command prompt */
379// OBSOLETE mon2000_cmds.line_term = "\r"; /* end-of-line terminator */
380// OBSOLETE mon2000_cmds.cmd_end = NULL; /* optional command terminator */
381// OBSOLETE mon2000_cmds.target = &mon2000_ops; /* target operations */
382// OBSOLETE mon2000_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
383// OBSOLETE mon2000_cmds.regnames = m32r_regnames; /* registers names */
384// OBSOLETE mon2000_cmds.magic = MONITOR_OPS_MAGIC; /* magic */
385// OBSOLETE } /* init_mon2000_cmds */
386// OBSOLETE
387// OBSOLETE static void
388// OBSOLETE mon2000_open (char *args, int from_tty)
389// OBSOLETE {
390// OBSOLETE monitor_open (args, &mon2000_cmds, from_tty);
391// OBSOLETE }
392// OBSOLETE
393// OBSOLETE /* Function: set_board_address
394// OBSOLETE Tell the BootOne monitor what it's ethernet IP address is. */
395// OBSOLETE
396// OBSOLETE static void
397// OBSOLETE m32r_set_board_address (char *args, int from_tty)
398// OBSOLETE {
399// OBSOLETE int resp_len;
400// OBSOLETE char buf[1024];
401// OBSOLETE
402// OBSOLETE if (args && *args)
403// OBSOLETE {
404// OBSOLETE monitor_printf ("ulip %s\n", args);
405// OBSOLETE resp_len = monitor_expect_prompt (buf, sizeof (buf));
406// OBSOLETE /* now parse the result for success */
407// OBSOLETE }
408// OBSOLETE else
409// OBSOLETE error ("Requires argument (IP address for M32R-EVA board)");
410// OBSOLETE }
411// OBSOLETE
412// OBSOLETE /* Function: set_server_address
413// OBSOLETE Tell the BootOne monitor what gdb's ethernet IP address is. */
414// OBSOLETE
415// OBSOLETE static void
416// OBSOLETE m32r_set_server_address (char *args, int from_tty)
417// OBSOLETE {
418// OBSOLETE int resp_len;
419// OBSOLETE char buf[1024];
420// OBSOLETE
421// OBSOLETE if (args && *args)
422// OBSOLETE {
423// OBSOLETE monitor_printf ("uhip %s\n", args);
424// OBSOLETE resp_len = monitor_expect_prompt (buf, sizeof (buf));
425// OBSOLETE /* now parse the result for success */
426// OBSOLETE }
427// OBSOLETE else
428// OBSOLETE error ("Requires argument (IP address of GDB's host computer)");
429// OBSOLETE }
430// OBSOLETE
431// OBSOLETE /* Function: set_download_path
432// OBSOLETE Tell the BootOne monitor the default path for downloadable SREC files. */
433// OBSOLETE
434// OBSOLETE static void
435// OBSOLETE m32r_set_download_path (char *args, int from_tty)
436// OBSOLETE {
437// OBSOLETE int resp_len;
438// OBSOLETE char buf[1024];
439// OBSOLETE
440// OBSOLETE if (args && *args)
441// OBSOLETE {
442// OBSOLETE monitor_printf ("up %s\n", args);
443// OBSOLETE resp_len = monitor_expect_prompt (buf, sizeof (buf));
444// OBSOLETE /* now parse the result for success */
445// OBSOLETE }
446// OBSOLETE else
447// OBSOLETE error ("Requires argument (default path for downloadable SREC files)");
448// OBSOLETE }
449// OBSOLETE
450// OBSOLETE static void
451// OBSOLETE m32r_upload_command (char *args, int from_tty)
452// OBSOLETE {
453// OBSOLETE bfd *abfd;
454// OBSOLETE asection *s;
455// OBSOLETE time_t start_time, end_time; /* for timing of download */
456// OBSOLETE int resp_len, data_count = 0;
457// OBSOLETE char buf[1024];
458// OBSOLETE struct hostent *hostent;
459// OBSOLETE struct in_addr inet_addr;
460// OBSOLETE
461// OBSOLETE /* first check to see if there's an ethernet port! */
462// OBSOLETE monitor_printf ("ust\r");
463// OBSOLETE resp_len = monitor_expect_prompt (buf, sizeof (buf));
464// OBSOLETE if (!strchr (buf, ':'))
465// OBSOLETE error ("No ethernet connection!");
466// OBSOLETE
467// OBSOLETE if (board_addr == 0)
468// OBSOLETE {
469// OBSOLETE /* scan second colon in the output from the "ust" command */
470// OBSOLETE char *myIPaddress = strchr (strchr (buf, ':') + 1, ':') + 1;
471// OBSOLETE
472// OBSOLETE while (isspace (*myIPaddress))
473// OBSOLETE myIPaddress++;
474// OBSOLETE
475// OBSOLETE if (!strncmp (myIPaddress, "0.0.", 4)) /* empty */
476// OBSOLETE error ("Please use 'set board-address' to set the M32R-EVA board's IP address.");
477// OBSOLETE if (strchr (myIPaddress, '('))
478// OBSOLETE *(strchr (myIPaddress, '(')) = '\0'; /* delete trailing junk */
479// OBSOLETE board_addr = xstrdup (myIPaddress);
480// OBSOLETE }
481// OBSOLETE if (server_addr == 0)
482// OBSOLETE {
483// OBSOLETE buf[0] = 0;
484// OBSOLETE gethostname (buf, sizeof (buf));
485// OBSOLETE if (buf[0] != 0)
486// OBSOLETE hostent = gethostbyname (buf);
487// OBSOLETE if (hostent != 0)
488// OBSOLETE {
489// OBSOLETE #if 1
490// OBSOLETE memcpy (&inet_addr.s_addr, hostent->h_addr,
491// OBSOLETE sizeof (inet_addr.s_addr));
492// OBSOLETE server_addr = (char *) inet_ntoa (inet_addr);
493// OBSOLETE #else
494// OBSOLETE server_addr = (char *) inet_ntoa (hostent->h_addr);
495// OBSOLETE #endif
496// OBSOLETE }
497// OBSOLETE if (server_addr == 0) /* failed? */
498// OBSOLETE error ("Need to know gdb host computer's IP address (use 'set server-address')");
499// OBSOLETE }
500// OBSOLETE
501// OBSOLETE if (args == 0 || args[0] == 0) /* no args: upload the current file */
502// OBSOLETE args = get_exec_file (1);
503// OBSOLETE
504// OBSOLETE if (args[0] != '/' && download_path == 0)
505// OBSOLETE {
506// OBSOLETE if (current_directory)
507// OBSOLETE download_path = xstrdup (current_directory);
508// OBSOLETE else
509// OBSOLETE error ("Need to know default download path (use 'set download-path')");
510// OBSOLETE }
511// OBSOLETE
512// OBSOLETE start_time = time (NULL);
513// OBSOLETE monitor_printf ("uhip %s\r", server_addr);
514// OBSOLETE resp_len = monitor_expect_prompt (buf, sizeof (buf)); /* parse result? */
515// OBSOLETE monitor_printf ("ulip %s\r", board_addr);
516// OBSOLETE resp_len = monitor_expect_prompt (buf, sizeof (buf)); /* parse result? */
517// OBSOLETE if (args[0] != '/')
518// OBSOLETE monitor_printf ("up %s\r", download_path); /* use default path */
519// OBSOLETE else
520// OBSOLETE monitor_printf ("up\r"); /* rooted filename/path */
521// OBSOLETE resp_len = monitor_expect_prompt (buf, sizeof (buf)); /* parse result? */
522// OBSOLETE
523// OBSOLETE if (strrchr (args, '.') && !strcmp (strrchr (args, '.'), ".srec"))
524// OBSOLETE monitor_printf ("ul %s\r", args);
525// OBSOLETE else /* add ".srec" suffix */
526// OBSOLETE monitor_printf ("ul %s.srec\r", args);
527// OBSOLETE resp_len = monitor_expect_prompt (buf, sizeof (buf)); /* parse result? */
528// OBSOLETE
529// OBSOLETE if (buf[0] == 0 || strstr (buf, "complete") == 0)
530// OBSOLETE error ("Upload file not found: %s.srec\nCheck IP addresses and download path.", args);
531// OBSOLETE else
532// OBSOLETE printf_filtered (" -- Ethernet load complete.\n");
533// OBSOLETE
534// OBSOLETE end_time = time (NULL);
535// OBSOLETE abfd = bfd_openr (args, 0);
536// OBSOLETE if (abfd != NULL)
537// OBSOLETE { /* Download is done -- print section statistics */
538// OBSOLETE if (bfd_check_format (abfd, bfd_object) == 0)
539// OBSOLETE {
540// OBSOLETE printf_filtered ("File is not an object file\n");
541// OBSOLETE }
542// OBSOLETE for (s = abfd->sections; s; s = s->next)
543// OBSOLETE if (s->flags & SEC_LOAD)
544// OBSOLETE {
545// OBSOLETE bfd_size_type section_size = bfd_section_size (abfd, s);
546// OBSOLETE bfd_vma section_base = bfd_section_lma (abfd, s);
547// OBSOLETE unsigned int buffer;
548// OBSOLETE
549// OBSOLETE data_count += section_size;
550// OBSOLETE
551// OBSOLETE printf_filtered ("Loading section %s, size 0x%lx lma ",
552// OBSOLETE bfd_section_name (abfd, s), section_size);
553// OBSOLETE print_address_numeric (section_base, 1, gdb_stdout);
554// OBSOLETE printf_filtered ("\n");
555// OBSOLETE gdb_flush (gdb_stdout);
556// OBSOLETE }
557// OBSOLETE /* Finally, make the PC point at the start address */
558// OBSOLETE write_pc (bfd_get_start_address (abfd));
559// OBSOLETE report_transfer_performance (data_count, start_time, end_time);
560// OBSOLETE printf_filtered ("Start address 0x%lx\n", bfd_get_start_address (abfd));
561// OBSOLETE }
562// OBSOLETE inferior_ptid = null_ptid; /* No process now */
563// OBSOLETE
564// OBSOLETE /* This is necessary because many things were based on the PC at the
565// OBSOLETE time that we attached to the monitor, which is no longer valid
566// OBSOLETE now that we have loaded new code (and just changed the PC).
567// OBSOLETE Another way to do this might be to call normal_stop, except that
568// OBSOLETE the stack may not be valid, and things would get horribly
569// OBSOLETE confused... */
570// OBSOLETE
571// OBSOLETE clear_symtab_users ();
572// OBSOLETE }
573// OBSOLETE
574// OBSOLETE void
575// OBSOLETE _initialize_m32r_rom (void)
576// OBSOLETE {
577// OBSOLETE /* Initialize m32r RevC monitor target */
578// OBSOLETE init_m32r_cmds ();
579// OBSOLETE init_monitor_ops (&m32r_ops);
580// OBSOLETE
581// OBSOLETE m32r_ops.to_shortname = "m32r";
582// OBSOLETE m32r_ops.to_longname = "m32r monitor";
583// OBSOLETE m32r_ops.to_load = m32r_load_gen; /* monitor lacks a download command */
584// OBSOLETE m32r_ops.to_doc = "Debug via the m32r monitor.\n\
585// OBSOLETE Specify the serial device it is connected to (e.g. /dev/ttya).";
586// OBSOLETE m32r_ops.to_open = m32r_open;
587// OBSOLETE add_target (&m32r_ops);
588// OBSOLETE
589// OBSOLETE /* Initialize mon2000 monitor target */
590// OBSOLETE init_mon2000_cmds ();
591// OBSOLETE init_monitor_ops (&mon2000_ops);
592// OBSOLETE
593// OBSOLETE mon2000_ops.to_shortname = "mon2000";
594// OBSOLETE mon2000_ops.to_longname = "Mon2000 monitor";
595// OBSOLETE mon2000_ops.to_load = m32r_load_gen; /* monitor lacks a download command */
596// OBSOLETE mon2000_ops.to_doc = "Debug via the Mon2000 monitor.\n\
597// OBSOLETE Specify the serial device it is connected to (e.g. /dev/ttya).";
598// OBSOLETE mon2000_ops.to_open = mon2000_open;
599// OBSOLETE add_target (&mon2000_ops);
600// OBSOLETE
601// OBSOLETE add_show_from_set
602// OBSOLETE (add_set_cmd ("download-path", class_obscure, var_string,
603// OBSOLETE (char *) &download_path,
604// OBSOLETE "Set the default path for downloadable SREC files.",
605// OBSOLETE &setlist),
606// OBSOLETE &showlist);
607// OBSOLETE
608// OBSOLETE add_show_from_set
609// OBSOLETE (add_set_cmd ("board-address", class_obscure, var_string,
610// OBSOLETE (char *) &board_addr,
611// OBSOLETE "Set IP address for M32R-EVA target board.",
612// OBSOLETE &setlist),
613// OBSOLETE &showlist);
614// OBSOLETE
615// OBSOLETE add_show_from_set
616// OBSOLETE (add_set_cmd ("server-address", class_obscure, var_string,
617// OBSOLETE (char *) &server_addr,
618// OBSOLETE "Set IP address for download server (GDB's host computer).",
619// OBSOLETE &setlist),
620// OBSOLETE &showlist);
621// OBSOLETE
622// OBSOLETE add_com ("upload", class_obscure, m32r_upload_command,
623// OBSOLETE "Upload the srec file via the monitor's Ethernet upload capability.");
624// OBSOLETE
625// OBSOLETE add_com ("tload", class_obscure, m32r_load, "test upload command.");
626// OBSOLETE }
This page took 0.079931 seconds and 4 git commands to generate.