]>
Commit | Line | Data |
---|---|---|
06b8f5e4 RS |
1 | #include "defs.h" |
2 | #include "gdbcore.h" | |
3 | #include "target.h" | |
4 | #include "monitor.h" | |
5 | ||
6 | extern int baud_rate; | |
7 | ||
8 | void rom68k_open(); | |
9 | void monitor_open(); | |
10 | ||
11 | /* | |
12 | * this array of registers need to match the indexes used by GDB. The | |
13 | * whole reason this exists is cause the various ROM monitors use | |
14 | * different strings than GDB does, and doesn't support all the | |
15 | * registers either. So, typing "info reg sp" becomes a "r30". | |
16 | */ | |
17 | static char *rom68k_regnames[] = { | |
18 | "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "a0", "a1", | |
19 | "a2", "a3", "a4", "a5", "a6", "usp", "ssp","pc", "", "", | |
20 | "", "", "", "", "", "", "", "", "", "", | |
21 | "", "", "", "", "", "", "", | |
22 | "", "", "", "", "", "", "", "", "", "", | |
23 | "", "", "", "", "", "", "", "", "", "", | |
24 | "", "", "", "", "", "", "", | |
25 | "", "", "", "", "", "", "", "", | |
26 | "", "", "", "", "", "", "", "", | |
27 | "", "", "", "", "", "", "", "", | |
28 | "", "", "", "", "", "", "", "", | |
29 | "", "", "", "", "", "", "", "", | |
30 | "", "", "", "", "", "", "", "", | |
31 | "", "", "", "", "", "", "", "", | |
32 | "", "", "", "", "", "", "", "" | |
33 | }; | |
34 | ||
35 | /* | |
36 | * Define the monitor command strings. Since these are passed directly | |
37 | * through to a printf style function, we need can include formatting | |
38 | * strings. We also need a CR or LF on the end. | |
39 | */ | |
40 | ||
41 | struct target_ops rom68k_ops = { | |
42 | "rom68k", | |
43 | "WinBond's debug monitor for the Rom68k Eval board", | |
44 | "Debug on a Motorola IDP eval board running the ROM68K monitor.\n\ | |
45 | Specify the serial device it is connected to (e.g. /dev/ttya).", | |
46 | rom68k_open, | |
47 | monitor_close, | |
48 | monitor_attach, | |
49 | monitor_detach, | |
50 | monitor_resume, | |
51 | monitor_wait, | |
52 | monitor_fetch_register, | |
53 | monitor_store_register, | |
54 | monitor_prepare_to_store, | |
55 | monitor_xfer_inferior_memory, | |
56 | monitor_files_info, | |
57 | monitor_insert_breakpoint, | |
58 | monitor_remove_breakpoint, /* Breakpoints */ | |
59 | 0, | |
60 | 0, | |
61 | 0, | |
62 | 0, | |
63 | 0, /* Terminal handling */ | |
64 | monitor_kill, | |
65 | monitor_load, /* load */ | |
66 | 0, /* lookup_symbol */ | |
67 | monitor_create_inferior, | |
68 | monitor_mourn_inferior, | |
69 | 0, /* can_run */ | |
70 | 0, /* notice_signals */ | |
71 | process_stratum, | |
72 | 0, /* next */ | |
73 | 1, | |
74 | 1, | |
75 | 1, | |
76 | 1, | |
77 | 1, /* all mem, mem, stack, regs, exec */ | |
78 | 0, | |
79 | 0, /* Section pointers */ | |
80 | OPS_MAGIC, /* Always the last thing */ | |
81 | }; | |
82 | ||
83 | struct monitor_ops rom68k_cmds = { | |
84 | 1, /* 1 for ASCII, 0 for binary */ | |
85 | "\n", /* monitor init string */ | |
86 | "go \n", /* execute or usually GO command */ | |
87 | "go \n", /* continue command */ | |
88 | "st \n", /* single step */ | |
89 | "db %x\n", /* set a breakpoint */ | |
90 | "cb %x\r", /* clear a breakpoint */ | |
91 | 0, /* 0 for number, 1 for address */ | |
92 | { | |
93 | "pm %x %x\r", /* set memory */ | |
94 | "=", /* delimiter */ | |
95 | "", /* the result */ | |
96 | }, | |
97 | { | |
98 | "dm %x 1\r", /* get memory */ | |
99 | "", /* delimiter */ | |
100 | "", /* the result */ | |
101 | }, | |
102 | { | |
103 | "pr %s %x\r", /* set a register */ | |
104 | "", /* delimiter between registers */ | |
105 | "", /* the result */ | |
106 | }, | |
107 | { | |
108 | "pr %s\n", /* get a register */ | |
109 | ":", /* delimiter between registers */ | |
110 | "", /* the result */ | |
111 | }, | |
112 | "dc\n", /* download command */ | |
113 | "ROM68K :->", /* monitor command prompt */ | |
114 | "=", /* end-of-command delimitor */ | |
115 | ".\n", /* optional command terminator */ | |
116 | &rom68k_ops, /* target operations */ | |
117 | "srec,xmodem-ascii,xmodem-srec,default",/* load types */ | |
118 | rom68k_regnames /* registers names */ | |
119 | }; | |
120 | ||
121 | void | |
122 | rom68k_open(args, from_tty) | |
123 | char *args; | |
124 | int from_tty; | |
125 | { | |
126 | target_preopen(from_tty); | |
127 | push_target (&rom68k_ops); | |
128 | push_monitor (&rom68k_cmds); | |
129 | monitor_open (args, "rom68k", from_tty); | |
130 | } | |
131 | ||
132 | void | |
133 | _initialize_rom68k () | |
134 | { | |
135 | add_target (&rom68k_ops); | |
136 | ||
137 | /* this is the default, since it's the only baud rate supported by the hardware */ | |
138 | baud_rate = 9600; | |
139 | } | |
140 | ||
141 | ||
142 | ||
143 |