IRQ_CONNECT: enum based line number?

Erwan Gouriou

Hi all,

I've a question around IRQ_CONNECT macro for Cortex_m defined in

In ST CMSIS, we define IRQ line as enum. For instance:
typedef enum
/****** Cortex-M3 Processor Exceptions Numbers
USART1_IRQn = 37, /*!< USART1 global Interrupt
USART2_IRQn = 38, /*!< USART2 global Interrupt
USART3_IRQn = 39, /*!< USART3 global Interrupt
} IRQn_Type;

Issue is that we cannot use directly these values in IRQ_CONNECT macro
since it
expects constant IRQ line number.

Note: It compiles without any warning though, since compilation trap does
not catch enums:
enum { IRQ = irq_p }; \ --> irq_p could be an enum

Actual issue is in following directive:
__attribute__ ((section(STRINGIFY(_CONCAT(.gnu.linkonce.isr_irq, irq_p)))))
If irq_p is not a number, compiler will not be able to understand it has to
section _isr_irq38.

I've tried numerous ways to cast my enum value into an acceptable const
value for the macro,
but it remained unsuccessful.

Is there any way to cast ny enum into an acceptable const for this macro?
If not, would it be possible to get the macro accepting enum values without
breaking its


Join to automatically receive all group messages.