Problem description
Keil V4.72 upgrade to V5.1x, the original compiled through the project, the following error occurred:
. \libraries\cmsis\cm3\devicesupport\st\stm32f10x\stm32f10x.h (298): Error: #67: expected a "}
Cause analysis
Keil V4.72 version: When using the STM32 library file, we selected the device in the device column, for example STM32F103VET6, but we also need to preprocessor Symbols add macro STM32F10X_HD so that the compilation can pass. corresponding to the different capacity of the chip, the macro should also be modified to correspond.
Keil v5.1x Version: We have selected the device in the device column, such as STM32F103VET6, then we do not need to add a macro symbols in the preprocessor STM32F10X_HD of the C/S column. This is because the software automatically generates such macros based on devices of different capacities. For example, if our device is STM32F103R8T6, the software will automatically generate macro STM32F10X_MD without the need for the user to add. This is of course the arm company and St Company to discuss, and then decided to deal with it, obviously this is more convenient for users to use.
After our software upgrade, we may have previously defined the macro and the device should actually correspond to the macro inconsistency, the above error occurs. Because it is equivalent to a compiled variable, we define it two times. For example, the device is STM32F103VET6, our definition of the macro is STM32F10X_MD, and the software automatically generated a macro STM32F10X_HD, which will certainly cause errors when compiling.
Solutions
Remove the macro stm32f10x_ (x) d from the preprocessor symbols in the one-C + + column and recompile.
Keil V4.72 after upgrading to v5.1x