OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [tags/] [gdb/] [gdb-6.8/] [gdb-6.8.openrisc-2.1/] [gdb/] [doc/] [or1k.texinfo] - Diff between revs 24 and 33

Only display areas with differences | Details | Blame | View Log

Rev 24 Rev 33
\input texinfo      @c -*-texinfo-*-
\input texinfo      @c -*-texinfo-*-
@c Copyright (C) 2008 Embecosm Limited
@c Copyright (C) 2008 Embecosm Limited
@c
@c
@c %**start of header
@c %**start of header
@c makeinfo ignores cmds prev to setfilename, so its arg cannot make use
@c makeinfo ignores cmds prev to setfilename, so its arg cannot make use
@c of @set vars.  However, you can override filename with makeinfo -o.
@c of @set vars.  However, you can override filename with makeinfo -o.
@setfilename or1k.info
@setfilename or1k.info
@c
@c
@include gdb-cfg.texi
@include gdb-cfg.texi
@c
@c
@settitle Debugging the OpenRISC 1000 with @value{GDBN}
@settitle Debugging the OpenRISC 1000 with @value{GDBN}
@setchapternewpage odd
@setchapternewpage odd
@c %**end of header
@c %**end of header
 
 
@iftex
@iftex
@c @smallbook
@c @smallbook
@c @cropmarks
@c @cropmarks
@end iftex
@end iftex
 
 
@finalout
@finalout
@syncodeindex ky cp
@syncodeindex ky cp
 
 
@c readline appendices use @vindex, @findex and @ftable,
@c readline appendices use @vindex, @findex and @ftable,
@c annotate.texi and gdbmi use @findex.
@c annotate.texi and gdbmi use @findex.
@syncodeindex vr cp
@syncodeindex vr cp
@syncodeindex fn cp
@syncodeindex fn cp
 
 
@c !!set manual's edition!
@c !!set manual's edition!
@set EDITION Second
@set EDITION Second
 
 
@c !!set GDB edit command default editor
@c !!set GDB edit command default editor
@set EDITOR /bin/ex
@set EDITOR /bin/ex
 
 
@c THIS MANUAL REQUIRES TEXINFO 4.0 OR LATER.
@c THIS MANUAL REQUIRES TEXINFO 4.0 OR LATER.
 
 
@c This is a dir.info fragment to support semi-automated addition of
@c This is a dir.info fragment to support semi-automated addition of
@c manuals to an info tree.
@c manuals to an info tree.
@dircategory Software development
@dircategory Software development
@direntry
@direntry
* Gdb for OpenRISC 1000: (gdb for Or1K).   The GNU debugger for OpenRISC 1000.
* Gdb for OpenRISC 1000: (gdb for Or1K).   The GNU debugger for OpenRISC 1000.
@end direntry
@end direntry
 
 
@ifinfo
@ifinfo
This file documents the @sc{gnu} debugger @value{GDBN} when used with
This file documents the @sc{gnu} debugger @value{GDBN} when used with
OpenRISC 1000 processors.
OpenRISC 1000 processors.
 
 
This is the @value{EDITION} Edition, of @cite{Debugging the OpenRISC 1000
This is the @value{EDITION} Edition, of @cite{Debugging the OpenRISC 1000
@value{GDBN}} for @value{GDBN}
@value{GDBN}} for @value{GDBN}
Version @value{GDBVN}.
Version @value{GDBVN}.
 
 
Copyright (C) 2008 Embecosm Limited
Copyright (C) 2008 Embecosm Limited
 
 
Permission is granted to copy, distribute and/or modify this document
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 3 or
under the terms of the GNU Free Documentation License, Version 3 or
any later version published by the Free Software Foundation; with the
any later version published by the Free Software Foundation; with the
Front-Cover Texts being ``Debugging the OpenRISC 1000 with GDB by
Front-Cover Texts being ``Debugging the OpenRISC 1000 with GDB by
Jeremy Bennett'' and with the Back-Cover Texts being ``You are free to
Jeremy Bennett'' and with the Back-Cover Texts being ``You are free to
copy and modify this Manual.''
copy and modify this Manual.''
@end ifinfo
@end ifinfo
 
 
@titlepage
@titlepage
@title Debugging the OpenRISC 1000 with @value{GDBN}
@title Debugging the OpenRISC 1000 with @value{GDBN}
@subtitle Target Processor Manual
@subtitle Target Processor Manual
@sp 1
@sp 1
@subtitle @value{EDITION} Edition, for @value{GDBN} version @value{GDBVN}
@subtitle @value{EDITION} Edition, for @value{GDBN} version @value{GDBVN}
@author Jeremy Bennett, Embecosm Limited
@author Jeremy Bennett, Embecosm Limited
@page
@page
@tex
@tex
{\parskip=0pt
{\parskip=0pt
\hfill Please report bugs using the OpenCores tracker:\par
\hfill Please report bugs using the OpenCores tracker:\par
\hfill @uref{www.opencores.org/ptracker.cgi/list/or1k}.\par
\hfill @uref{www.opencores.org/ptracker.cgi/list/or1k}.\par
\hfill {\it Debugging the OpenRISC 1000 with @value{GDBN}}\par
\hfill {\it Debugging the OpenRISC 1000 with @value{GDBN}}\par
\hfill \TeX{}info \texinfoversion\par
\hfill \TeX{}info \texinfoversion\par
}
}
@end tex
@end tex
 
 
@vskip 0pt plus 1filll
@vskip 0pt plus 1filll
Copyright @copyright{} 2008
Copyright @copyright{} 2008
Embecosm Limited.
Embecosm Limited.
@sp 2
@sp 2
Published by Embecosm Limited@*
Published by Embecosm Limited@*
68 Hambledon Road
68 Hambledon Road
Bournemouth BH7 6PJ, UK@*
Bournemouth BH7 6PJ, UK@*
 
 
Permission is granted to copy, distribute and/or modify this document
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 3 or
under the terms of the GNU Free Documentation License, Version 3 or
any later version published by the Free Software Foundation; with the
any later version published by the Free Software Foundation; with the
Front-Cover Texts being ``Debugging the OpenRISC 1000 with GDB by
Front-Cover Texts being ``Debugging the OpenRISC 1000 with GDB by
Jeremy Bennett'' and with the Back-Cover Texts being ``You are free to
Jeremy Bennett'' and with the Back-Cover Texts being ``You are free to
copy and modify this Manual.''
copy and modify this Manual.''
@end titlepage
@end titlepage
@page
@page
 
 
@ifnottex
@ifnottex
@node Top, Summary, (dir), (dir)
@node Top, Summary, (dir), (dir)
 
 
@top Debugging the OpenRISC 1000 with @value{GDBN}
@top Debugging the OpenRISC 1000 with @value{GDBN}
 
 
This file describes @value{GDBN}, the @sc{gnu} symbolic debugger for
This file describes @value{GDBN}, the @sc{gnu} symbolic debugger for
use with the OpenRISC 1000 processor architecture.
use with the OpenRISC 1000 processor architecture.
 
 
This is the @value{EDITION} Edition, for @value{GDBN} Version
This is the @value{EDITION} Edition, for @value{GDBN} Version
@value{GDBVN}.
@value{GDBVN}.
 
 
Copyright (C) 2008 Embecosm Limited
Copyright (C) 2008 Embecosm Limited
 
 
@menu
@menu
* Summary::                         Summary of @value{GDBN} with OpenRISC 1000
* Summary::                         Summary of @value{GDBN} with OpenRISC 1000
* Connecting to the Target::        Connecting to an OpenRISC 1000 Target
* Connecting to the Target::        Connecting to an OpenRISC 1000 Target
* OpenRISC 1000 Specific Commands:: Commands just for the OpenRISC 1000
* OpenRISC 1000 Specific Commands:: Commands just for the OpenRISC 1000
* OpenRISC 1000 Example::           A small example
* OpenRISC 1000 Example::           A small example
* OpenRISC 1000 Limitations::       Known problems
* OpenRISC 1000 Limitations::       Known problems
 
 
* Copying::                         GNU General Public License says
* Copying::                         GNU General Public License says
                                    how you can copy and share GDB
                                    how you can copy and share GDB
