5.9.2 Changing the Default Interrupt Function Allocation

Moving the code associated with an interrupt service routine (ISR) is more difficult than that for ordinary functions, as ISRs have entry points strictly defined by the device.

For some builds, the code generated for an ISR is placed in one section that is linked directly to the interrupt vector location. For such builds, any __section() specifier (see 5.15.3 Changing and Linking the Allocated Section) used with an ISR will be ignored; however as the interrupt code is contained in a section with a unique name, there is no advantage to using the specifier in this situation.

If an ISR is split into two sections, one to contain code located at the ISR entry point and another to hold the body of the interrupt function, then the __section() specifier can be used to relocate the interrupt function body to a new section, but leave the interrupt entry point code in the default section. This way, the interrupt function body can be linked explicitly without affecting the interrupt entry point code.

To move the vector location, see 5.9.3 Specifying the Interrupt Vector.