This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

warning incompatible redefinition of macro "FLAG_Mask" and others

Hi,

I'm working in a project which uses some macros from Keil. These are RCC (so we use stm32f10x_rcc.c), SPI (stm32f10x_spi.c), DMA (stm32f10x_dma.c), PWR (stm32f10x_pwr.c), USART (stm32f10x_usart.c) and CEC (stm32f10x_cec).

When I compile the project, appears some warnings that say:

C:\keil_472\ARM\RV31\LIB\ST\STM32F10x_StdPeriph_Driver\src\stm32f10x_rcc.c(77): warning:  #47-D: incompatible redefinition of macro "CFGR_OFFSET" (declared at line 54 of "C:\keil_472\ARM\RV31\LIB\ST\STM32F10x_StdPeriph_Driver\src\stm32f10x_cec.c")
  #define CFGR_OFFSET               (RCC_OFFSET + 0x04)


I have put only an example, but for the following defines appear warnings:

FLAG_Mask
CFGR_OFFSET
CR1_CLEAR_Mask
CR_OFFSET
CSR_OFFSET

According to this thread: http://www.keil.com/support/docs/1727.htm I understand what is happening (the values of the defines are different for each one), but how I can solve it? what value the system will take in each case? all the same? the first that is defined?

Thanks for your attention

  • Sounds like you are #including .C files?!

    Place the individual files into the project tree.

    Suggest you download ST's latest SPL code and review the Template projects for Keil. Pay special attention to the files in the project both in the tree and the project directory, the defines passed to the compiler, and the include files.

    You should really only need to pull the top level "stm32f1xx.h" file, the others should come in via stm32f1xx_conf.h in your project directory.

  • Thank you Clive!

    I'm including .h as you can see in the following image.

    i.imgsafe.org/2d11d1bdaf.png

    Suggest you download ST's latest SPL code and review the Template projects for Keil. Pay special attention to the files in the project both in the tree and the project directory, the defines passed to the compiler, and the include files.

    Where I have to download this code? from Keil website or from ST? it's my first time to do this.

    You should really only need to pull the top level "stm32f1xx.h" file, the others should come in via stm32f1xx_conf.h in your project directory.

    How I know that is the "top level" stm32f1xx.h file? I understand that UART and I2C are in the same "level", isn't it?

    Thanks