Exception Classifications in PIC32 MCUs
Bootstrap Exception
A bootstrap exception is an exception that occurs while bootstrap code is running (StatusBEV=1). All bootstrap exceptions are vectored to 0xBFC00380. At this location, the MPLAB® XC32 compiler places a branch instruction targeting the function named _bootstrap_exception_handler().
General Exception
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 exception handler will first cause a software breakpoint and then cause a software reset (when available on the target device).