* GNU Free Documentation License::  The license for this documentation
* GNU Free Documentation License::  The license for this documentation
* Index::                           Index
* Index::                           Index
@end menu
@end menu
 
 
@end ifnottex
@end ifnottex
 
 
@contents
@contents
 
 
@node Summary
@node Summary
@unnumbered Summary of @value{GDBN} with OpenRISC 1000
@unnumbered Summary of @value{GDBN} with OpenRISC 1000
@cindex Overview
@cindex Overview
@cindex Summary
@cindex Summary
 
 
@value{GDBN} is described well in its user manual, ``Debugging with GDB: The
@value{GDBN} is described well in its user manual, ``Debugging with GDB: The
GNU Source-Level Debugger''.
GNU Source-Level Debugger''.
 
 
@cindex RSP
@cindex RSP
@cindex Remote Serial Protocol
@cindex Remote Serial Protocol
This manual describes how to use @value{GDBN} to debug C programs cross
This manual describes how to use @value{GDBN} to debug C programs cross
compiled for and running on processors using the OpenRISC 1000
compiled for and running on processors using the OpenRISC 1000
architecture. In general @value{GDBN} does not run on the actual target, but
architecture. In general @value{GDBN} does not run on the actual target, but
on a separate host processor. It communicates with the target via the
on a separate host processor. It communicates with the target via the
@value{GDBN} @dfn{Remote Serial Protocol} (@acronym{RSP}).
@value{GDBN} @dfn{Remote Serial Protocol} (@acronym{RSP}).
 
 
@cindex JTAG
@cindex JTAG
@cindex jtag, target
@cindex jtag, target
@cindex target jtag
@cindex target jtag
For backwards compatibility, @value{GDBN} for OpenRISC also supports the
For backwards compatibility, @value{GDBN} for OpenRISC also supports the
legacy custom remote protocol, which drives the JTAG interface on the OpenRISC
legacy custom remote protocol, which drives the JTAG interface on the OpenRISC
1000.  This is provided by adding a special target, ``jtag'' to @value{GDBN},
1000.  This is provided by adding a special target, ``jtag'' to @value{GDBN},
allowing the debugger to connect via the JTAG interface. @xref{Connecting to
allowing the debugger to connect via the JTAG interface. @xref{Connecting to
the Target,,Connecting to the Target}.
the Target,,Connecting to the Target}.
 
 
@cindex SPR
@cindex SPR
@cindex Special Purpose Registers
@cindex Special Purpose Registers
@cindex @command{spr} command
@cindex @command{spr} command
@cindex commands, @command{spr}
@cindex commands, @command{spr}
@cindex @command{info spr} command
@cindex @command{info spr} command
@cindex commands, @command{info spr}
@cindex commands, @command{info spr}
@cindex OpenRISC 1000 specific commands
@cindex OpenRISC 1000 specific commands
@cindex commands, OpenRISC 1000 specific
@cindex commands, OpenRISC 1000 specific
In addition the info command is extended to allow inspection of
In addition the info command is extended to allow inspection of
OpenRISC 1000 Special Purpose registers, and a new command ``spr'' is
OpenRISC 1000 Special Purpose registers, and a new command ``spr'' is
added to set the value of a Special Purpose Register. @xref{OpenRISC 1000
added to set the value of a Special Purpose Register. @xref{OpenRISC 1000
Specific Commands,,OpenRISC 1000 Specific Commands}.
Specific Commands,,OpenRISC 1000 Specific Commands}.
 
 
@cindex @command{info registers} command  for OpenRISC 1000
@cindex @command{info registers} command  for OpenRISC 1000
@cindex commands, @command{info registers} for OpenRISC 1000
@cindex commands, @command{info registers} for OpenRISC 1000
All the normal GDB commands should work, although hardware watchpoints are not
All the normal GDB commands should work, although hardware watchpoints are not
tested at present. The @command{info registers} command will show the 32 general
tested at present. The @command{info registers} command will show the 32 general
purpose registers, while the @command{info registers all} command will add the
purpose registers, while the @command{info registers all} command will add the
program counter, supervision register and exception program counter register.
program counter, supervision register and exception program counter register.
 
 
@iftex
@iftex
Throughout this document, user input is emphasised like this: @command{input},
Throughout this document, user input is emphasised like this: @command{input},
program output is show like this: @code{Hello World!}.
program output is show like this: @code{Hello World!}.
@end iftex
@end iftex
 
 
@cindex graphical debugging
@cindex graphical debugging
@cindex graphical debugging, @command{gdbtui}
@cindex graphical debugging, @command{gdbtui}
@cindex graphical debugging, @command{ddd}
@cindex graphical debugging, @command{ddd}
@cindex @command{gdbtui}
@cindex @command{gdbtui}
@cindex @command{ddd}
@cindex @command{ddd}
For those who like their debugging graphical, the @command{gdbtui} command is
For those who like their debugging graphical, the @command{gdbtui} command is
available (typically as @command{or32-uclinux-gdbtui}). @value{GDBN} for
available (typically as @command{or32-uclinux-gdbtui}). @value{GDBN} for
OpenRISC 1000 can also be run under @command{ddd} as follows:
OpenRISC 1000 can also be run under @command{ddd} as follows:
 
 
@example
@example
@command{ddd --debugger=or32-uclinux-gdb --gdb}
@command{ddd --debugger=or32-uclinux-gdb --gdb}
@end example
@end example
 
 
@menu
@menu
* Contributors::                Contributors to GDB for the OpenRISC 1000
* Contributors::                Contributors to GDB for the OpenRISC 1000
@end menu
@end menu
 
 
@node Contributors
@node Contributors
@unnumberedsec Contributors to @value{GDBN} for the OpenRISC 1000
@unnumberedsec Contributors to @value{GDBN} for the OpenRISC 1000
 
 
The pantheon of contributors to GDB over the years is recorded in the main
The pantheon of contributors to GDB over the years is recorded in the main
user manual, `Debugging with GDB: The GNU Source-Level Debugger''.
user manual, `Debugging with GDB: The GNU Source-Level Debugger''.
 
 
@cindex contributors, OpenRISC 1000
@cindex contributors, OpenRISC 1000
There is no official history of contributors to the OpenRISC 1000
There is no official history of contributors to the OpenRISC 1000
version. However the current author believes the original GDB 5.0 and 5.3
version. However the current author believes the original GDB 5.0 and 5.3
ports were the work of:
ports were the work of:
 
 
@itemize @bullet
@itemize @bullet
@item
@item
@cindex Ivan Guzvinex
@cindex Ivan Guzvinex
@cindex Guzvinex, Ivan
@cindex Guzvinex, Ivan
@cindex Johan Rydverg
@cindex Johan Rydverg
@cindex Rydverg, Johan
@cindex Rydverg, Johan
@cindex Binary File Description library
@cindex Binary File Description library
@cindex BFD
@cindex BFD
Ivan Guzvinec and Johan Rydverg at OpenCores, who wrote the Binary File
Ivan Guzvinec and Johan Rydverg at OpenCores, who wrote the Binary File
Descriptor library;
Descriptor library;
 
 
@item
@item
@cindex Alessandro Forin
@cindex Alessandro Forin
@cindex Forin, Alessandro
@cindex Forin, Alessandro
@cindex Per Bothner
@cindex Per Bothner
@cindex Bothner, Per
@cindex Bothner, Per
@cindex GDB interface, OpenRISC 1000
@cindex GDB interface, OpenRISC 1000
Alessandro Forin at Carnegie-Mellon University and Per Bothner at the University
Alessandro Forin at Carnegie-Mellon University and Per Bothner at the University
of Wisconsin who wrote the main GDB interface; and
of Wisconsin who wrote the main GDB interface; and
 
 
@item
@item
@cindex Mark Mlinar
@cindex Mark Mlinar
@cindex Mlinar, Mark
@cindex Mlinar, Mark
@cindex Chris Ziomkowski
@cindex Chris Ziomkowski
@cindex Ziomkowski, Chris
@cindex Ziomkowski, Chris
@cindex OpenRISC 1000 JTAG interface
@cindex OpenRISC 1000 JTAG interface
@cindex JTAG, OpenRISC 1000 interface
@cindex JTAG, OpenRISC 1000 interface
Mark Mlinar at Cygnus Support and Chris Ziomkowski at ASICS.ws,who wrote the
Mark Mlinar at Cygnus Support and Chris Ziomkowski at ASICS.ws,who wrote the
OpenRISC JTAG interface.
OpenRISC JTAG interface.
@end itemize
@end itemize
 
 
@cindex Jeremy Bennett
@cindex Jeremy Bennett
@cindex Bennett, Jeremy
@cindex Bennett, Jeremy
@cindex Embecosm
@cindex Embecosm
The port to @value{GDBN} @value{GDBVN} is the work of Jeremy Bennett
The port to @value{GDBN} @value{GDBVN} is the work of Jeremy Bennett
of Embecosm Limited (jeremy.bennett@@embecosm.com).
of Embecosm Limited (jeremy.bennett@@embecosm.com).
 
 
@quotation Plea
@quotation Plea
@cindex contributors, unknown
@cindex contributors, unknown
If you know of anyone who has been omitted from this list, please email the
If you know of anyone who has been omitted from this list, please email the
current author, so the omission can be corrected, and credit given where it is
current author, so the omission can be corrected, and credit given where it is
due.
due.
@end quotation
@end quotation
 
 
@node Connecting to the Target
@node Connecting to the Target
@chapter Connecting to an OpenRISC 1000 Target
@chapter Connecting to an OpenRISC 1000 Target
@cindex OpenRISC 1000 target, connecting
@cindex OpenRISC 1000 target, connecting
@cindex target, OpenRISC 1000, connecting
@cindex target, OpenRISC 1000, connecting
@cindex connecting, OpenRISC 1000 target
@cindex connecting, OpenRISC 1000 target
There are two ways to connect to an OpenRISC 1000 target with GDB.
There are two ways to connect to an OpenRISC 1000 target with GDB.
 
 
@enumerate
@enumerate
@item
@item
@cindex @command{target jtag} command
@cindex @command{target jtag} command
@cindex commands, @command{target jtag}
@cindex commands, @command{target jtag}
@cindex OpenRISC 1000 target, local connecting
@cindex OpenRISC 1000 target, local connecting
@cindex target, local, OpenRISC 1000, connecting
@cindex target, local, OpenRISC 1000, connecting
@cindex connecting, OpenRISC 1000 target, local
@cindex connecting, OpenRISC 1000 target, local
@cindex local OpenRISC 1000 target, connecting
@cindex local OpenRISC 1000 target, connecting
@cindex OpenRISC 1000 target, direct connecting
@cindex OpenRISC 1000 target, direct connecting
@cindex target, direct, OpenRISC 1000, connecting
@cindex target, direct, OpenRISC 1000, connecting
@cindex connecting, OpenRISC 1000 target, direct
@cindex connecting, OpenRISC 1000 target, direct
@cindex direct OpenRISC 1000 target, connecting
@cindex direct OpenRISC 1000 target, connecting
To hardware directly connected via a JP1 header linked to the parallel
To hardware directly connected via a JP1 header linked to the parallel
port. This uses the @value{GDBN} command @command{target jtag}.
port. This uses the @value{GDBN} command @command{target jtag}.
 
 
@item
@item
@cindex @command{target remote} command
@cindex @command{target remote} command
@cindex commands, @command{target remote}
@cindex commands, @command{target remote}
@cindex @command{target extended-remote} command
@cindex @command{target extended-remote} command
@cindex commands, @command{target extended-remote}
@cindex commands, @command{target extended-remote}
@cindex OpenRISC 1000 target, remote connecting via RSP
@cindex OpenRISC 1000 target, remote connecting via RSP
@cindex target, remote, OpenRISC 1000, connecting via RSP
@cindex target, remote, OpenRISC 1000, connecting via RSP
@cindex connecting, OpenRISC 1000 target, remote via RSP
@cindex connecting, OpenRISC 1000 target, remote via RSP
@cindex remote OpenRISC 1000 target, connecting via RSP
@cindex remote OpenRISC 1000 target, connecting via RSP
Via a TCP/IP socket to a machine which has the hardware connected, or
Via a TCP/IP socket to a machine which has the hardware connected, or
is running the architectural simulator using the standard @value{GDBN}
is running the architectural simulator using the standard @value{GDBN}
@dfn{Remote Serial Protocol}. This uses the @value{GDBN} commands
@dfn{Remote Serial Protocol}. This uses the @value{GDBN} commands
@command{target remote} or @command{target extended-remote}.
@command{target remote} or @command{target extended-remote}.
 
 
@item
@item
@cindex @command{target jtag} command
@cindex @command{target jtag} command
@cindex commands, @command{target jtag}
@cindex commands, @command{target jtag}
@cindex OpenRISC 1000 target, remote connecting via JTAG
@cindex OpenRISC 1000 target, remote connecting via JTAG
@cindex target, remote, OpenRISC 1000, connecting via JTAG
@cindex target, remote, OpenRISC 1000, connecting via JTAG
@cindex connecting, OpenRISC 1000 target, remote via JTAG
@cindex connecting, OpenRISC 1000 target, remote via JTAG
@cindex remote OpenRISC 1000 target, connecting via JTAG
@cindex remote OpenRISC 1000 target, connecting via JTAG
Via a TCP/IP socket to a machine which has the hardware connected, or
Via a TCP/IP socket to a machine which has the hardware connected, or
is running the architectural simulator using the custom OpenRISC 1000 Remote
is running the architectural simulator using the custom OpenRISC 1000 Remote
JTAG protocol. This uses the @value{GDBN} command @command{target jtag}.
JTAG protocol. This uses the @value{GDBN} command @command{target jtag}.
 
 
@quotation Note
@quotation Note
This connection mechanism is deprecated. It remains for backward compatibility
This connection mechanism is deprecated. It remains for backward compatibility
only.
only.
@end quotation
@end quotation
 
 
@end enumerate
@end enumerate
 
 
@cindex OpenRISC 1000 Architectural Simulator
@cindex OpenRISC 1000 Architectural Simulator
@cindex OpenRISC 1000 Architectural Simulator, patch
@cindex OpenRISC 1000 Architectural Simulator, patch
@cindex patch, OpenRISC 1000 Architectural Simulator
@cindex patch, OpenRISC 1000 Architectural Simulator
@cindex Or1ksim
@cindex Or1ksim
@cindex Or1ksim, patch
@cindex Or1ksim, patch
@cindex patch, Or1ksim
@cindex patch, Or1ksim
@quotation Caution
@quotation Caution
If used with version 0.2.0 of the architectural simulator, Or1ksim,
If used with version 0.2.0 of the architectural simulator, Or1ksim,
@value{GDBN} version @value{GDBVN} requires a patch to be applied to the
@value{GDBN} version @value{GDBVN} requires a patch to be applied to the
architectural simulator. This should be available on the OpenCores website, or
architectural simulator. This should be available on the OpenCores website, or
contact the author directly. Only the legacy OpenRISC 1000 Remote JTAG
contact the author directly. Only the legacy OpenRISC 1000 Remote JTAG
Protocol interface is available for this version of the architectural
Protocol interface is available for this version of the architectural
simualtor.
simualtor.
 
 
The user is strongly recommended to use Or1ksim 0.3.0 or later, since this
The user is strongly recommended to use Or1ksim 0.3.0 or later, since this
interfaces directly to @value{GDBN} using the @dfn{Remote Serial Protocol}.
interfaces directly to @value{GDBN} using the @dfn{Remote Serial Protocol}.
@end quotation
@end quotation
 
 
@menu
@menu
* Direct JTAG Connection::            Direct connection via a JTAG JP1
* Direct JTAG Connection::            Direct connection via a JTAG JP1
                                      interface
                                      interface
