GDB Server for MVME162 Board

Joel Sherrill joel.sherrill at OARcorp.com
Thu Mar 22 20:01:36 UTC 2001


Eric Norum wrote:
> 
> "Jimmie L. Hebert" wrote:
> >
> > Does anyone have a GDB Server for the MVME162 Board.  I would like to
> > Debug via an Network
> > Link.
> 
> I seem to recall that there was a gdb/167bug-rom.c available from the
> OAR site.  If not, I can probably find it somewhere around here and post
> it.

I have sent the entire patch to Jimmie privately but this is 
the file gdb/162bug-rom.c.  I never could get it to work 
100% reliably.  Maybe someone else will have more luck.

FYI I was downloading using the network loaded in Mbug, then
getting into gdb and starting the debug.

> --
> Eric Norum                                 eric.norum at usask.ca
> Department of Electrical Engineering       Phone: (306) 966-5394
> University of Saskatchewan                 FAX:   (306) 966-5407
> Saskatoon, Canada.

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985
-------------- next part --------------
/* Remote debugging interface for 162bug Rom monitor for GDB, the GNU debugger.
   Copyright 1995, 1996, 1998, 2000 Free Software Foundation, Inc.

   Adapted by Joel Sherrill <joel.sherrill at OARcorp.com>
   from 167bug-rom.c written by Charles-Antoine Gauthier
   <charles.gauthier at nrc.ca> which was adapted from
   abug-rom.c written by Rob Savoye of Cygnus Support

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 2 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, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */

#include "defs.h"
#include "gdbcore.h"
#include "target.h"
#include "monitor.h"
#include "serial.h"

/* Prototypes for local functions. */

static void m162bug_open (char *args, int from_tty);

static void
m162bug_supply_register (regname, regnamelen, val, vallen)
     char *regname;
     int regnamelen;
     char *val;
     int vallen;
{
  int regno;
  char *terminated_val;

  if (regnamelen != 2)
    return;

  switch (regname[0])
    {
    case 'S':
      if (regname[1] != 'R')
	return;
      regno = PS_REGNUM;
      break;
    case 'P':
      if (regname[1] != 'C')
	return;
      regno = PC_REGNUM;
      break;
    case 'D':
      if (regname[1] < '0' || regname[1] > '7')
	return;
      regno = regname[1] - '0' + D0_REGNUM;
      break;
    case 'A':
      if (regname[1] < '0' || regname[1] > '7')
	return;
      regno = regname[1] - '0' + A0_REGNUM;
      break;
    default:
      return;
    }

  terminated_val = (char *) xmalloc(vallen + 1);
  strncpy (terminated_val, val, vallen);
  monitor_supply_register (regno, terminated_val);
  free(terminated_val);
}

/*
 * This array of registers needs to match the indexes used by GDB. The
 * whole reason this exists is because the various ROM monitors use
 * different names than GDB does, and don't support all the
 * registers either. So, typing "info reg sp" becomes an "A7".
 */

static char *m162bug_regnames[NUM_REGS] =
{
  "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
  "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
  "SR", "PC",
  "FP0", "FP1", "FP2", "FP3", "FP4", "FP5", "FP6", "FP7",
  "FPCR", "FPSR", "FPIAR"
};

/*
 * Define the monitor command strings. Since these are passed directly
 * through to a printf style function, we need can include formatting
 * strings. We also need a CR or LF on the end.
 */

static struct target_ops m162bug_ops;

static char *m162bug_inits[] = {"\r", NULL};

static struct monitor_ops m162bug_cmds ;

