* config/djgpp/fnchange.lst: Add translations for cpu-microblaze.c,
elf32-microblaze.c, microblaze-rom.c, microblaze-linux-tdep.c,
microblaze-tdep.h, microblaze-tdep.c, microblaze-opc.h,
microblaze-opcm.h, microblaze-dis.c, microblaze-dis.h, sim/microblaze,
microblaze.h, and microblaze.isa.
* configure.tgt: Add targets microblaze*-linux-*, microblaze*-xilinx-*.
* Makefile.in: Build microblaze-tdep.o, microblaze-linux-tdep.o.
HFILES_NO_SRCDIR: Add microblaze-tdep.h.
* microblaze-linux-tdep.c: New.
* microblaze-tdep.c: New.
* microblaze-tdep.h: New.
* NEWS: Announce Xilinx MicroBlaze support.
2009-10-15 21:28:52 +02:00
|
|
|
/* Remote debugging interface to Xilinx MicroBlaze.
|
|
|
|
|
2015-01-01 10:32:14 +01:00
|
|
|
Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
* config/djgpp/fnchange.lst: Add translations for cpu-microblaze.c,
elf32-microblaze.c, microblaze-rom.c, microblaze-linux-tdep.c,
microblaze-tdep.h, microblaze-tdep.c, microblaze-opc.h,
microblaze-opcm.h, microblaze-dis.c, microblaze-dis.h, sim/microblaze,
microblaze.h, and microblaze.isa.
* configure.tgt: Add targets microblaze*-linux-*, microblaze*-xilinx-*.
* Makefile.in: Build microblaze-tdep.o, microblaze-linux-tdep.o.
HFILES_NO_SRCDIR: Add microblaze-tdep.h.
* microblaze-linux-tdep.c: New.
* microblaze-tdep.c: New.
* microblaze-tdep.h: New.
* NEWS: Announce Xilinx MicroBlaze support.
2009-10-15 21:28:52 +02:00
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
#include "gdbcore.h"
|
|
|
|
#include "target.h"
|
|
|
|
#include "monitor.h"
|
|
|
|
#include "serial.h"
|
|
|
|
#include "regcache.h"
|
|
|
|
|
2012-05-08 16:07:09 +02:00
|
|
|
void _initialize_picobug_rom (void);
|
|
|
|
|
* config/djgpp/fnchange.lst: Add translations for cpu-microblaze.c,
elf32-microblaze.c, microblaze-rom.c, microblaze-linux-tdep.c,
microblaze-tdep.h, microblaze-tdep.c, microblaze-opc.h,
microblaze-opcm.h, microblaze-dis.c, microblaze-dis.h, sim/microblaze,
microblaze.h, and microblaze.isa.
* configure.tgt: Add targets microblaze*-linux-*, microblaze*-xilinx-*.
* Makefile.in: Build microblaze-tdep.o, microblaze-linux-tdep.o.
HFILES_NO_SRCDIR: Add microblaze-tdep.h.
* microblaze-linux-tdep.c: New.
* microblaze-tdep.c: New.
* microblaze-tdep.h: New.
* NEWS: Announce Xilinx MicroBlaze support.
2009-10-15 21:28:52 +02:00
|
|
|
static char *picobug_inits[] =
|
|
|
|
{"\r", NULL};
|
|
|
|
|
|
|
|
static struct target_ops picobug_ops;
|
|
|
|
static struct monitor_ops picobug_cmds;
|
|
|
|
|
2011-01-09 04:20:33 +01:00
|
|
|
/* Picobug only supports a subset of registers from MCore. In reality,
|
* config/djgpp/fnchange.lst: Add translations for cpu-microblaze.c,
elf32-microblaze.c, microblaze-rom.c, microblaze-linux-tdep.c,
microblaze-tdep.h, microblaze-tdep.c, microblaze-opc.h,
microblaze-opcm.h, microblaze-dis.c, microblaze-dis.h, sim/microblaze,
microblaze.h, and microblaze.isa.
* configure.tgt: Add targets microblaze*-linux-*, microblaze*-xilinx-*.
* Makefile.in: Build microblaze-tdep.o, microblaze-linux-tdep.o.
HFILES_NO_SRCDIR: Add microblaze-tdep.h.
* microblaze-linux-tdep.c: New.
* microblaze-tdep.c: New.
* microblaze-tdep.h: New.
* NEWS: Announce Xilinx MicroBlaze support.
2009-10-15 21:28:52 +02:00
|
|
|
it doesn't support ss1, either. */
|
|
|
|
static char *picobug_regnames[] = {
|
|
|
|
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
|
|
|
|
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
"psr", "vbr", "epsr", "fpsr", "epc", "fpc", 0, "ss1",
|
|
|
|
"ss2", "ss3", "ss4", 0, 0, 0, 0, 0,
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
"pc" };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
constify to_open
This makes target_ops::to_open take a const string and then fixes the
fallout.
There were a few of these I could not build. However I eyeballed it
and in any case the fixes should generally be trivial.
This is based on the patch to fix up the target debugging for to_open,
because that changes gdb to not directly install to_open as the target
command
2014-07-30 Tom Tromey <tromey@redhat.com>
* bsd-kvm.c (bsd_kvm_open): Constify.
* corelow.c (core_open): Constify.
* ctf.c (ctf_open): Constify.
* dbug-rom.c (dbug_open): Constify.
* exec.c (exec_open): Constify.
* m32r-rom.c (m32r_open, mon2000_open): Constify.
* microblaze-rom.c (picobug_open): Constify.
* nto-procfs.c (procfs_open_1, procfs_open, procfs_native_open):
Constify.
* ppcbug-rom.c (ppcbug_open0, ppcbug_open1): Constify.
* record-btrace.c (record_btrace_open): Constify.
* record-full.c (record_full_core_open_1, record_full_open_1)
(record_full_open): Constify.
* remote-m32r-sdi.c (m32r_open): Constify.
* remote-mips.c (common_open, mips_open, pmon_open, ddb_open)
(rockhopper_open, lsi_open): Constify.
* remote-sim.c (gdbsim_open): Constify.
* remote.c (remote_open, extended_remote_open, remote_open_1):
Constify.
* target.h (struct target_ops) <to_open>: Make "arg" const.
* tracefile-tfile.c (tfile_open): Constify.
2014-07-22 18:56:01 +02:00
|
|
|
picobug_open (const char *args, int from_tty)
|
* config/djgpp/fnchange.lst: Add translations for cpu-microblaze.c,
elf32-microblaze.c, microblaze-rom.c, microblaze-linux-tdep.c,
microblaze-tdep.h, microblaze-tdep.c, microblaze-opc.h,
microblaze-opcm.h, microblaze-dis.c, microblaze-dis.h, sim/microblaze,
microblaze.h, and microblaze.isa.
* configure.tgt: Add targets microblaze*-linux-*, microblaze*-xilinx-*.
* Makefile.in: Build microblaze-tdep.o, microblaze-linux-tdep.o.
HFILES_NO_SRCDIR: Add microblaze-tdep.h.
* microblaze-linux-tdep.c: New.
* microblaze-tdep.c: New.
* microblaze-tdep.h: New.
* NEWS: Announce Xilinx MicroBlaze support.
2009-10-15 21:28:52 +02:00
|
|
|
{
|
|
|
|
monitor_open (args, &picobug_cmds, from_tty);
|
|
|
|
}
|
|
|
|
/* We choose to write our own dumpregs routine, since the output of
|
|
|
|
the register dumping is rather difficult to encapsulate in a
|
|
|
|
regexp:
|
|
|
|
|
|
|
|
picobug> rd
|
|
|
|
pc 2f00031e epc 2f00031e fpc 00000000
|
|
|
|
psr 80000101 epsr 80000101 fpsr 00000000
|
|
|
|
ss0-ss4 bad0beef 00000000 00000000 00000000 00000000 vbr 30005c00
|
|
|
|
r0-r7 2f0fff4c 00000090 00000001 00000002 00000003 00000004 00000005 00000006
|
|
|
|
r8-r15 2f0fff64 00000000 00000000 00000000 00000000 00000000 00000000 2f00031e
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int
|
|
|
|
picobug_dumpregs (struct regcache *regcache)
|
|
|
|
{
|
|
|
|
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
|
|
|
char buf[1024];
|
|
|
|
int resp_len;
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
/* Send the dump register command to the monitor and
|
|
|
|
get the reply. */
|
|
|
|
monitor_printf (picobug_cmds.dump_registers);
|
|
|
|
resp_len = monitor_expect_prompt (buf, sizeof (buf));
|
|
|
|
|
|
|
|
p = strtok (buf, " \t\r\n");
|
|
|
|
while (p)
|
|
|
|
{
|
|
|
|
if (strchr (p, '-'))
|
|
|
|
{
|
2011-01-09 04:20:33 +01:00
|
|
|
/* Got a range. Either r0-r7, r8-r15 or ss0-ss4. */
|
2015-03-06 10:42:06 +01:00
|
|
|
if (startswith (p, "r0") || startswith (p, "r8"))
|
* config/djgpp/fnchange.lst: Add translations for cpu-microblaze.c,
elf32-microblaze.c, microblaze-rom.c, microblaze-linux-tdep.c,
microblaze-tdep.h, microblaze-tdep.c, microblaze-opc.h,
microblaze-opcm.h, microblaze-dis.c, microblaze-dis.h, sim/microblaze,
microblaze.h, and microblaze.isa.
* configure.tgt: Add targets microblaze*-linux-*, microblaze*-xilinx-*.
* Makefile.in: Build microblaze-tdep.o, microblaze-linux-tdep.o.
HFILES_NO_SRCDIR: Add microblaze-tdep.h.
* microblaze-linux-tdep.c: New.
* microblaze-tdep.c: New.
* microblaze-tdep.h: New.
* NEWS: Announce Xilinx MicroBlaze support.
2009-10-15 21:28:52 +02:00
|
|
|
{
|
|
|
|
int rn = (p[1] == '0' ? 0 : 8);
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
/* Get the next 8 values and record them. */
|
|
|
|
while (i < 8)
|
|
|
|
{
|
|
|
|
p = strtok (NULL, " \t\r\n");
|
|
|
|
if (p)
|
|
|
|
monitor_supply_register (regcache, rn + i, p);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
2015-03-06 10:42:06 +01:00
|
|
|
else if (startswith (p, "ss"))
|
* config/djgpp/fnchange.lst: Add translations for cpu-microblaze.c,
elf32-microblaze.c, microblaze-rom.c, microblaze-linux-tdep.c,
microblaze-tdep.h, microblaze-tdep.c, microblaze-opc.h,
microblaze-opcm.h, microblaze-dis.c, microblaze-dis.h, sim/microblaze,
microblaze.h, and microblaze.isa.
* configure.tgt: Add targets microblaze*-linux-*, microblaze*-xilinx-*.
* Makefile.in: Build microblaze-tdep.o, microblaze-linux-tdep.o.
HFILES_NO_SRCDIR: Add microblaze-tdep.h.
* microblaze-linux-tdep.c: New.
* microblaze-tdep.c: New.
* microblaze-tdep.h: New.
* NEWS: Announce Xilinx MicroBlaze support.
2009-10-15 21:28:52 +02:00
|
|
|
{
|
2011-01-09 04:20:33 +01:00
|
|
|
/* Get the next five values, ignoring the first. */
|
* config/djgpp/fnchange.lst: Add translations for cpu-microblaze.c,
elf32-microblaze.c, microblaze-rom.c, microblaze-linux-tdep.c,
microblaze-tdep.h, microblaze-tdep.c, microblaze-opc.h,
microblaze-opcm.h, microblaze-dis.c, microblaze-dis.h, sim/microblaze,
microblaze.h, and microblaze.isa.
* configure.tgt: Add targets microblaze*-linux-*, microblaze*-xilinx-*.
* Makefile.in: Build microblaze-tdep.o, microblaze-linux-tdep.o.
HFILES_NO_SRCDIR: Add microblaze-tdep.h.
* microblaze-linux-tdep.c: New.
* microblaze-tdep.c: New.
* microblaze-tdep.h: New.
* NEWS: Announce Xilinx MicroBlaze support.
2009-10-15 21:28:52 +02:00
|
|
|
int rn;
|
|
|
|
p = strtok (NULL, " \t\r\n");
|
|
|
|
for (rn = 39; rn < 43; rn++)
|
|
|
|
{
|
|
|
|
p = strtok (NULL, " \t\r\n");
|
|
|
|
if (p)
|
|
|
|
monitor_supply_register (regcache, rn, p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Simple register type, paired. */
|
|
|
|
char *name = p;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* Get and record value. */
|
|
|
|
p = strtok (NULL, " \t\r\n");
|
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
for (i = 0; i < gdbarch_num_regs (gdbarch); i++)
|
|
|
|
{
|
|
|
|
if (picobug_regnames[i]
|
|
|
|
&& strcmp (picobug_regnames[i], name) == 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i <= gdbarch_num_regs (gdbarch))
|
|
|
|
monitor_supply_register (regcache, i, p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
p = strtok (NULL, " \t\r\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
init_picobug_cmds (void)
|
|
|
|
{
|
|
|
|
picobug_cmds.flags = MO_GETMEM_NEEDS_RANGE | MO_CLR_BREAK_USES_ADDR
|
|
|
|
| MO_PRINT_PROGRAM_OUTPUT;
|
|
|
|
|
|
|
|
picobug_cmds.init = picobug_inits; /* Init strings */
|
|
|
|
picobug_cmds.cont = "g\n"; /* continue command */
|
|
|
|
picobug_cmds.step = "s\n"; /* single step */
|
|
|
|
picobug_cmds.set_break = "br %x\n"; /* set a breakpoint */
|
|
|
|
picobug_cmds.clr_break = "nobr %x\n"; /* clear a breakpoint */
|
|
|
|
picobug_cmds.clr_all_break = "nobr\n"; /* clear all breakpoints */
|
|
|
|
picobug_cmds.setmem.cmdb = "mm %x %x ;b\n"; /* setmem.cmdb (addr, value) */
|
|
|
|
picobug_cmds.setmem.cmdw = "mm %x %x ;h\n"; /* setmem.cmdw (addr, value) */
|
|
|
|
picobug_cmds.setmem.cmdl = "mm %x %x ;w\n"; /* setmem.cmdl (addr, value) */
|
|
|
|
picobug_cmds.getmem.cmdb = "md %x %x\n"; /* getmem.cmdb (start addr,
|
|
|
|
end addr) */
|
|
|
|
picobug_cmds.getmem.resp_delim = ":"; /* getmem.resp_delim */
|
|
|
|
picobug_cmds.setreg.cmd = "rm %s %x\n"; /* setreg.cmd (name, value) */
|
|
|
|
picobug_cmds.getreg.cmd = "rd %s\n"; /* getreg.cmd (name) */
|
|
|
|
picobug_cmds.getreg.resp_delim = ":"; /* getreg.resp_delim */
|
|
|
|
picobug_cmds.dump_registers = "rd\n"; /* dump_registers */
|
|
|
|
picobug_cmds.dumpregs = picobug_dumpregs; /* dump registers parser */
|
|
|
|
picobug_cmds.load = "lo\n"; /* download command */
|
|
|
|
picobug_cmds.prompt = "picobug> "; /* monitor command prompt */
|
|
|
|
picobug_cmds.line_term = "\n"; /* end-of-line terminator */
|
|
|
|
picobug_cmds.target = &picobug_ops; /* target operations */
|
|
|
|
picobug_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
|
|
|
|
picobug_cmds.regnames = picobug_regnames; /* registers names */
|
|
|
|
picobug_cmds.num_breakpoints = 20; /* number of breakpoints */
|
|
|
|
picobug_cmds.magic = MONITOR_OPS_MAGIC; /* magic */
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-05-08 16:07:09 +02:00
|
|
|
_initialize_picobug_rom (void)
|
* config/djgpp/fnchange.lst: Add translations for cpu-microblaze.c,
elf32-microblaze.c, microblaze-rom.c, microblaze-linux-tdep.c,
microblaze-tdep.h, microblaze-tdep.c, microblaze-opc.h,
microblaze-opcm.h, microblaze-dis.c, microblaze-dis.h, sim/microblaze,
microblaze.h, and microblaze.isa.
* configure.tgt: Add targets microblaze*-linux-*, microblaze*-xilinx-*.
* Makefile.in: Build microblaze-tdep.o, microblaze-linux-tdep.o.
HFILES_NO_SRCDIR: Add microblaze-tdep.h.
* microblaze-linux-tdep.c: New.
* microblaze-tdep.c: New.
* microblaze-tdep.h: New.
* NEWS: Announce Xilinx MicroBlaze support.
2009-10-15 21:28:52 +02:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* Initialize m32r RevC monitor target. */
|
|
|
|
init_picobug_cmds ();
|
|
|
|
init_monitor_ops (&picobug_ops);
|
|
|
|
picobug_ops.to_shortname = "picobug";
|
|
|
|
picobug_ops.to_longname = "picobug monitor";
|
|
|
|
picobug_ops.to_doc = "Debug via the picobug monitor.\n\
|
|
|
|
Specify the serial device it is connected to (e.g. /dev/ttya).";
|
|
|
|
picobug_ops.to_open = picobug_open;
|
|
|
|
|
|
|
|
add_target (&picobug_ops);
|
|
|
|
}
|