Services - tools - models - for embedded software development
Embecosm divider strip
Prev  Next

4.3.1.  Creating struct target_ops for OpenRISC 1000

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.

[Note]Note

GDB has its own global variable, current_target, which refers to the current set of target operations. However this is not sufficient, since even though a target may be connected via the OpenRISC remote interface, it may not be the current target. The use of strata by GDB means there could possibly be another target which is active at the same time.

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).

Embecosm divider strip