From 27e889bf600d712a0135265b1f0b3c0207e84ff6 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Thu, 6 Oct 1994 05:28:49 +0000 Subject: [PATCH] Both targets initialize, can dump registers too. --- gdb/op50-rom.c | 83 ++++++++++++++++++++++++++++++++++++++------------ gdb/w89k-rom.c | 64 ++++++++++++++++++++++++++++++-------- 2 files changed, 116 insertions(+), 31 deletions(-) diff --git a/gdb/op50-rom.c b/gdb/op50-rom.c index 419c875351e..ea08a266765 100644 --- a/gdb/op50-rom.c +++ b/gdb/op50-rom.c @@ -1,10 +1,39 @@ +/* + * op50n-rom.c -- configure GDB for an Oki op59n eval board. + */ #include "defs.h" #include "gdbcore.h" #include "target.h" #include "monitor.h" void op50n_open(); -void general_open(); +void monitor_open(); + +/* + * this array of registers need to match the indexes used by GDB. The + * whole reason this exists is cause the various ROM monitors use + * different strings than GDB does, and doesn't support all the + * registers either. So, typing "info reg sp" becomes a "r30". + */ +static char *op50n_regnames[] = { + "r0_zero", "r1_tO ", "r2_rp ", "r3_s15 ", "r4_s14 ", "r5_s13 ", "r6_s12 ", + "r7_s11 ", "r8_s10 ", "r9_s9 ", "r10_s8 ", "r11_s7 ", "r12_s6 ", "r13_s5 ", + "r14_s4 ", "r15_s3 ", "r16_s2 ", "r17_s1 ", "r18_s0 ", "r19_t4 ", "r20_t3 ", + "r21_t2 ", "r22_t1 ", "r23_a3 ", "r24_a2 ", "r25_a1 ", "r26_a0 ", "r27_dp ", + "r28_v0 ", "r29_v1 ", "r30_sp ", "r31_t5 ", "", "", "", + "", "", "", "", "", "", "", + "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "" +}; /* * Define the monitor command strings. Since these are passed directly @@ -55,23 +84,33 @@ Specify the serial device it is connected to (e.g. /dev/ttya).", }; struct monitor_ops op50n_cmds = { - "\r", /* monitor init string */ - "g\r", /* execute or usually GO command */ - "g\r", /* continue command */ - "t\r", /* single step */ - "b %x\r", /* set a breakpoint */ - "b %x\r", /* clear a breakpoint */ - "s %x %x\r", /* set memory to a value */ - "s %x\r", /* display memory */ - "", /* prompt memory commands use */ - "x %s %x\r", /* set a register */ - "", /* delimiter between registers */ - "x %s\r", /* read a register */ - "r\r", /* download command */ - "#", /* monitor command prompt */ - "", /* end-of-command delimitor */ - ".", /* optional command terminator */ - &op50n_ops /* target operations */ + 1, /* 1 for ASCII, 0 for binary */ + "\n", /* monitor init string */ + "", /* execute or usually GO command */ + "", /* continue command */ + "", /* single step */ + "", /* set a breakpoint */ + "", /* clear a breakpoint */ + "", /* set memory to a value */ + "", /* display memory */ + "", /* prompt memory commands use */ + { /* set a register */ + "x %s %x\n", /* set a register */ + "", /* delimiter between registers */ + "", /* the result */ + }, + { + "x %s\n", /* get a register */ + "=", /* delimiter between registers */ + " ", /* the result */ + }, + "r 0\r", /* download command */ + "#", /* monitor command prompt */ + " ", /* end-of-command delimitor */ + ".\n", /* optional command terminator */ + &op50n_ops, /* target operations */ + "srec,binary", /* load types */ + op50n_regnames }; void @@ -79,13 +118,19 @@ op50n_open(args, from_tty) char *args; int from_tty; { + target_preopen(from_tty); push_target(&op50n_ops); push_monitor (&op50n_cmds); - general_open (args, "op50n", from_tty); + monitor_open (args, "op50n", from_tty); } void _initialize_op50n () { add_target (&op50n_ops); + + /* this is the default, since it's that's how the board comes up after + power cycle. It can then be changed using set remotebaud + */ + baud_rate = 9600; } diff --git a/gdb/w89k-rom.c b/gdb/w89k-rom.c index 65078ced954..cc8b98c03f8 100644 --- a/gdb/w89k-rom.c +++ b/gdb/w89k-rom.c @@ -3,8 +3,34 @@ #include "target.h" #include "monitor.h" +extern int baud_rate; + void w89k_open(); -void general_open(); +void monitor_open(); + +/* + * this array of registers need to match the indexes used by GDB. The + * whole reason this exists is cause the various ROM monitors use + * different strings than GDB does, and doesn't support all the + * registers either. So, typing "info reg sp" becomes a "r30". + */ +static char *w89k_regnames[] = { + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", + "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", + "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", + "r30", "r31", "sar", "", "", "", "", + "eiem", "iir", "iva", "ior", "ipsw","", "", "", "", "", + "", "", "", "", "", "", "", "ccr", "", "", + "tr0", "tr1", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "", + "", "", "", "", "", "", "", "" +}; /* * Define the monitor command strings. Since these are passed directly @@ -55,23 +81,33 @@ Specify the serial device it is connected to (e.g. /dev/ttya).", }; struct monitor_ops w89k_cmds = { - "\r", /* monitor init string */ - "G\r", /* execute or usually GO command */ - "G\r", /* continue command */ - "T\r", /* single step */ + 1, /* 1 for ASCII, 0 for binary */ + "\r", /* monitor init string */ + "G = 100000\r", /* execute or usually GO command */ + "G\r", /* continue command */ + "T\r", /* single step */ "BP %x\r", /* set a breakpoint */ "BC %x\r", /* clear a breakpoint */ "E %x %x\r", /* set memory to a value */ "D %x\r", /* display memory */ - "", /* prompt memory commands use */ - "R %s %x\r", /* set a register */ - "", /* delimiter between registers */ - "R %s\r", /* read a register */ - "L\r", /* download command */ + "", /* prompt memory commands use */ + { /* set a register */ + "r %s %x\r", /* set a register */ + "", /* delimiter between registers */ + "", /* the result */ + }, + { + "r %s\r", /* get a register */ + "", /* delimiter between registers */ + "", /* the result */ + }, + "U\r", /* download command */ "ROM>", /* monitor command prompt */ "", /* end-of-command delimitor */ "", /* optional command terminator */ - &w89k_ops /* target operations */ + &w89k_ops, /* target operations */ + "xmodem-srec,xmodem-som", /* load types */ + w89k_regnames /* registers names */ }; void @@ -79,15 +115,19 @@ w89k_open(args, from_tty) char *args; int from_tty; { + target_preopen(from_tty); push_target (&w89k_ops); push_monitor (&w89k_cmds); - general_open (args, "w89k", from_tty); + monitor_open (args, "w89k", from_tty); } void _initialize_w89k () { add_target (&w89k_ops); + + /* this is the default, since it's the only baud rate supported by the hardware */ + baud_rate = 9600; } -- 2.30.2