AFAIK - The attachInterrupt code: (Interrupt.cpp)
Uses the function: int ch = pin2IrqChannel(pinNumber);
Which uses the g_pin_cfg[] array which has the mapping of Arduino pin numbers
to BSP pin/port plus pointer to data about each pin...
extern "C" const PinMuxCfg_t g_pin_cfg[] = {
{ BSP_IO_PORT_03_PIN_01, P301 }, /* (0) D0 ------------------------- DIGITAL */
{ BSP_IO_PORT_03_PIN_02, P302 }, /* (1) D1 */
{ BSP_IO_PORT_01_PIN_05, P105 }, /* (2) D2 */
{ BSP_IO_PORT_01_PIN_04, P104 }, /* (3) D3~ */
{ BSP_IO_PORT_01_PIN_03, P103 }, /* (4) D4 */
{ BSP_IO_PORT_01_PIN_02, P102 }, /* (5) D5~ */
{ BSP_IO_PORT_01_PIN_06, P106 }, /* (6) D6~ */
{ BSP_IO_PORT_01_PIN_07, P107 }, /* (7) D7 */
{ BSP_IO_PORT_03_PIN_04, P304 }, /* (8) D8 */
{ BSP_IO_PORT_03_PIN_03, P303 }, /* (9) D9~ */
,,,
The \variants\MINIMA\pinmux.inc: file
So for pin2 it use P105, which has:
const uint16_t P105[] = {
PIN_PWM|CHANNEL_1|PWM_CHANNEL_A|GPT_ODD_CFG,
PIN_INTERRUPT|CHANNEL_0|LAST_ITEM_GUARD
};
Which maps the pin to Interrupt Channel 0...
Likewise if you look at D8, it has P304
const uint16_t P304[] = {
PIN_PWM|CHANNEL_7|PWM_CHANNEL_A|GPT_ODD_CFG,
PIN_INTERRUPT|CHANNEL_9|LAST_ITEM_GUARD
};
So it maps to Int 9...