I'm coding for a ARM with GCC and need to concatenate (##
) a name with the a definition, like this:
#define LCD_E_PORT GPIOC
...
#define RCC_PORT(x) (RCC_APB2Periph_ ## (x)) // ???
...
so that afterRCC_PORT(LCD_E_PORT)
I would get RCC_APB2Periph_GPIOC
. It is important to say, that the LCD_E_PORT
and the RCC_APB2Periph_GPIOC
are NOT strings but some low-level system defined pointers (accessing them processor's memory map).
The point of all this is to have one macro, which handles multiple port definitions.
Is there a solution for this?
I'm using arm-none-eabi-gcc.