一、用stm32f10x_lib.h文件时的问题
在工程中参加源程序main.c文件,源代码内容如下:
#include “stm32f10x_lib.h”
int main(void)
{
}
编译会呈现过错,使得入门者难以持续深化学习STM32。
过错提示的悉数信息如下:
test.axf: Error: L6218E: Undefined symbol SystemInit (referred from startup_stm32f10x_md.o).
; Reset handler
Reset_Handler
;
;
;
保存后再编译就不会呈现上面的过错了。
(http://www.openedv.com/posts/list/3010.htm)
二、用stm32f10x.h文件时的问题
在工程中参加源程序main.c文件,源代码内容如下:
#include “stm32f10x.h”
int main(void)
{
}
编译会呈现过错,使得入门者难以持续深化学习STM32。
过错提示的悉数信息如下:
C:Keil_STM32ARMINCSTSTM32F10xstm32f10x.h(80): error:
右键点击工程名,挑选第一个options for target ,下面挑选C/C++,在define文本框中输入:STM32F10X_MD,USE_STDPERIPH_DRIVER即可。MD依据你挑选的机种更换为LD或HD
(http://zhidao.baidu.com/link?url=erV1uOi-zVAWbRa6Af9OalKFHAVl1oVSY8CWVgPKqcBXFF_SX6Og4L0NfpD2fSpn2ARXzwd OEneefYD_N2gfaK)
再编译,会呈现更多过错,例如:
error:#256: invalid redeclaration of type name "s32" (declared at line 470 of "C:Keil_STM32ARMINCSTSTM32F10xstm32f10x.h")
#256: invalid redeclaration of type name "sc32" (declared at line 474 of "C:Keil_STM32ARMINCSTSTM32F10xstm32f10x.h")
......
error:#101: "RESET" has already been declared in the current scope
error:#101: "SET" has already been declared in the current scope
......
error:#256: invalid redeclaration of type name "ErrorStatus" (declared at line 507 of "C:Keil_STM32ARMINCSTSTM32F10xstm32f10x.h")
warning:#47-D: incompatible redefinition of macro "HSE_Value" (declared at line 511 of "C:Keil_STM32ARMINCSTSTM32F10xstm32f10x.h")
处理办法:
翻开stm32f10x_conf.h文件,将第21行的“#include "stm32f10x_type.h"”注释掉,再保存stm32f10x_conf.h文件,从头编译即可。