The remote target is created by defining the function
_initialize_remote_or1k
. A new struct target_ops,
or1k_jtag_target
is populated and added as a
target by calling add_target
.
The majority of the target operations are generic to OpenRISC 1000, and independent of the actual low level interface. This is achieved by abstracting the low level interface through the interface functions described in Section 4.3.
Having established all the target functions, the target is added by
calling add_target
When a target is selected (with the GDB
target jtag command), the set of target
operations chosen for use with the OpenRISC 1000 architecture will
be referred to by the global variable,
or1k_target
, defined in
or1k-tdep.c
.
Much of the operation of the target interface involves manipulating
the debug SPRs. Rather than continually writing them out to the
target, a cache of their values is maintained in
or1k_dbgcache
, which is flushed prior to any
operation that will unstall the target (thus causing it to execute).