[求助] 关于stm32f4xx_fsmc.c编译报错的问题

经世致用   2013-12-22 18:25 楼主
我参考几种新建工程的方法,综合起来,新建了一工程模版。 如下图 (X~Q)01S0]9B_EAU4C}Q$SH.jpg 添加了STM32F4资料\STM32F4xx_DSP_StdPeriph_Lib_V1.3.0\Libraries\STM32F4xx_StdPeriph_Driver\src\中的库文件, 编译时报错, 报错如下:..\Lib\src\stm32f4xx_fsmc.c(129): error: #20: identifier "FSMC_Bank1" is undefined FSMC_Bank1->BTCR[FSMC_Bank] = 0x000030DB; ..\Lib\src\stm32f4xx_fsmc.c(134): error: #20: identifier "FSMC_Bank1" is undefined FSMC_Bank1->BTCR[FSMC_Bank] = 0x000030D2; ..\Lib\src\stm32f4xx_fsmc.c(136): error: #20: identifier "FSMC_Bank1" is undefined FSMC_Bank1->BTCR[FSMC_Bank + 1] = 0x0FFFFFFF; ..\Lib\src\stm32f4xx_fsmc.c(137): error: #20: identifier "FSMC_Bank1E" is undefined FSMC_Bank1E->BWTR[FSMC_Bank] = 0x0FFFFFFF; ..\Lib\src\stm32f4xx_fsmc.c(173): error: #20: identifier "FSMC_Bank1" is undefined FSMC_Bank1->BTCR[FSMC_NORSRAMInitStruct->FSMC_Bank] = ..\Lib\src\stm32f4xx_fsmc.c(210): error: #20: identifier "FSMC_Bank1E" is undefined FSMC_Bank1E->BWTR[FSMC_NORSRAMInitStruct->FSMC_Bank] = ..\Lib\src\stm32f4xx_fsmc.c(220): error: #20: identifier "FSMC_Bank1E" is undefined FSMC_Bank1E->BWTR[FSMC_NORSRAMInitStruct->FSMC_Bank] = 0x0FFFFFFF; ..\Lib\src\stm32f4xx_fsmc.c(281): error: #20: identifier "FSMC_Bank1" is undefined FSMC_Bank1->BTCR[FSMC_Bank] |= BCR_MBKEN_SET; ..\Lib\src\stm32f4xx_fsmc.c(286): error: #20: identifier "FSMC_Bank1" is undefined FSMC_Bank1->BTCR[FSMC_Bank] &= BCR_MBKEN_RESET; ..\Lib\src\stm32f4xx_fsmc.c(354): error: #20: identifier "FSMC_Bank2" is undefined FSMC_Bank2->PCR2 = 0x00000018; ..\Lib\src\stm32f4xx_fsmc.c(363): error: #20: identifier "FSMC_Bank3" is undefined FSMC_Bank3->PCR3 = 0x00000018; ..\Lib\src\stm32f4xx_fsmc.c(422): error: #20: identifier "FSMC_Bank2" is undefined FSMC_Bank2->PCR2 = tmppcr; ..\Lib\src\stm32f4xx_fsmc.c(429): error: #20: identifier "FSMC_Bank3" is undefined FSMC_Bank3->PCR3 = tmppcr; ..\Lib\src\stm32f4xx_fsmc.c(481): error: #20: identifier "FSMC_Bank2" is undefined FSMC_Bank2->PCR2 |= PCR_PBKEN_SET; ..\Lib\src\stm32f4xx_fsmc.c(485): error: #20: identifier "FSMC_Bank3" is undefined FSMC_Bank3->PCR3 |= PCR_PBKEN_SET; ..\Lib\src\stm32f4xx_fsmc.c(493): error: #20: identifier "FSMC_Bank2" is undefined FSMC_Bank2->PCR2 &= PCR_PBKEN_RESET; ..\Lib\src\stm32f4xx_fsmc.c(497): error: #20: identifier "FSMC_Bank3" is undefined FSMC_Bank3->PCR3 &= PCR_PBKEN_RESET; ..\Lib\src\stm32f4xx_fsmc.c(521): error: #20: identifier "FSMC_Bank2" is undefined FSMC_Bank2->PCR2 |= PCR_ECCEN_SET; ..\Lib\src\stm32f4xx_fsmc.c(525): error: #20: identifier "FSMC_Bank3" is undefined FSMC_Bank3->PCR3 |= PCR_ECCEN_SET; ..\Lib\src\stm32f4xx_fsmc.c(533): error: #20: identifier "FSMC_Bank2" is undefined FSMC_Bank2->PCR2 &= PCR_ECCEN_RESET; ..\Lib\src\stm32f4xx_fsmc.c(537): error: #20: identifier "FSMC_Bank3" is undefined FSMC_Bank3->PCR3 &= PCR_ECCEN_RESET; ..\Lib\src\stm32f4xx_fsmc.c(557): error: #20: identifier "FSMC_Bank2" is undefined eccval = FSMC_Bank2->ECCR2; ..\Lib\src\stm32f4xx_fsmc.c(562): error: #20: identifier "FSMC_Bank3" is undefined eccval = FSMC_Bank3->ECCR3; ..\Lib\src\stm32f4xx_fsmc.c(617): error: #20: identifier "FSMC_Bank4" is undefined FSMC_Bank4->PCR4 = 0x00000018; ..\Lib\src\stm32f4xx_fsmc.c(653): error: #20: identifier "FSMC_Bank4" is undefined FSMC_Bank4->PCR4 = (uint32_t)FSMC_PCCARDInitStruct->FSMC_Waitfeature | ..\Lib\src\stm32f4xx_fsmc.c(716): error: #20: identifier "FSMC_Bank4" is undefined FSMC_Bank4->PCR4 |= PCR_PBKEN_SET; ..\Lib\src\stm32f4xx_fsmc.c(721): error: #20: identifier "FSMC_Bank4" is undefined FSMC_Bank4->PCR4 &= PCR_PBKEN_RESET; ..\Lib\src\stm32f4xx_fsmc.c(767): error: #20: identifier "FSMC_Bank2" is undefined FSMC_Bank2->SR2 |= FSMC_IT; ..\Lib\src\stm32f4xx_fsmc.c(772): error: #20: identifier "FSMC_Bank3" is undefined FSMC_Bank3->SR3 |= FSMC_IT; ..\Lib\src\stm32f4xx_fsmc.c(777): error: #20: identifier "FSMC_Bank4" is undefined FSMC_Bank4->SR4 |= FSMC_IT; 我看了别人的工程,以前下载的STM32F4xx_StdPeriph_Lib_V1.0.1中没有stm32f4xx_fsmc.c这个文件, 我把这个stm32f4xx_fsmc.c文件从工程中移除后再编译结果如下 ..\Output\STM32F429_439xx-DEMO.axf: Error: L6218E: Undefined symbol TimingDelay_Decrement (referred from stm32f4xx_it.o). 我还是个菜鸟,希望有网友能帮我解答一下,谢谢! 附上我的新建的工程,如有配置错误的地方,望各位指点。 本帖最后由 经世致用 于 2013-12-24 14:25 编辑

