why the expected declaration error appears in define line?

This fragment of the compiler output reveals the nature of the problem (or at least one problem):

C:/Users/Wojtek/workspace/RA_B-L072Z-LRWAN1/inc/mlm32l0xx_hw_conf.h:120:42: note: in expansion of macro 'USART2'
 #define USARTx                           USART2
C:/Users/Wojtek/workspace/RA_B-L072Z-LRWAN1/HAL_Driver/Inc/stm32l0xx_ll_rcc.h:1586:62: note: in expansion of macro 'USARTx'
 __STATIC_INLINE uint32_t LL_RCC_GetUSARTClockSource(uint32_t USARTx)

In your declaration of function LL_RCC_GetUSARTClockSource, you have attempted to give the parameter a name (USARTx) that is already defined as a macro identifier. The result is that the parameter / macro name is replaced with the macro’s expansion text, which ultimately draws on your PERIPH_BASE macro. That’s not valid at that point.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top