static void 
init_m162bug_cmds(void)
{
  m162bug_cmds.flags =   MO_CLR_BREAK_USES_ADDR;
  m162bug_cmds.init =   m162bug_inits;			/* Init strings */
  m162bug_cmds.cont =   "g\r";			/* continue command */
  m162bug_cmds.step =   "t\r";			/* single step */
  m162bug_cmds.stop =   NULL;				/* interrupt command */
  m162bug_cmds.set_break =   "br %x\r";			/* set a breakpoint */
  m162bug_cmds.clr_break =   "nobr %x\r";			/* clear a breakpoint */
  m162bug_cmds.clr_all_break =   "nobr\r";			/* clear all breakpoints */
  m162bug_cmds.fill =   "bf %x:%x %x;b\r";		/* fill (start count val) */
  m162bug_cmds.setmem.cmdb =     "mw %x %02x;b\r";		/* setmem.cmdb (addr, value) */
  m162bug_cmds.setmem.cmdw =     "mw %x %04x;w\r";		/* setmem.cmdw (addr, value) */
  m162bug_cmds.setmem.cmdl =     "mw %x %08x;l\r";		/* setmem.cmdl (addr, value) */
  m162bug_cmds.setmem.cmdll =     NULL;			/* setmem.cmdll (addr, value) */
  m162bug_cmds.setmem.resp_delim =     NULL;			/* setreg.resp_delim */
  m162bug_cmds.setmem.term =     NULL;			/* setreg.term */
  m162bug_cmds.setmem.term_cmd =     NULL;			/* setreg.term_cmd */
  m162bug_cmds.getmem.cmdb =     "md %x:%x;b\r";		/* getmem.cmdb (addr, len) */
  m162bug_cmds.getmem.cmdw =     "md %x:%x;b\r";		/* getmem.cmdw (addr, len) */
  m162bug_cmds.getmem.cmdl =     "md %x:%x;b\r";		/* getmem.cmdl (addr, len) */
  m162bug_cmds.getmem.cmdll =     NULL;			/* getmem.cmdll (addr, len) */
  m162bug_cmds.getmem.resp_delim =     " ";			/* getmem.resp_delim */
  m162bug_cmds.getmem.term =     NULL;			/* getmem.term */
  m162bug_cmds.getmem.term_cmd =     NULL;			/* getmem.term_cmd */
  m162bug_cmds.setreg.cmd =     "rs %s %x\r";		/* setreg.cmd (name, value) */
  m162bug_cmds.setreg.resp_delim =    NULL ;			/* setreg.resp_delim */
  m162bug_cmds.setreg.term =     NULL;			/* setreg.term */
  m162bug_cmds.setreg.term_cmd =     NULL	;		/* setreg.term_cmd */
  m162bug_cmds.getreg.cmd =     "rm %s\r";			/* getreg.cmd (name) */
  m162bug_cmds.getreg.resp_delim =     "=";			/* getreg.resp_delim */
  m162bug_cmds.getreg.term =     "? ";			/* getreg.term */
  m162bug_cmds.getreg.term_cmd =     ".\r"	;		/* getreg.term_cmd */
    m162bug_cmds.dump_registers =   "rd\r";			/* dump_registers */
  m162bug_cmds.register_pattern =   "\\(\\w+\\) +=\\([0-9a-fA-F]+\\b\\)"; /* register_pattern */
  m162bug_cmds.supply_register =   m162bug_supply_register;	/* supply_register */
  m162bug_cmds.load_routine =   NULL;				/* load_routine (defaults to SRECs) */
  m162bug_cmds.load =   "lo 0\r";			/* download command */
  m162bug_cmds.loadresp =   "\n";				/* load response */
  m162bug_cmds.prompt =   "162-Bug>";			/* monitor command prompt */
  m162bug_cmds.line_term =   "\r";				/* end-of-line terminator */
  m162bug_cmds.cmd_end =   NULL;				/* optional command terminator */
  m162bug_cmds.target =   &m162bug_ops;			/* target operations */
  m162bug_cmds.stopbits =   SERIAL_1_STOPBITS;		/* number of stop bits */
  m162bug_cmds.regnames =   m162bug_regnames;		/* registers names */
  m162bug_cmds.magic =   MONITOR_OPS_MAGIC	;	/* magic */
}; 

static void
m162bug_open(args, from_tty)
     char *args;
     int from_tty;
{
  monitor_open (args, &m162bug_cmds, from_tty);
}

void
_initialize_m162bug_rom ()
{
  init_m162bug_cmds() ;
  init_monitor_ops (&m162bug_ops);

  m162bug_ops.to_shortname = "162bug";
  m162bug_ops.to_longname = "162bug monitor";
  m162bug_ops.to_doc = "Debug via the 162bug monitor.\n\
Specify the serial device it is connected to (e.g. /dev/ttya).";
  m162bug_ops.to_open = m162bug_open;

  add_target (&m162bug_ops);
}


More information about the users mailing list