![NXP Semiconductors SAFE ASSURE Qorivva MPC5601P Reference Manual Download Page 925](http://html.mh-extra.com/html/nxp-semiconductors/safe-assure-qorivva-mpc5601p/safe-assure-qorivva-mpc5601p_reference-manual_1721898925.webp)
Chapter 36 Nexus Development Interface (NDI)
MPC5602P Microcontroller Reference Manual, Rev. 4
Freescale Semiconductor
925
1: If IRStat8 = ‘0’, A BookE Misaligned Instruction Fetch Exception has occurred while filling the
IR.
If IRStat8 = ‘1’, IR contains an instruction with a byte-ordering error due to mismatched VLE page
attributes, or due to E indicating little-endian for a VLE page.
Emulation firmware should modify the content of the CTL, PC, and IR values in the CPUSCR during
execution of debug related instructions as well as just prior to exiting debug with a go+exit command.
During the debug session, the CTL register should be written with the FFRA bit set as appropriate, and all
other bits set to ‘0’, and the IR set to the value of the desired instruction to be executed. IRStat8 will be
used to determine the type of instruction present in the IR.
Just prior to exiting debug mode with a go+exit, the PCINV status bit which was originally present when
debug mode was first entered should be tested, and if set, the PC and IR initialized for performing whatever
recovery sequence is appropriate for a faulted exception vector fetch. If the PCINV bit is cleared, then the
PCOFST bits should be examined to determine whether the PC value must be adjusted. Due to the
pipelined nature of the CPU, the PC value must be backed-up by emulation software in certain
circumstances. The PCOFST field specifies the value to be subtracted from the original value of the PC.
This adjusted PC value should be restored in to the PC portion of the CPUSCR just prior to exiting debug
mode with a go+exit. In the event the PCOFST is non-zero, the IR should be loaded with a nop instruction
(such as
ori r0,r0,0
) instead of the original IR value, otherwise the original value of IR should be restored.
Note that when a correction is made to the PC value, it will generally point to the last completed
instruction, although that instruction will not be re-executed. The nop instruction is executed instead, and
instruction fetch and execution will resume at location PC+4. IRStat8 will be used to determine the type
of instruction present in the IR, thus should be cleared in this case. Note that debug events which may occur
on the nop (ICMP) will be generated (and optionally counted) if enabled.
For the CTL register, the internal state bits should be restored to their original value. The IRStatus bits
should be set to ‘0’s if the PC was adjusted. If no PC adjustment was performed, emulation firmware
should determine whether IRStat2-5 should be set to ‘0’ to avoid re-entry into debug mode for an
instruction breakpoint request. Upon exiting debug mode with go+exit, if one of these bits is set, debug
mode will be re-entered prior to any further instruction execution.
36.12.8.3 Program Counter Register (PC)
The PC is a 32-bit register that stores the value of the program counter which was present when the chip
entered the debug mode. It is affected by the operations performed during the debug mode and must be
restored by the external command controller when the CPU returns to normal mode. PC normally points
to the instruction contained in the IR portion of CPUSCR. If debug firmware wishes to redirect program
flow to an arbitrary location, the PC and IR should be initialized to correspond to the first instruction to be
executed upon resumption of normal processing. Alternatively, the IR may be set to a nop and the PC set
to point to the location prior to the location at which it is desired to redirect flow to. On exiting debug
mode, the nop will be executed, and instruction fetch and execution will resume at PC+4.
36.12.8.4 Write-Back Bus Register (WBBR
low
, WBBR
high
)
WBBR is used as a means of passing operand information between the CPU and the external command
controller. Whenever the external command controller needs to read the contents of a register or memory