OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [gdb/] [rom68k-rom.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.