回复评论 (9)

沙发自己坐了
点赞  2013-12-24 14:25
因为你选的是429所以在stm32f4xx.h中 看下宏定义
#if defined (STM32F40_41xxx)
#define FSMC_Bank1          ((FSMC_Bank1_TypeDef *) FSMC_Bank1_R_BASE)
#define FSMC_Bank1E         ((FSMC_Bank1E_TypeDef *) FSMC_Bank1E_R_BASE)
#define FSMC_Bank2          ((FSMC_Bank2_TypeDef *) FSMC_Bank2_R_BASE)
#define FSMC_Bank3          ((FSMC_Bank3_TypeDef *) FSMC_Bank3_R_BASE)
#define FSMC_Bank4          ((FSMC_Bank4_TypeDef *) FSMC_Bank4_R_BASE)
#endif /* STM32F40_41xxx */

#if defined (STM32F427_437xx) || defined (STM32F429_439xx)
#define FMC_Bank1           ((FMC_Bank1_TypeDef *) FMC_Bank1_R_BASE)
#define FMC_Bank1E          ((FMC_Bank1E_TypeDef *) FMC_Bank1E_R_BASE)
#define FMC_Bank2           ((FMC_Bank2_TypeDef *) FMC_Bank2_R_BASE)
#define FMC_Bank3           ((FMC_Bank3_TypeDef *) FMC_Bank3_R_BASE)
#define FMC_Bank4           ((FMC_Bank4_TypeDef *) FMC_Bank4_R_BASE)
#define FMC_Bank5_6         ((FMC_Bank5_6_TypeDef *) FMC_Bank5_6_R_BASE)

看起来是不同芯片支持的区别
那我们就直接不把这个文件加入编译吧!


右键 stm32f4xx_fsmc.c  options for file 'stm32f4xx_fsmc.c'
把以下勾都"去掉"
include in tartet build
always build
generate asembler src file
assenble src file
点赞  2013-12-28 16:20
去stm32f4xx_it.c 这个文件里的
void   SysTick_Handler(void)
{
TimingDelay_Decrement();
}
去删掉TimingDelay_Decrement();这个函数应该就可以了
点赞  2016-3-19 14:28
请问后来怎么解决了?
点赞  2017-4-9 02:36
请问后来怎么解决了?
点赞  2017-4-9 02:36
请问后来怎么解决的?
点赞  2017-11-28 08:59
这是由于不支持FSMC导致的,在库函数中应该还能找到一个FMC.c的文件,FMC文件实现的功能和FSMC一样。
把FSMC文件去掉或者不让它在工程中编译就可以了。
C:\Users\Administrator\Desktop\回答论坛的问题\1keil工程添加FSMC文件出错\1.png
  • 1.png
  • 2.png
点赞  2018-1-3 16:49
FMC.c的文件报错,是需要对FMC.c文件进行相同操作吗
点赞  2018-5-25 14:35
我遇到的是stm32f4xx_fmc.c文件报错
stm32f4xx_fmc.h的定义在stm32f4xx_conf.h文件中的定义都是在#if defined(STM32F429_439xx) || defined(STM32F446xx) || defined(STM32F469_479xx)或#if defined(STM32F427_437xx)限制条件下才被include的,但是我的工程使用的是STM32F407,defined的是STM32F40XX,为什么stm32f4xx_fmc.h还会被编译呢???
点赞  2018-5-25 14:40
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复