Interrupt Naming Conventions

I'm trying to get to the bottom of how CMSIS specifies interrupt names (if it does).

For example, on the ARM GitHub, the first several exceptions are clearly defined as NMI_Handler, HardFault_Handler, MemManage_Handler, .... SysTick_Handler

Here's a link to the Cortex-M4 startup code that contains the interrupt prototypes for the first "15" interrupt exceptions.

https://github.com/ARM-software/CMSIS_5/blob/develop/Device/ARM/ARMCM4/Source/startup_ARMCM4.c

Looking at this file some more, it lists the following generic function prototype names:

Interrupt0_Handler(void);
Interrupt1_Handler(void);

However, looking into online/youtube courses such as bare metal embedded lecture-3 (by fastbit, uses an STM32 Microcontroller) or Modern Embedded Systems Programming Course by Miro (lesson 15), it is clear that interrupt names are very closely related to the name in the datasheet (but not always identical).

I have a Tiva TM4C123GH6PM microcontroller (same as the one from Modern Embedded Systems Programming), so i'll use it as a reference.

Vector Number 16 is the GPIO Port A interrupt. Looks like Miro has it labeled as GPIOPortA_IRQHandler. This one makes sense.

Vector Number 64 is the ADC1 Sequence 0 interrupt. Looks like Miro has it labeled as ADCSeq0_IRQHandler. The "Sequence" word got shortened in the interrupt name.

Honestly, most of the interrupt names make sense to me. For example, UART3 will be UART3_Handler. But when the description says "16/32-Bit Timer 4A", i want to know that I'm writing the correct interrupt handler name...

Anyways, my question is pretty simple. Does ARM/CMSIS provide specific rules for naming the peripheral interrupts or does everyone just name it however they want?

If anyone can point me to the documentation, I'd appreciate it. I'm trying to figure out where the proper interrupt naming conventions are located so i can write my own code knowing it uses the proper interrupt names (without looking at other peoples code).

(I also noticed that Miro's TM4C123GH6PM.h file was identical to the one i downloaded from ARM for the microcontroller other than that he edited it to include all the interrupt prototypes)

  • Does ARM/CMSIS provide specific rules for naming the peripheral interrupts or does everyone just name it however they want?

    I'm pretty sure they name it whatever they want.  After all, the peripherals themselves are vendor-specific and have vendor-chosen names (Timers seem to be particularly subject to ... creativity, with each chip usually having several different types of timers.)  For instance, the Microchip SAMD51 has four interrupts per USART, with wonderful names like SERCOM0_0_Handler, SERCOM0_1_Handler, etc. (because the USART is actually a function of a "Serial Comm" peripheral that could also do SPI or I2C...)  There is just too large a range of possibilities to have standardized naming.

    Hopefully, the chip vendor will provide their customized version of the startup file, and you can look at that (in combination with the datasheet) to figure out what all the names actually are.  (using the wrong name results in silently wrong behavior, though.  Nothing stops the SAMD user from creating a UART3_handler() function, and it's perfectly legal C code, but that's not where the sercom interrupt will go!

    (the CM4 CORE handlers should have the standard names, though.  Except for occasional naught vendors like Raspberry Pi rp2040.  "isr_nmi" indeed!)