In PIC32 MCUs, exceptions can be classified as:
A Bootstrap exception is an exception which occurs while bootstrap code is running (StatusBEV=1). All Bootstrap exceptions are vectored to 0xBFC00380. At this location, the XC32 Compiler places a branch instruction targeting the function named ‘_bootstrap_exception_handler()’.
A general exception is any non-interrupt exception that occurs during program execution outside of bootstrap code (StatusBEV=0). General exceptions are vectored to offset 0x180 from EBase. At this location, the XC32 Compiler places a branch instruction targeting the function named ‘_general_exception_context()’. The provided implementation of this function saves context, calls an application handler function, restores context and performs a return from the exception instruction.
If the user application provides an implementation of ‘_general_exception_context()’, that implementation will be used instead. Prototype of the general exception handler:
Simple Translation Look-aside Buffer (TLB) Refill Exception
During an instruction fetch or data access, a TLB refill exception occurs when no TLB entry matches a reference to a mapped address space and the EXL bit in the Status register is 0. Note that this is distinct from the case in which an entry matches, but has the valid bit off. In that case, a TLB Invalid exception occurs. Prototype of the TLB refill exception handler:
Cache Error Exception
A cache-error exception occurs when an instruction or data reference detects a cache tag or data error. This exception is non maskable. To avoid disturbing the error in the cache array, the exception vector is assigned to an unmapped, uncached address.
For every exception, a weak default implementation exception handler is provided, which causes a Software Reset.
When compiling for in-circuit debugging or emulation, the default implementation of exception handler will first cause a software breakpoint and then cause a software reset (When available on target device).
Example for handling a general exception:
Microchip Technology acquires Atmel