10.7 PIC32MX Interrupt Vector Tables
The vector address of a given interrupt is calculated using Exception Base
(EBASE <31:12>) register, which provides a 4 KB page-aligned base address value located
in the kernel segment (kseg
) address space. EBASE is a CPU register. The
address is calculated by using EBASE and VS (INTCTL <9:5>) values. The VS bits provide
the vector spacing between adjacent vector addresses.
The linker script creates the corresponding Interrupt Vector Table as follows:
PROVIDE(_vector_spacing = 0x00000001);
_ebase_address = 0x9FC01000;
SECTIONS
{
.app_excpt _GEN_EXCPT_ADDR :
{
KEEP(*(.gen_handler))
} > exception_mem
.vector_0 _ebase_address + 0x200 :
{
KEEP(*(.vector_0))
} > exception_mem
ASSERT (_vector_spacing == 0 || SIZEOF(.vector_0) <=
(_vector_spacing << 5),
"function at exception vector 0 too large")
.vector_1 _ebase_address + 0x200 +
(_vector_spacing << 5) * 1 :
{
KEEP(*(.vector_1))
} > exception_mem
ASSERT (_vector_spacing == 0 || SIZEOF(.vector_1) <=
(_vector_spacing << 5),
"function at exception vector 1 too large")
.vector_2 _ebase_address + 0x200 +
(_vector_spacing << 5) * 2 :
{
KEEP(*(.vector_2))
} > exception_mem
/* … */
.vector_63 _ebase_address + 0x200 +
(_vector_spacing << 5) * 63 :
{
KEEP(*(.vector_63))
} > exception_mem
ASSERT (_vector_spacing == 0 || SIZEOF(.vector_63) <=
(_vector_spacing << 5),
"function at exception vector 63 too large")
}
Each vector in the table is created as an output section located at an absolute address based on values of the _ebase_address
and _vector_spacing
symbols. There is one output section for each of the 64 vectors in the table.