Commit | Line | Data |
---|---|---|
27e889bf RS |
1 | /* |
2 | * op50n-rom.c -- configure GDB for an Oki op59n eval board. | |
3 | */ | |
e8b73ba7 RS |
4 | #include "defs.h" |
5 | #include "gdbcore.h" | |
6 | #include "target.h" | |
7 | #include "monitor.h" | |
8 | ||
9 | void op50n_open(); | |
27e889bf RS |
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[] = { | |
4e149f91 RS |
19 | "r0", "r1", "r2", "r3", "r4", "r5", "r6", |
20 | "r7", "r8", "r9", "r10", "r11", "r12", "r13", | |
21 | "r14", "r15", "r16", "r17", "r18", "r19", "r20", | |
22 | "r21", "r22", "r23", "r24", "r25", "r26", "r27", | |
23 | "r28", "r29", "r30", "r31", "", "p", "", | |
24 | "", "", "", "", "", "", "", | |
25 | "", "", "", "", "", "", "", | |
26 | "", "", "", "", "", "", "", "", | |
27 | "", "", "", "", "", "", "", | |
28 | "", "", "", "", "", "", "", "", | |
29 | "", "", "", "", "", "", "", "", | |
30 | "", "", "", "", "", "", "", "", | |
31 | "", "", "", "", "", "", "", "", | |
32 | "", "", "", "", "", "", "", "", | |
33 | "", "", "", "", "", "", "", "", | |
34 | "", "", "", "", "", "", "", "", | |
35 | "", "", "", "", "", "", "", "" | |
27e889bf | 36 | }; |
e8b73ba7 RS |
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", | |
51d6a954 | 47 | |
e8b73ba7 RS |
48 | "Debug on a Oki OP50N eval board.\n\ |
49 | Specify the serial device it is connected to (e.g. /dev/ttya).", | |
50 | op50n_open, | |
51d6a954 | 51 | |
e8b73ba7 RS |
52 | monitor_close, |
53 | 0, | |
54 | monitor_detach, | |
55 | monitor_resume, | |
56 | monitor_wait, | |
57 | monitor_fetch_register, | |
58 | monitor_store_register, | |
59 | monitor_prepare_to_store, | |
60 | monitor_xfer_inferior_memory, | |
61 | monitor_files_info, | |
62 | monitor_insert_breakpoint, | |
63 | monitor_remove_breakpoint, /* Breakpoints */ | |
64 | 0, | |
65 | 0, | |
66 | 0, | |
67 | 0, | |
68 | 0, /* Terminal handling */ | |
69 | monitor_kill, | |
70 | monitor_load, /* load */ | |
71 | 0, /* lookup_symbol */ | |
72 | monitor_create_inferior, | |
73 | monitor_mourn_inferior, | |
74 | 0, /* can_run */ | |
75 | 0, /* notice_signals */ | |
78b459a7 | 76 | 0, /* to_stop */ |
e8b73ba7 RS |
77 | process_stratum, |
78 | 0, /* next */ | |
79 | 1, | |
80 | 1, | |
81 | 1, | |
82 | 1, | |
83 | 1, /* all mem, mem, stack, regs, exec */ | |
84 | 0, | |
85 | 0, /* Section pointers */ | |
86 | OPS_MAGIC, /* Always the last thing */ | |
87 | }; | |
88 | ||
89 | struct monitor_ops op50n_cmds = { | |
27e889bf | 90 | 1, /* 1 for ASCII, 0 for binary */ |
44b95869 | 91 | "\003.\n", /* monitor init string */ |
4e149f91 RS |
92 | "g %x\n", /* execute or usually GO command */ |
93 | "g\n", /* continue command */ | |
94 | "t\n", /* single step */ | |
7804e5bc | 95 | "b %x\n", /* set a breakpoint */ |
e6fa5bd6 RS |
96 | "bx %x\n", /* clear a breakpoint */ |
97 | 0, /* 0 for number, 1 for address */ | |
51d6a954 RS |
98 | { |
99 | "sx %x %x;.\n", /* set memory */ | |
e6fa5bd6 | 100 | "", /* delimiter */ |
51d6a954 RS |
101 | "", /* the result */ |
102 | }, | |
103 | { | |
104 | "sx %x\n", /* get memory */ | |
105 | ": ", /* delimiter */ | |
106 | " ", /* the result */ | |
107 | }, | |
108 | { | |
4e149f91 RS |
109 | "x %s %x\n", /* set a register */ |
110 | "", /* delimiter between registers */ | |
27e889bf RS |
111 | "", /* the result */ |
112 | }, | |
113 | { | |
114 | "x %s\n", /* get a register */ | |
115 | "=", /* delimiter between registers */ | |
f1ca4cbc | 116 | "", /* the result */ |
27e889bf | 117 | }, |
51d6a954 | 118 | "r 0\n", /* download command */ |
27e889bf RS |
119 | "#", /* monitor command prompt */ |
120 | " ", /* end-of-command delimitor */ | |
121 | ".\n", /* optional command terminator */ | |
122 | &op50n_ops, /* target operations */ | |
21ed3dcd | 123 | "srec,ascii-srec,default", /* load types */ |
27e889bf | 124 | op50n_regnames |
e8b73ba7 RS |
125 | }; |
126 | ||
127 | void | |
128 | op50n_open(args, from_tty) | |
129 | char *args; | |
130 | int from_tty; | |
131 | { | |
27e889bf | 132 | target_preopen(from_tty); |
e8b73ba7 RS |
133 | push_target(&op50n_ops); |
134 | push_monitor (&op50n_cmds); | |
27e889bf | 135 | monitor_open (args, "op50n", from_tty); |
e8b73ba7 RS |
136 | } |
137 | ||
138 | void | |
139 | _initialize_op50n () | |
140 | { | |
141 | add_target (&op50n_ops); | |
27e889bf RS |
142 | |
143 | /* this is the default, since it's that's how the board comes up after | |
144 | power cycle. It can then be changed using set remotebaud | |
145 | */ | |
146 | baud_rate = 9600; | |
e8b73ba7 | 147 | } |