* Remote Serial Protocol Connection:: Connection via the @value{GDBN} Remote
* Remote Serial Protocol Connection:: Connection via the @value{GDBN} Remote
                                      Serial Protocol Interface
                                      Serial Protocol Interface
* Remote JTAG Connection::            Connection via the OpenRISC 1000 Remote
* Remote JTAG Connection::            Connection via the OpenRISC 1000 Remote
                                      JTAG Interface
                                      JTAG Interface
@end menu
@end menu
 
 
@node Direct JTAG Connection
@node Direct JTAG Connection
@section Direct connection via a JTAG JP1 Interface
@section Direct connection via a JTAG JP1 Interface
@cindex OpenRISC 1000 target, local connecting
@cindex OpenRISC 1000 target, local connecting
@cindex target, local, OpenRISC 1000, connecting
@cindex target, local, OpenRISC 1000, connecting
@cindex connecting, OpenRISC 1000 target, local
@cindex connecting, OpenRISC 1000 target, local
@cindex local OpenRISC 1000 target, connecting
@cindex local OpenRISC 1000 target, connecting
@cindex OpenRISC 1000 target, direct connecting
@cindex OpenRISC 1000 target, direct connecting
@cindex target, direct, OpenRISC 1000, connecting
@cindex target, direct, OpenRISC 1000, connecting
@cindex connecting, OpenRISC 1000 target, direct
@cindex connecting, OpenRISC 1000 target, direct
@cindex direct OpenRISC 1000 target, connecting
@cindex direct OpenRISC 1000 target, connecting
 
 
In this case the the device to which the JP1 header is connected must be
In this case the the device to which the JP1 header is connected must be
specifed to the @command{target jtag} command. Typically that will be the
specifed to the @command{target jtag} command. Typically that will be the
parallel printer port, so the command would be:
parallel printer port, so the command would be:
 
 
@cindex local @command{target jtag} command
@cindex local @command{target jtag} command
@cindex direct @command{target jtag} command
@cindex direct @command{target jtag} command
@cindex @command{target jtag} command, local
@cindex @command{target jtag} command, local
@cindex @command{target jtag} command, direct
@cindex @command{target jtag} command, direct
@cindex commands, @command{target jtag}, local
@cindex commands, @command{target jtag}, local
@cindex commands, @command{target jtag}, direct
@cindex commands, @command{target jtag}, direct
@cindex local target specification
@cindex local target specification
@cindex direct target specification
@cindex direct target specification
@cindex target specification, local
@cindex target specification, local
@cindex target specification, direct
@cindex target specification, direct
@example
@example
@command{target jtag /dev/lp}
@command{target jtag /dev/lp}
@end example
@end example
 
 
@cindex @command{target jtag} command, local, testing
@cindex @command{target jtag} command, local, testing
@cindex @command{target jtag} command, direct, testing
@cindex @command{target jtag} command, direct, testing
@cindex commands, @command{target jtag}, local, testing
@cindex commands, @command{target jtag}, local, testing
@cindex commands, @command{target jtag}, direct, testing
@cindex commands, @command{target jtag}, direct, testing
@quotation Caution
@quotation Caution
The current author is not aware of anyone using the JP1
The current author is not aware of anyone using the JP1
interface. As a result this code has not been tested in the port to
interface. As a result this code has not been tested in the port to
@value{GDBN} version @value{GDBVN}. Modern hardware connections are usually via
@value{GDBN} version @value{GDBVN}. Modern hardware connections are usually via
interfaces such as USB, for which the OpenRISC Remote Interface can be used
interfaces such as USB, for which the OpenRISC Remote Interface can be used
(@pxref{Remote JTAG Connection,,Remote JTAG Connection}).
(@pxref{Remote JTAG Connection,,Remote JTAG Connection}).
@end quotation
@end quotation
 
 
@node Remote Serial Protocol Connection
@node Remote Serial Protocol Connection
@section Connection via the @value{GDBN} Remote Serial Protocol
@section Connection via the @value{GDBN} Remote Serial Protocol
@cindex OpenRISC 1000 target, remote connecting via RSP
@cindex OpenRISC 1000 target, remote connecting via RSP
@cindex target, remote, OpenRISC 1000, connecting via RSP
@cindex target, remote, OpenRISC 1000, connecting via RSP
@cindex connecting, OpenRISC 1000 target, remote via RSP
@cindex connecting, OpenRISC 1000 target, remote via RSP
@cindex remote OpenRISC 1000 target, connecting via RSP
@cindex remote OpenRISC 1000 target, connecting via RSP
 
 
The usual mode of operation is through the @value{GDBN} @dfn{Remote Serial
The usual mode of operation is through the @value{GDBN} @dfn{Remote Serial
Protocol} (@acronym{RSP}). This communicates to the target through a TCP/IP
Protocol} (@acronym{RSP}). This communicates to the target through a TCP/IP
socket. The target must then implement the server side of the interface to
socket. The target must then implement the server side of the interface to
drive either physical hardware (for example through a USB/JTAG connector) or a
drive either physical hardware (for example through a USB/JTAG connector) or a
simulation of the hardware (such as the OpenRISC Architectural Simulator).
simulation of the hardware (such as the OpenRISC Architectural Simulator).
 
 
Although referred to as a @emph{remote} interface, the target may actually
Although referred to as a @emph{remote} interface, the target may actually
be on the same machine, just running in a separate process, with its own
be on the same machine, just running in a separate process, with its own
terminal window.
terminal window.
 
 
For example, to connect to the OpenRISC 1000 Architectural simulator, which is
For example, to connect to the OpenRISC 1000 Architectural simulator, which is
running on machine ``thomas'' and has been configured to talk to @value{GDBN}
running on machine ``thomas'' and has been configured to talk to @value{GDBN}
on port 51000, the following command would be used:
on port 51000, the following command would be used:
 
 
@cindex remote @command{target jtag} command
@cindex remote @command{target jtag} command
@cindex @command{target jtag} command, remote
@cindex @command{target jtag} command, remote
@cindex commands, @command{target jtag}, remote
@cindex commands, @command{target jtag}, remote
@cindex remote target specification for RSP
@cindex remote target specification for RSP
@cindex target specification for RSP
@cindex target specification for RSP
@example
@example
@command{target remote thomas:51000}
@command{target remote thomas:51000}
@end example
@end example
 
 
The target machine is specified as the machine name and port number. If the
The target machine is specified as the machine name and port number. If the
architectural simulator was running on the same machine, its name may be
architectural simulator was running on the same machine, its name may be
omitted, thus:
omitted, thus:
 
 
@cindex remote target specification, same machine for RSP
@cindex remote target specification, same machine for RSP
@cindex target specification for RSP, same machine
@cindex target specification for RSP, same machine
@example
@example
@command{target remote :51000}
@command{target remote :51000}
@end example
@end example
 
 
@node Remote JTAG Connection
@node Remote JTAG Connection
@section Connection via the OpenRISC 1000 Remote JTAG Interface
@section Connection via the OpenRISC 1000 Remote JTAG Interface
@cindex OpenRISC 1000 target, remote connecting
@cindex OpenRISC 1000 target, remote connecting
@cindex target, remote, OpenRISC 1000, connecting
@cindex target, remote, OpenRISC 1000, connecting
@cindex connecting, OpenRISC 1000 target, remote
@cindex connecting, OpenRISC 1000 target, remote
@cindex remote OpenRISC 1000 target, connecting
@cindex remote OpenRISC 1000 target, connecting
 
 
Historically, @value{GDBN} communicated with remote OpenRISC 1000 targets
Historically, @value{GDBN} communicated with remote OpenRISC 1000 targets
using a customer protocol, the @dfn{OpenRISC 1000 Remote JTAG
using a customer protocol, the @dfn{OpenRISC 1000 Remote JTAG
Interface}.
Interface}.
 
 
This protocol is maintained for backwards compatibility, but is now
This protocol is maintained for backwards compatibility, but is now
deprecated. It communicates to the target through a TCP/IP socket. The target
deprecated. It communicates to the target through a TCP/IP socket. The target
must then implement the client side of the interface to drive either physical
must then implement the client side of the interface to drive either physical
hardware (for example through a USB/JTAG connector) or a simulation of the
hardware (for example through a USB/JTAG connector) or a simulation of the
hardware (such as the OpenRISC Architectural Simulator).
hardware (such as the OpenRISC Architectural Simulator).
 
 
Although referred to as the @emph{remote} interface, the target may actually
Although referred to as the @emph{remote} interface, the target may actually
be on the same machine, just running in a separate process, with its own
be on the same machine, just running in a separate process, with its own
terminal window.
terminal window.
 
 
For example, to connect to the OpenRISC 1000 Architectural simulator, which is
For example, to connect to the OpenRISC 1000 Architectural simulator, which is
running on machine ``thomas'' and has been configured to talk to @value{GDBN}
running on machine ``thomas'' and has been configured to talk to @value{GDBN}
on port 50000, I could use the command:
on port 50000, I could use the command:
 
 
@cindex remote @command{target jtag} command
@cindex remote @command{target jtag} command
@cindex @command{target jtag} command, remote
@cindex @command{target jtag} command, remote
@cindex commands, @command{target jtag}, remote
@cindex commands, @command{target jtag}, remote
@cindex remote target specification
@cindex remote target specification
@cindex target specification, remote
@cindex target specification, remote
@example
@example
@command{target jtag jtag://thomas:50000}
@command{target jtag jtag://thomas:50000}
@end example
@end example
 
 
The target machine is specified after the @b{jtag://} and separated from the
The target machine is specified after the @b{jtag://} and separated from the
target port by a colon. If the architectural simulator was running on the same
target port by a colon. If the architectural simulator was running on the same
machine, just @b{locahost} would suffice as the machine name, thus:
machine, just @b{locahost} would suffice as the machine name, thus:
 
 
@cindex remote target specification, same machine
@cindex remote target specification, same machine
@cindex target specification, same machine
@cindex target specification, same machine
@example
@example
@command{target jtag jtag://localhost:50000}
@command{target jtag jtag://localhost:50000}
@end example
@end example
 
 
@cindex Igor Mohor
@cindex Igor Mohor
@cindex Mohor, Igor
@cindex Mohor, Igor
@cindex Debug interface types
@cindex Debug interface types
Unfortunately there are now two different flavours of the JTAG
Unfortunately there are now two different flavours of the JTAG
interface used with OpenRISC 1000. The original version was created
interface used with OpenRISC 1000. The original version was created
for use with the OpenRISC 1000 System-on-Chip, @b{ORPSoC}. A new
for use with the OpenRISC 1000 System-on-Chip, @b{ORPSoC}. A new
(smaller and simpler) JTAG interface was developed by Igor Mohor in
(smaller and simpler) JTAG interface was developed by Igor Mohor in
2004, which is used on some designs.
2004, which is used on some designs.
 
 
The default behavior of @value{GDBN} is to use the original ORPSoC
The default behavior of @value{GDBN} is to use the original ORPSoC
version of the interface for backwards compatibility. @value{GDBN} can
version of the interface for backwards compatibility. @value{GDBN} can
use the Igor Mohor version by specifying for example:
use the Igor Mohor version by specifying for example:
 
 
@example
@example
@command{target jtag jtag_mohor://localhost:50000}
@command{target jtag jtag_mohor://localhost:50000}
@end example
@end example
 
 
This interface is only available with remote connections using the legacy
This interface is only available with remote connections using the legacy
OpenRISC 1000 Remote JTAG Protocol (deprecated). The direct JP1 interface can
OpenRISC 1000 Remote JTAG Protocol (deprecated). The direct JP1 interface can
support only the ORPSoC version of JTAG.
support only the ORPSoC version of JTAG.
 
 
The recommended approach is to use the @value{GDBN} @dfn{Remote Serial
The recommended approach is to use the @value{GDBN} @dfn{Remote Serial
Protocol} which interfaces directly to the simulator, and is independent of
Protocol} which interfaces directly to the simulator, and is independent of
the JTAG implementation used.
the JTAG implementation used.
 
 
For completeness
For completeness
 
 
@example
@example
@command{target jtag jtag_orpsoc://localhost:50000}
@command{target jtag jtag_orpsoc://localhost:50000}
@end example
@end example
 
 
is provided as a synonym for:
is provided as a synonym for:
 
 
@example
@example
@command{target jtag jtag://localhost:50000}
@command{target jtag jtag://localhost:50000}
@end example
@end example
 
 
@cindex reset
@cindex reset
@cindex resetting the target
@cindex resetting the target
@cindex target reset
@cindex target reset
By default, establishing a connection @emph{does not} reset the target. This
By default, establishing a connection @emph{does not} reset the target. This
allows debugging to resume a partially complete program on connection. If a
allows debugging to resume a partially complete program on connection. If a
reset is required, the keyworkd @command{RESET} (case insensitive) may be
reset is required, the keyworkd @command{RESET} (case insensitive) may be
added at the end of the @command{target} command. For example:
added at the end of the @command{target} command. For example:
 
 
@example
@example
@command{target jtag jtag://localhost:50000 reset}
@command{target jtag jtag://localhost:50000 reset}
@end example
@end example
 
 
@cindex robustness, OpenRISC remote JTAG interface
@cindex robustness, OpenRISC remote JTAG interface
@cindex JTAG, robustness or remote interface
@cindex JTAG, robustness or remote interface
@cindex Remote Serial Protocol
@cindex Remote Serial Protocol
@cindex RSP
@cindex RSP
@quotation Warning
@quotation Warning
The OpenRISC remote JTAG interface is not particularly robust. In particular
The OpenRISC remote JTAG interface is not particularly robust. In particular
dropping and reconnecting sessions does not seem to work well. This was a key
dropping and reconnecting sessions does not seem to work well. This was a key
factor in its replacement by the generic @value{GDBN} Remote Serial Interface.
factor in its replacement by the generic @value{GDBN} Remote Serial Interface.
@end quotation
@end quotation
 
 
@node OpenRISC 1000 Specific Commands
@node OpenRISC 1000 Specific Commands
@chapter Commands just for the OpenRISC 1000
@chapter Commands just for the OpenRISC 1000
@cindex @command{info spr} command
@cindex @command{info spr} command
@cindex @command{spr} command
@cindex @command{spr} command
@cindex commands, @command{info spr}
@cindex commands, @command{info spr}
@cindex commands, @command{spr} command
@cindex commands, @command{spr} command
@cindex custom commands, OpenRISC 1000
@cindex custom commands, OpenRISC 1000
@cindex OpenRISC 1000, custom commands
@cindex OpenRISC 1000, custom commands
The OpenRISC 1000 has one particular feature that is difficult for
The OpenRISC 1000 has one particular feature that is difficult for
@value{GDBN}. @value{GDBN} models target processors with a register
@value{GDBN}. @value{GDBN} models target processors with a register
bank and a block of memory. The internals of @value{GDBN} assume that
bank and a block of memory. The internals of @value{GDBN} assume that
there are not a huge number of registers in total.
there are not a huge number of registers in total.
 
 
The OpenRISC 1000 Special Purpose Registers (SPR) do not really fit well into
The OpenRISC 1000 Special Purpose Registers (SPR) do not really fit well into
this structure. There are too many of them (12 groups each with 2000+ entries
this structure. There are too many of them (12 groups each with 2000+ entries
so far, with up to 32 groups permitted) to be implemented as ordinary
so far, with up to 32 groups permitted) to be implemented as ordinary
registers in @value{GDBN}. Think what this would mean for the command
registers in @value{GDBN}. Think what this would mean for the command
@command{info registers all}. However they cannot be considered memory, since
@command{info registers all}. However they cannot be considered memory, since
they do not reside in the main memory map.
they do not reside in the main memory map.
 
 
The solution is to add two new commands to @value{GDBN} to see the value of a
The solution is to add two new commands to @value{GDBN} to see the value of a
particular SPR and to set the value of a particular SPR.
particular SPR and to set the value of a particular SPR.
 
 
@enumerate
@enumerate
@item
@item
@command{info spr} is used to show the value of a SPR or group of SPRs.
@command{info spr} is used to show the value of a SPR or group of SPRs.
 
 
@item
@item
@command{spr} is used to set the value of an individual SPR.
@command{spr} is used to set the value of an individual SPR.
@end enumerate
@end enumerate
 
 
@menu
@menu
* Reading SPRs::            Using the ``info spr'' command
* Reading SPRs::            Using the ``info spr'' command
* Writing SPRs::            Using the spr command
* Writing SPRs::            Using the spr command
@end menu
@end menu
 
 
@node Reading SPRs
@node Reading SPRs
@section Using the @command{info spr} Command
@section Using the @command{info spr} Command
@cindex @command{info spr} command
@cindex @command{info spr} command
@cindex commands, @command{info spr}
@cindex commands, @command{info spr}
@cindex @command{info spr} command, argument specification
@cindex @command{info spr} command, argument specification
@cindex @command{info spr} command, single register
@cindex @command{info spr} command, single register
 
 
The value of an SPR is read by specifying either the unique name of the SPR,
The value of an SPR is read by specifying either the unique name of the SPR,
or the its group and index in that group. For example the Debug Reason
or the its group and index in that group. For example the Debug Reason
Register (@code{DRR}, register 21 in group 6 (Debug)) can be read using any of
Register (@code{DRR}, register 21 in group 6 (Debug)) can be read using any of
the following commands:
the following commands:
 
 
@example
@example
@command{info spr DRR}
@command{info spr DRR}
@command{info spr debug DRR}
@command{info spr debug DRR}
@command{info spr debug 21}
@command{info spr debug 21}
@command{info spr 6 DRR}
@command{info spr 6 DRR}
@command{info spr 6 21}
@command{info spr 6 21}
@end example
@end example
 
 
In each case the output will be:
In each case the output will be:
 
 
@example
@example
@code{DEBUG.DRR = SPR6_21 = 0 (0x0)}
@code{DEBUG.DRR = SPR6_21 = 0 (0x0)}
@end example
@end example
 
 
@cindex @command{info spr} command, argument specification
@cindex @command{info spr} command, argument specification
@cindex @command{info spr} command, complete group
@cindex @command{info spr} command, complete group
It is also possible to inspect all the registers in a group. For example to
It is also possible to inspect all the registers in a group. For example to
look at all the Programmable Interrupt Controller registers (group 9), either
look at all the Programmable Interrupt Controller registers (group 9), either
of the following commands could be used:
of the following commands could be used:
 
 
@example
@example
@command{info spr PIC}
@command{info spr PIC}
@command{info spr 9}
@command{info spr 9}
@end example
@end example
 
 
And the output would be:
And the output would be:
 
 
@example
@example
@code{PIC.PICMR = SPR9_0 = 0 (0x9)}
@code{PIC.PICMR = SPR9_0 = 0 (0x9)}
@code{PIC.PICSR = SPR9_2 = 0 (0x8)}
@code{PIC.PICSR = SPR9_2 = 0 (0x8)}
@end example
@end example
 
 
Indicating that interrupts 0 and 4 are enabled and interrupt 4 is pending.
Indicating that interrupts 0 and 4 are enabled and interrupt 4 is pending.
 
 
@node Writing SPRs
@node Writing SPRs
@section Using the @command{spr} Command
@section Using the @command{spr} Command
@cindex @command{spr} command
@cindex @command{spr} command
@cindex commands, @command{spr} command
@cindex commands, @command{spr} command
@cindex @command{spr} command, argument specification
@cindex @command{spr} command, argument specification
 
 
The value of an SPR is written by specifying the unique name of the SPR or its
The value of an SPR is written by specifying the unique name of the SPR or its
group and index in the same manner as for the @command{info spr} command. An
group and index in the same manner as for the @command{info spr} command. An
additional argument specifies the value to be written. So for example the
additional argument specifies the value to be written. So for example the
Programmable Interrupt Controller mask register could be changed to enable
Programmable Interrupt Controller mask register could be changed to enable
interrupts 5 and 3 only by any of the following commands.
interrupts 5 and 3 only by any of the following commands.
 
 
@example
@example
@command{spr PICMR 0x24}
@command{spr PICMR 0x24}
@command{spr PIC PICMR 0x24}
@command{spr PIC PICMR 0x24}
@command{spr PIC 0 0x24}
@command{spr PIC 0 0x24}
@command{spr 9 PICMR 0x24}
@command{spr 9 PICMR 0x24}
@command{spr 9 2 0x24}
@command{spr 9 2 0x24}
@end example
@end example
 
 
@node OpenRISC 1000 Example
@node OpenRISC 1000 Example
@chapter A Small Example
@chapter A Small Example
@cindex examples
@cindex examples
@cindex examples, Hello World
@cindex examples, Hello World
@cindex Hello World example
@cindex Hello World example
 
 
A simple ``Hello World'' program (what else) is used to show the basics
A simple ``Hello World'' program (what else) is used to show the basics
 
 
@cindex examples
@cindex examples
@cindex examples, Hello World
@cindex examples, Hello World
@cindex Hello World example
@cindex Hello World example
This is the cannonical small program. Here is the main program and its two
This is the cannonical small program. Here is the main program and its two
subprograms (added to demonstrate a meaningful backtrace).
subprograms (added to demonstrate a meaningful backtrace).
 
 
@example
@example
void level2() @{
void level2() @{
  simexit( 0 );
  simexit( 0 );
@}
@}
 
 
void level1() @{
void level1() @{
  level2();
  level2();
@}
@}
 
 
main()
main()
@{
@{
  int  i;
  int  i;
  int  j;
  int  j;
 
 
  simputs( "Hello World!\n" );
  simputs( "Hello World!\n" );
  level1();
  level1();
@}
@}
@end example
@end example
 
 
It is linked with a program providing the utility functions @code{simexit},
It is linked with a program providing the utility functions @code{simexit},
@code{simputc} and @code{simprints}.
@code{simputc} and @code{simprints}.
 
 
@example
@example
void  simexit( int  rc )
void  simexit( int  rc )
@{
@{
  __asm__ __volatile__ ( "\tl.nop\t%0" : : "K"( NOP_EXIT ));
  __asm__ __volatile__ ( "\tl.nop\t%0" : : "K"( NOP_EXIT ));
 
 
@}      /* simexit() */
@}      /* simexit() */
 
 
void  simputc( int  c )
void  simputc( int  c )
@{
@{
  __asm__ __volatile__ ( "\tl.nop\t%0" : : "K"( NOP_PUTC ));
  __asm__ __volatile__ ( "\tl.nop\t%0" : : "K"( NOP_PUTC ));
 
 
@}      /* simputc() */
@}      /* simputc() */
 
 
void  simputs( char *str )
void  simputs( char *str )
@{
@{
  int  i;
  int  i;
 
 
  for( i = 0; str[i] != '\0' ; i++ ) @{
  for( i = 0; str[i] != '\0' ; i++ ) @{
    simputc( (int)(str[i]) );
    simputc( (int)(str[i]) );
  @}
  @}
@}      /* simputs() */
@}      /* simputs() */
@end example
@end example
 
 
Finally, a small bootloader is needed, which will be placed at the OpenRISC
Finally, a small bootloader is needed, which will be placed at the OpenRISC
reset vector location (0x100) to set up a stack and jump to the main program.
reset vector location (0x100) to set up a stack and jump to the main program.
 
 
@example
@example
        .org    0x100           # The reset routine goes at 0x100
        .org    0x100           # The reset routine goes at 0x100
        .global _start
        .global _start
_start:
_start:
        l.addi  r1,r0,0x7f00    # Set SP to value 0x7f00
        l.addi  r1,r0,0x7f00    # Set SP to value 0x7f00
        l.addi  r2,r1,0x0       # FP and SP are the same
        l.addi  r2,r1,0x0       # FP and SP are the same
        l.mfspr r3,r0,17        # Get SR value
        l.mfspr r3,r0,17        # Get SR value
        l.ori   r3,r3,0x10      # Set exception enable bit
        l.ori   r3,r3,0x10      # Set exception enable bit
        l.jal   _main           # Jump to main routine
        l.jal   _main           # Jump to main routine
        l.mtspr r0,r3,17        # Enable exceptions (DELAY SLOT)
        l.mtspr r0,r3,17        # Enable exceptions (DELAY SLOT)
 
 
        .org    0xFFC
        .org    0xFFC
        l.nop                   # Guarantee the exception vector space
        l.nop                   # Guarantee the exception vector space
                                # does not have general purpose code
                                # does not have general purpose code
@end example
@end example
 
 
This is compiled and linked with the OpenRISC 1000 @sc{gnu} toolchain. Note
This is compiled and linked with the OpenRISC 1000 @sc{gnu} toolchain. Note
that the linking must specify the bootloader first and use the @code{-Ttext
that the linking must specify the bootloader first and use the @code{-Ttext
0x0} argument.
0x0} argument.
 
 
@cindex OpenRISC 1000 Architectural Simulator, configuration
@cindex OpenRISC 1000 Architectural Simulator, configuration
@cindex configuration, OpenRISC 1000 Architectural Simulator
@cindex configuration, OpenRISC 1000 Architectural Simulator
@cindex Or1ksim, configuration
@cindex Or1ksim, configuration
@cindex configuration, Or1ksim
@cindex configuration, Or1ksim
The Or1ksim architectural simulator is configured with memory starting at
The Or1ksim architectural simulator is configured with memory starting at
location 0x0. The debugging interface is enabled by using a debug section.
location 0x0. The debugging interface is enabled by using a debug section.
 
 
@example
@example
section debug
section debug
  enabled         =          1
  enabled         =          1
  gdb_enabled     =          1
  gdb_enabled     =          1
  server_port     =      50000
  server_port     =      50000
end
end
@end example
@end example
 
 
The architectural simulator is started in its own terminal window. If the
The architectural simulator is started in its own terminal window. If the
configuration is in @code{rsp.cfg}, then the command might be:
configuration is in @code{rsp.cfg}, then the command might be:
 
 
@example
@example
@command{or32-uclinux-sim -f rsp.cfg}
@command{or32-uclinux-sim -f rsp.cfg}
Reading script file from 'rsp.cfg'...
Reading script file from 'rsp.cfg'...
Building automata... done, num uncovered: 0/213.
Building automata... done, num uncovered: 0/213.
Parsing operands data... done.
Parsing operands data... done.
Resetting memory controller.
Resetting memory controller.
Resetting PIC.
Resetting PIC.
@end example
@end example
 
 
Note that no program is specified - that will be loaded from @value{GDBN}.
Note that no program is specified - that will be loaded from @value{GDBN}.
 
 
In a separate window start up @value{GDBN}.
In a separate window start up @value{GDBN}.
 
 
@example
@example
@command{or32-uclinux-gdb}
@command{or32-uclinux-gdb}
@end example
@end example
 
 
A local copy of the symbol table is needed, specified with the @command{file}
A local copy of the symbol table is needed, specified with the @command{file}
command.
command.
 
 
@cindex examples, symbol file loading
@cindex examples, symbol file loading
@cindex symbol file loading
@cindex symbol file loading
@cindex symbols when remote debugging
@cindex symbols when remote debugging
@example
@example
Building automata... done, num uncovered: 0/216.
Building automata... done, num uncovered: 0/216.
Parsing operands data... done.
Parsing operands data... done.
GNU gdb 6.8
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=or32-uclinux".
This GDB was configured as "--host=i686-pc-linux-gnu --target=or32-uclinux".
(gdb) @command{file hello}
(gdb) @command{file hello}
Reading symbols from /home/jeremy/svntrunk/GNU/gdb-6.8/progs_or32/hello...done.
Reading symbols from /home/jeremy/svntrunk/GNU/gdb-6.8/progs_or32/hello...done.
(gdb)
(gdb)
@end example
@end example
 
 
@cindex examples, remote @command{target remote} command
@cindex examples, remote @command{target remote} command
@cindex remote @command{target remote} command, example
@cindex remote @command{target remote} command, example
@cindex @command{target remote} command, remote, example
@cindex @command{target remote} command, remote, example
@cindex commands, @command{target remote}, remote, example
@cindex commands, @command{target remote}, remote, example
@cindex examples, remote target specification via RSP
@cindex examples, remote target specification via RSP
@cindex remote target specification via RSP, example
@cindex remote target specification via RSP, example
@cindex target specification, remote via RSP, example
@cindex target specification, remote via RSP, example
The connection to the target (the architectural simulator) is then
The connection to the target (the architectural simulator) is then
established, using the port number given in the configuration file.
established, using the port number given in the configuration file.
 
 
@example
@example
(gdb) @command{target remote :51000}
(gdb) @command{target remote :51000}
Remote debugging using :51000
Remote debugging using :51000
0x00000100 in _start ()
0x00000100 in _start ()
(gdb)
(gdb)
@end example
@end example
 
 
@cindex examples, program loading
@cindex examples, program loading
@cindex program loading
@cindex program loading
@cindex program loading, example
@cindex program loading, example
@cindex program loading, remote
@cindex program loading, remote
@cindex remote program loading, example
@cindex remote program loading, example
The program of interest can now be loaded:
The program of interest can now be loaded:
 
 
@example
@example
(gdb) @command{load hello}
(gdb) @command{load hello}
Loading section .text, size 0x1290 lma 0x0
Loading section .text, size 0x1290 lma 0x0
Loading section .rodata, size 0xe lma 0x1290
Loading section .rodata, size 0xe lma 0x1290
Start address 0x100, load size 4766
Start address 0x100, load size 4766
Transfer rate: 5 KB/sec, 238 bytes/write.
Transfer rate: 5 KB/sec, 238 bytes/write.
(gdb)
(gdb)
@end example
@end example
 
 
The program does not immediately start running, since on opening the
The program does not immediately start running, since on opening the
connection to the target, Or1ksim stalls.
connection to the target, Or1ksim stalls.
 
 
@cindex examples, @command{bt} command
@cindex examples, @command{bt} command
@cindex @command{bt} command example
@cindex @command{bt} command example
@cindex commands, @command{bt}, example
@cindex commands, @command{bt}, example
@cindex examples, @command{info spr} command
@cindex examples, @command{info spr} command
@cindex @command{info spr} command example
@cindex @command{info spr} command example
@cindex commands, @command{info spr}, example
@cindex commands, @command{info spr}, example
All the GDB commands (including the SPR commands are available). For example
All the GDB commands (including the SPR commands are available). For example
 
 
@example
@example
(gdb) @command{bt}
(gdb) @command{bt}
#0  0x00000100 in _start ()
#0  0x00000100 in _start ()
(gdb) @command{info spr 0 17}
(gdb) @command{info spr 0 17}
SYS.SR = SPR0_17 = 32769 (0x8001)
SYS.SR = SPR0_17 = 32769 (0x8001)
(gdb)
(gdb)
@end example
@end example
 
 
The Supervision Register shows the target is in Supervisor Mode and that SPRs
The Supervision Register shows the target is in Supervisor Mode and that SPRs
have User Mode read access.
have User Mode read access.
 
 
@emph{Note.} The supervision register is used to provide the value for the
@emph{Note.} The supervision register is used to provide the value for the
@value{GDBN} @code{$ps} processor status variable, so can also be accessed as:
@value{GDBN} @code{$ps} processor status variable, so can also be accessed as:
 
 
@example
@example
(gdb) @command{print $ps}
(gdb) @command{print $ps}
$1 = 32769
$1 = 32769
(gdb)
(gdb)
@end example
@end example
 
 
@cindex examples, @command{breakpoint} command
@cindex examples, @command{breakpoint} command
@cindex @command{breakpoint} command example
@cindex @command{breakpoint} command example
@cindex commands, @command{breakpoint}, example
@cindex commands, @command{breakpoint}, example
@cindex examples, @command{continue} command
@cindex examples, @command{continue} command
@cindex @command{continue} command example
@cindex @command{continue} command example
@cindex commands, @command{continue}, example
@cindex commands, @command{continue}, example
@cindex continuening the remote program
@cindex continuening the remote program
@cindex examples, continuing a program
@cindex examples, continuing a program
For this example set a breakpoint at the start of main and then continue the
For this example set a breakpoint at the start of main and then continue the
program
program
 
 
@example
@example
(gdb) @command{break main}
(gdb) @command{break main}
Breakpoint 1 at 0x1264: file hello.c, line 41.
Breakpoint 1 at 0x1264: file hello.c, line 41.
(gdb) @command{continue}
(gdb) @command{continue}
Continuing.
Continuing.
 
 
Breakpoint 1, main () at hello.c:41
Breakpoint 1, main () at hello.c:41
41        simputs( "Hello World!\n" );
41        simputs( "Hello World!\n" );
(gdb)
(gdb)
@end example
@end example
 
 
@cindex examples, @command{step} command
@cindex examples, @command{step} command
@cindex @command{step} command example
@cindex @command{step} command example
@cindex commands, @command{step}, example
@cindex commands, @command{step}, example
It is now possible to step through the code:
It is now possible to step through the code:
@example
@example
(gdb) @command{step}
(gdb) @command{step}
simputs (str=0x1290 "Hello World!\n") at utils.c:90
simputs (str=0x1290 "Hello World!\n") at utils.c:90
90        for( i = 0; str[i] != '\0' ; i++ ) @{
90        for( i = 0; str[i] != '\0' ; i++ ) @{
(gdb) @command{step}
(gdb) @command{step}
91          simputc( (int)(str[i]) );
91          simputc( (int)(str[i]) );
(gdb) @command{step}
(gdb) @command{step}
simputc (c=72) at utils.c:58
simputc (c=72) at utils.c:58
58        __asm__ __volatile__ ( "\tl.nop\t%0" : : "K"( NOP_PUTC ));
58        __asm__ __volatile__ ( "\tl.nop\t%0" : : "K"( NOP_PUTC ));
(gdb)
(gdb)
@end example
@end example
 
 
@cindex examples, @command{bt} command
@cindex examples, @command{bt} command
@cindex @command{bt} command example
@cindex @command{bt} command example
@cindex commands, @command{bt}, example
@cindex commands, @command{bt}, example
At this point a backtrace will show where the code has reached:
At this point a backtrace will show where the code has reached:
 
 
@example
@example
(gdb) @command{bt}
(gdb) @command{bt}
#0  simputc (c=72) at utils.c:58
#0  simputc (c=72) at utils.c:58
#1  0x000011cc in simputs (str=0x1290 "Hello World!\n") at utils.c:91
#1  0x000011cc in simputs (str=0x1290 "Hello World!\n") at utils.c:91
#2  0x00001274 in main () at hello.c:41
#2  0x00001274 in main () at hello.c:41
#3  0x00000118 in _start ()
#3  0x00000118 in _start ()
(gdb)
(gdb)
@end example
@end example
 
 
One more step completes the call to the character output routine. Inspecting
One more step completes the call to the character output routine. Inspecting
the terminal running the Or1ksim simulation, shows the output appearing:
the terminal running the Or1ksim simulation, shows the output appearing:
 
 
@example
@example
JTAG Proxy server started on port 50000
JTAG Proxy server started on port 50000
Resetting PIC.
Resetting PIC.
H
H
@end example
@end example
 
 
@cindex examples, @command{continue} command
@cindex examples, @command{continue} command
@cindex @command{continue} command example
@cindex @command{continue} command example
@cindex commands, @command{continue}, example
@cindex commands, @command{continue}, example
Let the program run to completion by giving @value{GDBN} the continue command:
Let the program run to completion by giving @value{GDBN} the continue command:
@example
@example
(gdb) @command{continue}
(gdb) @command{continue}
Continuing.
Continuing.
Remote connection closed
Remote connection closed
(gdb)
(gdb)
@end example
@end example
 
 
@cindex remote program termination
@cindex remote program termination
With completion of the program, the terminal running Or1ksim shows its final
With completion of the program, the terminal running Or1ksim shows its final
output:
output:
 
 
@example
@example
Resetting PIC.
Resetting PIC.
Hello World!
Hello World!
exit(0)
exit(0)
@@reset : cycles 0, insn #0
@@reset : cycles 0, insn #0
@@exit  : cycles 215892308, insn #215891696
@@exit  : cycles 215892308, insn #215891696
 diff  : cycles 215892308, insn #215891696
 diff  : cycles 215892308, insn #215891696
@end example
@end example
 
 
 
 
@cindex remote program restart
@cindex remote program restart
@cindex restart, remote program
@cindex restart, remote program
@cindex examples, @command{set} command
@cindex examples, @command{set} command
@cindex @command{set} command example
@cindex @command{set} command example
@cindex commands, @command{set}, example
@cindex commands, @command{set}, example
When execution exits (by execution of a @code{l.nop 1}), the connection to the
When execution exits (by execution of a @code{l.nop 1}), the connection to the
target is automatically broken as the simulator exits.
target is automatically broken as the simulator exits.
 
 
@node OpenRISC 1000 Limitations
@node OpenRISC 1000 Limitations
@chapter Known Problems
@chapter Known Problems
@cindex known problems
@cindex known problems
@cindex OpenRISC 1000, known GDB problems
@cindex OpenRISC 1000, known GDB problems
@cindex bugs
@cindex bugs
 
 
There are some known problems with the current implementation
There are some known problems with the current implementation
 
 
@enumerate
@enumerate
@item
@item
@cindex known problems, watchpoints
@cindex known problems, watchpoints
@cindex bugs, watchpoints
@cindex bugs, watchpoints
If the OpenRISC 1000 Architecture supports hardware watchpoints, @value{GDBN}
If the OpenRISC 1000 Architecture supports hardware watchpoints, @value{GDBN}
will use them to implement hardware breakpoints and watchpoints. @value{GDBN}
will use them to implement hardware breakpoints and watchpoints. @value{GDBN}
is not perfect in handling of watchpoints. It is possible to allocate hardware
is not perfect in handling of watchpoints. It is possible to allocate hardware
watchpoints and not discover until running that sufficient watchpoints are not
watchpoints and not discover until running that sufficient watchpoints are not
available. It is also possible that GDB will report watchpoints being hit
available. It is also possible that GDB will report watchpoints being hit
spuriously. This can be down to the assembly code having additional memory
spuriously. This can be down to the assembly code having additional memory
accesses that are not obviously reflected in the source code.
accesses that are not obviously reflected in the source code.
 
 
@item
@item
@cindex known problems, remote JTAG connection robustness
@cindex known problems, remote JTAG connection robustness
@cindex bugs, remote JTAG connection robustness
@cindex bugs, remote JTAG connection robustness
@cindex JTAG, remote connection robustness
@cindex JTAG, remote connection robustness
@cindex remote JTAG, connection robustness
@cindex remote JTAG, connection robustness
The remote JTAG connection is not robust to being interrupted, or
The remote JTAG connection is not robust to being interrupted, or
reconnecting. If the connection is lost due to error, then you must restart
reconnecting. If the connection is lost due to error, then you must restart
GDB and the target server (for example the Or1ksim architectural
GDB and the target server (for example the Or1ksim architectural
simulator). Moving to the Remote Serial Protocol is intended to remedy this
simulator). Moving to the Remote Serial Protocol is intended to remedy this
problem in the future.
problem in the future.
 
 
@item
@item
@cindex known problems, architectural compatability
@cindex known problems, architectural compatability
@cindex bugs, architectural compatibility
@cindex bugs, architectural compatibility
@cindex GDB 5.3, differences in port of @value{GDBN} version @value{GDBVN}
@cindex GDB 5.3, differences in port of @value{GDBN} version @value{GDBVN}
The OpenRISC 1000 architecture has evolved since the port of GDB 5.3
The OpenRISC 1000 architecture has evolved since the port of GDB 5.3
in 2001. In particular the structure of the Unit Present register has
in 2001. In particular the structure of the Unit Present register has
changed and the CPU Configuration register has been added. The port of
changed and the CPU Configuration register has been added. The port of
@value{GDBN} version @value{GDBVN} uses the @emph{current}
@value{GDBN} version @value{GDBVN} uses the @emph{current}
specification of the OpenRISC 1000. This means that old clients that
specification of the OpenRISC 1000. This means that old clients that
talk to the debugger may not work. In particular the Or1ksim
talk to the debugger may not work. In particular the Or1ksim
Architectural simulator requires a patch to work.
Architectural simulator requires a patch to work.
 
 
@item
@item
@cindex known problems, Or1ksim architectural simulator
@cindex known problems, Or1ksim architectural simulator
@cindex bugs, Or1ksim architectural simulator
@cindex bugs, Or1ksim architectural simulator
@cindex Or1ksim, bugs fixed
@cindex Or1ksim, bugs fixed
The handling of watchpoints in the Or1ksim architectural simulator was
The handling of watchpoints in the Or1ksim architectural simulator was
incorrect. To work with @value{GDBN} @value{GDBVN}, a patch is required to fix
incorrect. To work with @value{GDBN} @value{GDBVN}, a patch is required to fix
this problem. This is combined with the patch changing the structure of the
this problem. This is combined with the patch changing the structure of the
Unit Present and CPU Configuration registers.
Unit Present and CPU Configuration registers.
 
 
@item
@item
@cindex known problems, Or1ksim architectural simulator
@cindex known problems, Or1ksim architectural simulator
@cindex bugs, Or1ksim architectural simulator
@cindex bugs, Or1ksim architectural simulator
@cindex Or1ksim, bugs fixed
@cindex Or1ksim, bugs fixed
The OpenRISC 1000 architecture uses its General Purpose
The OpenRISC 1000 architecture uses its General Purpose
Register (GPR) 2 as a frame pointer register. However the @command{$fp}
Register (GPR) 2 as a frame pointer register. However the @command{$fp}
variable in @value{GDBN} is not currently implemented, and will return
variable in @value{GDBN} is not currently implemented, and will return
the value of the stack pointer (GPR 1) instead.
the value of the stack pointer (GPR 1) instead.
@end enumerate
@end enumerate
 
 
@cindex Bugs, reporting
@cindex Bugs, reporting
@cindex Reporting bugs
@cindex Reporting bugs
Reports of bugs are much welcomed. Please report problems through the
Reports of bugs are much welcomed. Please report problems through the
OpenCORES tracker at @uref{www.opencores.org/ptracker.cgi/list/or1k}.
OpenCORES tracker at @uref{www.opencores.org/ptracker.cgi/list/or1k}.
@include gpl.texi
@include gpl.texi
 
 
@raisesections
@raisesections
@include fdl.texi
@include fdl.texi
@lowersections
@lowersections
 
 
@node Index
@node Index
@unnumbered Index
@unnumbered Index
 
 
@printindex cp
@printindex cp
 
 
@tex
@tex
% I think something like @colophon should be in texinfo.  In the
% I think something like @colophon should be in texinfo.  In the
% meantime:
% meantime:
\long\def\colophon{\hbox to0pt{}\vfill
\long\def\colophon{\hbox to0pt{}\vfill
\centerline{The body of this manual is set in}
\centerline{The body of this manual is set in}
\centerline{\fontname\tenrm,}
\centerline{\fontname\tenrm,}
\centerline{with headings in {\bf\fontname\tenbf}}
\centerline{with headings in {\bf\fontname\tenbf}}
\centerline{and examples in {\tt\fontname\tentt}.}
\centerline{and examples in {\tt\fontname\tentt}.}
\centerline{{\it\fontname\tenit\/},}
\centerline{{\it\fontname\tenit\/},}
\centerline{{\bf\fontname\tenbf}, and}
\centerline{{\bf\fontname\tenbf}, and}
\centerline{{\sl\fontname\tensl\/}}
\centerline{{\sl\fontname\tensl\/}}
\centerline{are used for emphasis.}\vfill}
\centerline{are used for emphasis.}\vfill}
\page\colophon
\page\colophon
% Blame: doc@cygnus.com, 1991.
% Blame: doc@cygnus.com, 1991.
@end tex
@end tex
 
 
@bye
@bye
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.