Tag Archives: Preprocessor Symbols setting error

Preprocessor Symbols setting error: error: redefinition of enumerator

The error information is as follows:

../../../../GD32F10x_ Firmware_ Library/CMSIS/GD/GD32F10x/Include\gd32f10x.h(168): error: redefinition of enumerator ‘USBD_ HP_ CAN0_ TX_ IRQn’

../../../../GD32F10x_ Firmware_ Library/CMSIS/GD/GD32F10x/Include\gd32f10x.h(169): error: redefinition of enumerator ‘USBD_ LP_ CAN0_ RX0_ IRQn’

Cause of problem:

Preprocessor symbols should be set to gd32f10x_ MD, but it is set to gd32f10x_ HD

Analysis description:

Preprocessor symbols

Preprocessor symbols means preprocessing symbols, which is equivalent to macro definitions. When we use the gd32 firmware library, because the firmware library contains the definitions of the whole series of GD microcontrollers. At this time, the define box can be used as a global macro definition, that is, select which part of the definitions and resources in the firmware library I want to adopt.

USE_STDPERIPH_DRIVER

It literally means “use standard peripheral driver”. Adding “use_stdperiph_driver” to the C/C + + predefined allows “use standard peripheral driver”. As for the added “gd32f10x_hd”, it can also be explained in the file “gd32f10x. H” through function search as described above. In fact, it also switches some definitions of corresponding hardware.

GD32F10X_HD&GD32F10X_MD

In fact, it defines the capacity of the chip

/* define GD32F10x */
#if !defined (GD32F10X_MD) && !defined (GD32F10X_HD) && !defined (GD32F10X_XD) && !defined (GD32F10X_CL)
  /* #define GD32F10X_MD */     /*!< GD32F10X_MD: GD32 Medium density devices */
  /* #define GD32F10X_HD */     /*!< GD32F10X_HD: GD32 High density Value Line devices */  
  /* #define GD32F10X_XD */     /*!< GD32F10X_XD: GD32 Extra density devices */
  /* #define GD32F10X_CL */     /*!< GD32F10X_CL: GD32 Connectivity line devices */  
#endif /* define GD32F10x */