MicroBlaze Processor Reference Guide
157
UG081 (v14.7)
Interrupt and Exception Handling
In the current MicroBlaze system, there are dummy routines for interrupt and user exception
handling, which you can change. In order to override these routines and link your own interrupt and
exception handlers, you must define the handler code with specific attributes.
The interrupt handler code must be defined with attribute
interrupt_handler
to ensure that
the compiler will generate code to save and restore used registers and emit an
rtid
instruction to
return from the handler:
void
function_name
() __attribute__((interrupt_handler));
The user exception handler code must either be defined with either attribute
svc_handler
or
attribute
svc_table_handler
:
void
function_name
() __attribute__((svc_handler));
void
function_name
() __attribute__((svc_table_handler (ID)));
The first attribute ensures that the compiler will emit an indirect call to the handler with a
brki
rD,0x8
instruction, and emit an
rtbd
instruction to return from the handler. This means that when
the MMU is enabled the handler function is executed in privileged mode.
The second attribute is declared with a Service ID. In this case the compiler will emit code to store
this ID in register R18 followed by an indirect call to
_exception_handler
using a
brki
rD,0x8
instruction, and emit an
rtbd
instruction to return from the handler. It is necessary to
override the
_exception_handler
function to call the appropriate handler based on the ID
provided in R18.
For more details about the use and syntax of the handler attributes, please refer to the
GNU Compiler
Tools
chapter in the
Embedded System Tools Reference Manual
.
When software breakpoints are used in the Xilinx Microprocessor Debug (XMD) tool or the
Software Development Kit (SDK) tool, the Break (HW/SW) address location is reserved for
handling the software breakpoint.
Содержание MicroBlaze
Страница 1: ...MicroBlaze Processor Reference Guide Embedded Development Kit EDK 14 7 UG081 v14 7...
Страница 4: ...MicroBlaze Processor Reference Guide www xilinx com UG081 v14 7...
Страница 8: ...8 www xilinx com MicroBlaze Processor Reference Guide UG081 v14 7 Chapter 1 Introduction Send Feedback...
Страница 262: ...262 www xilinx com MicroBlaze Processor Reference Guide UG081 v14 7 Send Feedback...