Both targets initialize, can dump registers too.
[binutils-gdb.git] / gdb / op50-rom.c
1 /*
2 * op50n-rom.c -- configure GDB for an Oki op59n eval board.
3 */
4 #include "defs.h"
5 #include "gdbcore.h"
6 #include "target.h"
7 #include "monitor.h"
8
9 void op50n_open();
10 void monitor_open();
11
12 /*
13 * this array of registers need to match the indexes used by GDB. The
14 * whole reason this exists is cause the various ROM monitors use
15 * different strings than GDB does, and doesn't support all the
16 * registers either. So, typing "info reg sp" becomes a "r30".
17 */
18 static char *op50n_regnames[] = {
19 "r0_zero", "r1_tO ", "r2_rp ", "r3_s15 ", "r4_s14 ", "r5_s13 ", "r6_s12 ",
20 "r7_s11 ", "r8_s10 ", "r9_s9 ", "r10_s8 ", "r11_s7 ", "r12_s6 ", "r13_s5 ",
21 "r14_s4 ", "r15_s3 ", "r16_s2 ", "r17_s1 ", "r18_s0 ", "r19_t4 ", "r20_t3 ",
22 "r21_t2 ", "r22_t1 ", "r23_a3 ", "r24_a2 ", "r25_a1 ", "r26_a0 ", "r27_dp ",
23 "r28_v0 ", "r29_v1 ", "r30_sp ", "r31_t5 ", "", "", "",
24 "", "", "", "", "", "", "",
25 "", "", "", "", "", "", "",
26 "", "", "", "", "", "", "", "",
27 "", "", "", "", "", "", "",
28 "", "", "", "", "", "", "", "",
29 "", "", "", "", "", "", "", "",
30 "", "", "", "", "", "", "", "",
31 "", "", "", "", "", "", "", "",
32 "", "", "", "", "", "", "", "",
33 "", "", "", "", "", "", "", "",
34 "", "", "", "", "", "", "", "",
35 "", "", "", "", "", "", "", ""
36 };
37
38 /*
39 * Define the monitor command strings. Since these are passed directly
40 * through to a printf style function, we need can include formatting
41 * strings. We also need a CR or LF on the end.
42 */
43
44 struct target_ops op50n_ops = {
45 "op50n",
46 "Oki's debug monitor for the Op50n Eval board",
47 "Debug on a Oki OP50N eval board.\n\
48 Specify the serial device it is connected to (e.g. /dev/ttya).",
49 op50n_open,
50 monitor_close,
51 0,
52 monitor_detach,
53 monitor_resume,
54 monitor_wait,
55 monitor_fetch_register,
56 monitor_store_register,
57 monitor_prepare_to_store,
58 monitor_xfer_inferior_memory,
59 monitor_files_info,
60 monitor_insert_breakpoint,
61 monitor_remove_breakpoint, /* Breakpoints */
62 0,
63 0,
64 0,
65 0,
66 0, /* Terminal handling */
67 monitor_kill,
68 monitor_load, /* load */
69 0, /* lookup_symbol */
70 monitor_create_inferior,
71 monitor_mourn_inferior,
72 0, /* can_run */
73 0, /* notice_signals */
74 process_stratum,
75 0, /* next */
76 1,
77 1,
78 1,
79 1,
80 1, /* all mem, mem, stack, regs, exec */
81 0,
82 0, /* Section pointers */
83 OPS_MAGIC, /* Always the last thing */
84 };
85
86 struct monitor_ops op50n_cmds = {
87 1, /* 1 for ASCII, 0 for binary */
88 "\n", /* monitor init string */
89 "", /* execute or usually GO command */
90 "", /* continue command */
91 "", /* single step */
92 "", /* set a breakpoint */
93 "", /* clear a breakpoint */
94 "", /* set memory to a value */
95 "", /* display memory */
96 "", /* prompt memory commands use */
97 { /* set a register */
98 "x %s %x\n", /* set a register */
99 "", /* delimiter between registers */
100 "", /* the result */
101 },
102 {
103 "x %s\n", /* get a register */
104 "=", /* delimiter between registers */
105 " ", /* the result */
106 },
107 "r 0\r", /* download command */
108 "#", /* monitor command prompt */
109 " ", /* end-of-command delimitor */
110 ".\n", /* optional command terminator */
111 &op50n_ops, /* target operations */
112 "srec,binary", /* load types */
113 op50n_regnames
114 };
115
116 void
117 op50n_open(args, from_tty)
118 char *args;
119 int from_tty;
120 {
121 target_preopen(from_tty);
122 push_target(&op50n_ops);
123 push_monitor (&op50n_cmds);
124 monitor_open (args, "op50n", from_tty);
125 }
126
127 void
128 _initialize_op50n ()
129 {
130 add_target (&op50n_ops);
131
132 /* this is the default, since it's that's how the board comes up after
133 power cycle. It can then be changed using set remotebaud
134 */
135 baud_rate = 9600;
136 }