关于stm32f4xx_fsmc.c编译报错的问题

2019-03-23 15:59发布

本帖最后由 经世致用 于 2013-12-24 14:25 编辑

我参考几种新建工程的方法,综合起来,新建了一工程模版。
如下图
(X~Q)01S0]9B_EAU4C}Q$SH.jpg

添加了STM32F4资料STM32F4xx_DSP_StdPeriph_Lib_V1.3.0LibrariesSTM32F4xx_StdPeriph_Driversrc中的库文件,
编译时报错,
报错如下:..Libsrcstm32f4xx_fsmc.c(129): error:  #20: identifier "FSMC_Bank1" is undefined
      FSMC_Bank1->BTCR[FSMC_Bank] = 0x000030DB;   
..Libsrcstm32f4xx_fsmc.c(134): error:  #20: identifier "FSMC_Bank1" is undefined
      FSMC_Bank1->BTCR[FSMC_Bank] = 0x000030D2;
..Libsrcstm32f4xx_fsmc.c(136): error:  #20: identifier "FSMC_Bank1" is undefined
    FSMC_Bank1->BTCR[FSMC_Bank + 1] = 0x0FFFFFFF;
..Libsrcstm32f4xx_fsmc.c(137): error:  #20: identifier "FSMC_Bank1E" is undefined
    FSMC_Bank1E->BWTR[FSMC_Bank] = 0x0FFFFFFF;  
..Libsrcstm32f4xx_fsmc.c(173): error:  #20: identifier "FSMC_Bank1" is undefined
    FSMC_Bank1->BTCR[FSMC_NORSRAMInitStruct->FSMC_Bank] =
..Libsrcstm32f4xx_fsmc.c(210): error:  #20: identifier "FSMC_Bank1E" is undefined
      FSMC_Bank1E->BWTR[FSMC_NORSRAMInitStruct->FSMC_Bank] =
..Libsrcstm32f4xx_fsmc.c(220): error:  #20: identifier "FSMC_Bank1E" is undefined
      FSMC_Bank1E->BWTR[FSMC_NORSRAMInitStruct->FSMC_Bank] = 0x0FFFFFFF;
..Libsrcstm32f4xx_fsmc.c(281): error:  #20: identifier "FSMC_Bank1" is undefined
      FSMC_Bank1->BTCR[FSMC_Bank] |= BCR_MBKEN_SET;
..Libsrcstm32f4xx_fsmc.c(286): error:  #20: identifier "FSMC_Bank1" is undefined
      FSMC_Bank1->BTCR[FSMC_Bank] &= BCR_MBKEN_RESET;
..Libsrcstm32f4xx_fsmc.c(354): error:  #20: identifier "FSMC_Bank2" is undefined
      FSMC_Bank2->PCR2 = 0x00000018;
..Libsrcstm32f4xx_fsmc.c(363): error:  #20: identifier "FSMC_Bank3" is undefined
      FSMC_Bank3->PCR3 = 0x00000018;
..Libsrcstm32f4xx_fsmc.c(422): error:  #20: identifier "FSMC_Bank2" is undefined
      FSMC_Bank2->PCR2 = tmppcr;
..Libsrcstm32f4xx_fsmc.c(429): error:  #20: identifier "FSMC_Bank3" is undefined
      FSMC_Bank3->PCR3 = tmppcr;
..Libsrcstm32f4xx_fsmc.c(481): error:  #20: identifier "FSMC_Bank2" is undefined
        FSMC_Bank2->PCR2 |= PCR_PBKEN_SET;
..Libsrcstm32f4xx_fsmc.c(485): error:  #20: identifier "FSMC_Bank3" is undefined
        FSMC_Bank3->PCR3 |= PCR_PBKEN_SET;
..Libsrcstm32f4xx_fsmc.c(493): error:  #20: identifier "FSMC_Bank2" is undefined
        FSMC_Bank2->PCR2 &= PCR_PBKEN_RESET;
..Libsrcstm32f4xx_fsmc.c(497): error:  #20: identifier "FSMC_Bank3" is undefined
        FSMC_Bank3->PCR3 &= PCR_PBKEN_RESET;
..Libsrcstm32f4xx_fsmc.c(521): error:  #20: identifier "FSMC_Bank2" is undefined
        FSMC_Bank2->PCR2 |= PCR_ECCEN_SET;
..Libsrcstm32f4xx_fsmc.c(525): error:  #20: identifier "FSMC_Bank3" is undefined
        FSMC_Bank3->PCR3 |= PCR_ECCEN_SET;
..Libsrcstm32f4xx_fsmc.c(533): error:  #20: identifier "FSMC_Bank2" is undefined
        FSMC_Bank2->PCR2 &= PCR_ECCEN_RESET;
..Libsrcstm32f4xx_fsmc.c(537): error:  #20: identifier "FSMC_Bank3" is undefined
        FSMC_Bank3->PCR3 &= PCR_ECCEN_RESET;
..Libsrcstm32f4xx_fsmc.c(557): error:  #20: identifier "FSMC_Bank2" is undefined
      eccval = FSMC_Bank2->ECCR2;
..Libsrcstm32f4xx_fsmc.c(562): error:  #20: identifier "FSMC_Bank3" is undefined
      eccval = FSMC_Bank3->ECCR3;
..Libsrcstm32f4xx_fsmc.c(617): error:  #20: identifier "FSMC_Bank4" is undefined
    FSMC_Bank4->PCR4 = 0x00000018;
..Libsrcstm32f4xx_fsmc.c(653): error:  #20: identifier "FSMC_Bank4" is undefined
    FSMC_Bank4->PCR4 = (uint32_t)FSMC_PCCARDInitStruct->FSMC_Waitfeature |
..Libsrcstm32f4xx_fsmc.c(716): error:  #20: identifier "FSMC_Bank4" is undefined
      FSMC_Bank4->PCR4 |= PCR_PBKEN_SET;
..Libsrcstm32f4xx_fsmc.c(721): error:  #20: identifier "FSMC_Bank4" is undefined
      FSMC_Bank4->PCR4 &= PCR_PBKEN_RESET;
..Libsrcstm32f4xx_fsmc.c(767): error:  #20: identifier "FSMC_Bank2" is undefined
        FSMC_Bank2->SR2 |= FSMC_IT;
..Libsrcstm32f4xx_fsmc.c(772): error:  #20: identifier "FSMC_Bank3" is undefined
        FSMC_Bank3->SR3 |= FSMC_IT;
..Libsrcstm32f4xx_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文件从工程中移除后再编译结果如下
..OutputSTM32F429_439xx-DEMO.axf: Error: L6218E: Undefined symbol TimingDelay_Decrement (referred from stm32f4xx_it.o).

我还是个菜鸟,希望有网友能帮我解答一下,谢谢!
附上我的新建的工程,如有配置错误的地方,望各位指点。 此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
9条回答
蓝雨夜
2019-03-24 01: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

一周热门 更多>