Altera Nios II User Manual page 76

Hide thumbs Also See for Nios II:
Table of Contents

Advertisement

3–36
Break Exceptions
A break is a transfer of control away from a program's normal flow of execution for
the purpose of debugging. Software debugging tools can take control of the Nios II
processor via the JTAG debug module.
Break processing is the means by which software debugging tools implement debug
and diagnostic features, such as breakpoints and watchpoints. Break processing is a
type of exception processing, but the break mechanism is independent from general
exception processing. A break can occur during exception processing, enabling debug
tools to debug exception handlers.
The processor enters the break processing state under either of the following
conditions:
The processor executes the break instruction. This is often referred to as a software
break.
The JTAG debug module asserts a hardware break.
Processing a Break
A break causes the processor to take the following steps:
1. Stores the contents of the status register to bstatus.
2. Clears status.PIE to zero, disabling maskable interrupts.
1
3. Writes the address of the instruction following the break to the ba register (r30) in
the normal register set.
4. Clears status.U to zero, forcing the processor into supervisor mode, when the
system contains an MMU or MPU.
5. Sets status.EH to one, indicating the processor is handling an exception, when the
system contains an MMU.
6. Copies status.CRS to status.PRS and then sets status.CRS to 0.
7. Transfers execution to the break handler, stored at the break vector specified in the
Nios II Processor parameter editor.
1
All noninterrupt exception handlers, including the break handler, must run in the
normal register set.
Understanding Register Usage
The bstatus control register and general-purpose registers bt (r25) and ba (r30) in the
normal register set are reserved for debugging. Code is not prevented from writing to
these registers, but debug code might overwrite the values. The break handler can use
bt (r25) to help save additional registers.
Nios II Processor Reference Handbook
Nonmaskable interrupts (NMIs) are not affected by status.PIE, and can be
taken while processing a break exception.
Chapter 3: Programming Model
Exception Processing
February 2014 Altera Corporation

Advertisement

Table of Contents
loading

Table of Contents