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