
534
Evaluating and Programming the 29K RISC Family
dbg_iret
When a 29K processor issues an IRET instruction the Old Processor Status
(OPS) register is copied to the Current Processor Status (CPS) register. Controlling
of single stepping is achieved with the Trace Enable (TE) and Trace Pending (TP)
bits in the CPS register. These two bits are maintained by the DebugCore and not the
operating system. When the OS initially wishes to issue an IRET it must make a jump
to address
dbg_iret
instead. The Debugcore will then update the trace control bits
and issue an IRET on behalf of the OS. Note, it is only the initial IRET from the oper-
ating system to application code which need to be replaced by a jump to
dbg_iret
.
dbg_coredump
The DebugCore supports coredumping on processor reset as an option. When a
reset occurs execution continues from address 0. A jump to
dbg_coredump
can be
placed at this location. When the DebugCore is entered in this way the context of the
processor is saved and variable
dbg_trap_num
is set to V_RESET (255) and execu-
tion is continued at label
os_cold_start
.
Execution of OS cold–start code causes
dbg_control()
to be called; but, due to
selecting the V_RESET option, the context is not saved again when reentering the
DebugCore. A HALT message will be sent to MonTIP and the user can examine the
saved coredump state. Normal operation is restarted by sending a RESET message to
the DebugCore. This causes the
dbg_trap_num
variable to be set to zero, and execu-
tion to start at address
os_cold_start
.
_dbg_shadow_os
When the DebugCore gains control of the processor it copies the register values
to shadow memory locations. All access to registers is then normally performed to
corresponding memory locations. When 32–bit memory location
dbg_shadow_os
is
set to zero, global registers
gr64–gr95
are not shadowed but accessed directly. This
enables interrupt handlers, which run in the context of the DebugCore, to make
changes to OS–space registers which will not be over–written when the DebugCore
restores context.
The DebugCore initializes
dbg_shadow_os
to –1 and the alternative option is
very little used. However, setting it to zero would be best accomplished in function
cfg_core_enter()
.
_dbg_shadow_timer
The DebugCore will not shadow the timer control registers TMR and TMC if
this 32–bit variable is set to zero. It is initialized to –1 by the DebugCore and typicaly
never modified. The timer is normally disabled by code in the
cfg_core_enter()
function. If the timer were enabled it would be necessary to clear
dbg_shadow_tim-
er
to prevent the timer control registers being wrongly updated when the DebugCore
restores context.