Specifications

Exception Cause
Code
Cause Symbol
(8)
Supervisor-only Instruction
Address
9 NIOS2_EXCEPTION_SUPERVISOR_ONLY_INST_ADDR
Supervisor-only Instruction 10 NIOS2_EXCEPTION_SUPERVISOR_ONLY_INST
Supervisor-only Data
Address
11 NIOS2_EXCEPTION_SUPERVISOR_ONLY_DATA_ADDR
Translation lookaside buffer
(TLB) Miss
12 NIOS2_EXCEPTION_TLB_MISS
TLB Permission Violation
(execute)
13 NIOS2_EXCEPTION_TLB_EXECUTE_PERM_VIOLATION
TLB Permission Violation
(read)
14 NIOS2_EXCEPTION_TLB_READ_PERM_VIOLATION
TLB Permission Violation
(write)
15 NIOS2_EXCEPTION_TLB_WRITE_PERM_VIOLATION
MPU Region Violation
(instruction)
16 NIOS2_EXCEPTION_MPU_INST_REGION_VIOLATION
MPU Region Violation
(data)
17 NIOS2_EXCEPTION_MPU_DATA_REGION_VIOLATION
Cause unknown
(9)
-1 NIOS2_EXCEPTION_CAUSE_NOT_PRESENT
If there is an instruction-related exception handler, it is called at the end of the software exception funnel
(if the funnel has not recognized a hardware interrupt, unimplemented instruction or trap). It takes the
place of the break or infinite loop. Therefore, to support debugging, execute a break on a trap instruction.
Note:
It is possible for an instruction-related exception to occur during execution of an ISR.
Registering an Instruction-Related Exception Handler
The HAL API function alt_instruction_exception_register() registers a single instruction-related
exception handler.
The function prototype is as follows:
alt_instruction_exception_register (
alt_exception_result (*handler)
( alt_exception_cause, alt_u32, alt_u32 ));
The handler argument is a pointer to the instruction-related exception handler.
To use alt_instruction_exception_register(), include the following header file:
#include "sys/alt_exceptions.h"
Note:
The hal.enable_instruction_related_exceptions_api setting must be enabled in the BSP in
order for you to register an instruction-related exception handler.
(8)
Cause symbols are defined in sys/alt_exceptions.h.
(9)
This value is passed to the instruction-related exception handler if the cause argument if the cause is not
known; for example, if the cause register not implemented in the Nios II processor core.
8-34
Registering an Instruction-Related Exception Handler
NII5V2
2015.05.14
Altera Corporation
Exception Handling
Send Feedback