The C29x CPU supports stop mode debug execution
control mode. Stop mode provides complete control of program execution, allowing for
the disabling of all interrupts. In this execution mode program execution is
suspended at break events, such as occurrence of software breakpoint instructions or
specified program-space or data-space accesses.
Stop mode causes break events, such as breakpoints
and watchpoints, to suspend program execution at the next interrupt boundary (which
is usually identical to the next instruction boundary). When execution is suspended,
all interrupts (including NMI and RS) are ignored until the CPU receives a directive
to run code again.
In stop mode, the CPU can operate in the following execution
states:
- Debug-halt state: In the stop mode debug-halt state, the CPU is halted. This state is
entered when the CPU is running with debug enabled and encounters a break event
such as a breakpoint or watchpoint, hardware trigger or user initiated halt request.
- User Halt: User issues a Debug-halt request from the debugger.
- Hardware Breakpoint : ERAD can be setup to generate hardware breakpoints
on a specified Program Address. This causes the CPU to go to a halted
condition, if the instruction packet at the designated address is about
to enter the Decode2 phase of the CPU pipeline.
- Software breakpoint : This is setup by the debugger by putting the
EMUSTOP0 instruction at a desired program address. This causes the CPU
to go to a halted condition, if the EMUSTOP0 is about to enter the
Decode2 phase of the CPU pipeline.
- Watchpoint : ERAD can be configured to generate a watchpoint when the
CPU makes a designated data memory access or some other system condition
or a combination of these. Once this defined event occurs, ERAD
generates a Watchpoint request to the Debug controller that can cause
the CPU to halt.
- External Triggers: Triggers at the device level coming from various
sources outside the CPU can be configured to make a HALT request to the
CPU and can also cause the CPU to HALT. This is typically used when
halting of one CPU requires triggering the halt of another CPU when
multiple CPUs are being controlled by the Debugger.
In the debug-halt state,
since the CPU is halted, the CPU cannot service any interrupts, including
NMI and RS (reset). When multiple instances of the same interrupt occur
without the first instance being serviced when the CPU is in halted debug
state, the later instances are lost.
- Single-Step state: This state is entered when the user indicates to the
debugger to execute a single instruction packet. The CPU executes the single
instruction packet pointed to by the PC and then returns to the debug-halt state
(the CPU executes from one interrupt boundary to the next). The CPU is only in
the single-instruction state until that single instruction is done. If an
interrupt occurs in this state, the command used to enter this state determines
whether that interrupt can be serviced. If DINT is set, the CPU can service the
interrupt;.if DINT is not set, the CPU can not service interrupts even if the
interrupt is NMI or RS.
- Run state: This state is entered from a halted condition when user issues
a run command from the debugger interface while stop debug mode is enabled. The
CPU executes instructions until a debugger command or a debug event returns the
CPU to the debug-halt state. The CPU can service all interrupts in this state.
When an interrupt occurs simultaneously with a debug event, the debug event has
priority; however, if interrupt processing began before the debug event
occurred, the debug event cannot be processed until the interrupt service
routine begins.
- Free-run: This state is entered from a halted condition when user issues
a run command from the debugger interface after disabling stop mode debug mode.
The CPU resumes execution and ignores further debug events like breakpoints,
watchpoints and triggers and continues execution as if the debugger is no longer
connected.
- Synchronous Run: This is merely an extension of the basic run state.
Based on the configuration, the debug controller can be configured to receive a
run request such that the CPU starts the actual run only on a certain global
synchronization signal going active. This method is used when starting execution
simultaneously on multiple CPUs being controlled by the debugger.