When writting program for MCU, peripherals such as GPIOs, Timer channels may conflict. Is it possible to write macros in the following form to judge them when compiling or linking?

USED(GPIOA_15)
USED(TIMER1_CH3)
USED(GPIOA_15) // Error or warning should occur here

If the judgement happens at complation, it can only find conflicts in a same.c file. So it would be better if the macro works at link-time so that resource conflict of multiple source files could be inspected.

0 Answers