• 已解决 73482 个问题
  • 已帮助 5993 位优秀工程师

KEIL编译STM32代码时出错,该如何修改?

捷波 2018-10-05 浏览量:6697

编译信息如下,该如何修改才能编译通过。


*** Using Compiler 'V5.06 update 6 (build 750)' folder: 'C:\Keil\V5\ARM\ARMCC\Bin'

Build target 'STM32F401 Flash'
compiling Retarget.c...
compiling Serial.c...
compiling blinky.c...
compiling Buttons_NUCLEO_F401RE.c...
compiling LED_NUCLEO_F401RE.c...
assembling startup_stm32f401xe.s...
compiling system_stm32f4xx.c...
RTE\Device\STM32F401RETx\system_stm32f4xx.c(141): error:  #147: declaration is incompatible with "const uint8_t AHBPrescTable[16]"  (declared at line 76 of "C:\Keil\V5\ARM\PACK\Keil\STM32F4xx_DFP\2.13.0\Drivers\CMSIS\Device\ST\STM32F4xx\Include\system_stm32f4xx.h")
    __IO const uint8_t AHBPrescTable[16] = {0 0 0 0 0 0 0 0 1 2 3 4 6 7 8 9};
RTE\Device\STM32F401RETx\system_stm32f4xx.c: 0 warnings 1 error
".\Flash\blinky.axf" - 1 Error(s) 0 Warning(s).
Target not created.

Build Time Elapsed:  00:00:44


相应代码如下:

system_stm32f4xx.c

141   __IO const uint8_t AHBPrescTable[16] = {0 0 0 0 0 0 0 0 1 2 3 4 6 7 8 9};


system_stm32f4xx.h

76    extern const uint8_t  AHBPrescTable[16];    /*!< AHB prescalers table values */
77    extern const uint8_t  APBPrescTable[8];     /*!< APB prescalers table values */

0 0 收起

我来回答

上传资料:
选择文件 文件大小不超过15M(格式支持:doc、ppt、xls、pdf、zip、rar、txt)
最佳答案
  • 141   __IO const uint8_t AHBPrescTable[16] = {0 0 0 0 0 0 0 0 1 2 3 4 6 7 8 9};

    大括号里面,数字之间放个逗号,加15个逗号再编译

    • 发布于 2018-10-07
    • 举报
    • 评论 0
    • 0
    • 0

其他答案 数量:9
  • C语言的基本语法,建议在编译出错时吧出错的代码粘到百度上查找错误的原因,在分析错误的地方。或者英语比较的好自己直接的翻译。
    • 发布于2018-10-11
    • 举报
    • 评论 0
    • 0
    • 0

  • 数组之间的元素需要用逗号隔开
    • 发布于2018-10-13
    • 举报
    • 评论 0
    • 0
    • 0

  • 这里的数组赋值那里的大括号,取初始值的时候要加上逗号的
    • 发布于2018-10-14
    • 举报
    • 评论 0
    • 0
    • 0

  • 你的数组那里就有错误,数组要用大括号
    • 发布于2018-10-17
    • 举报
    • 评论 0
    • 0
    • 0

  • 定义的数组中每个数据之间应该有英文的逗号进行分割,否则编译器不会识别。
    • 发布于2018-10-29
    • 举报
    • 评论 0
    • 0
    • 0

  • 检查你是数值定义,标点符号的问题
    • 发布于2018-11-14
    • 举报
    • 评论 0
    • 0
    • 0

相关问题

问题达人换一批

KEIL编译STM32代码时出错,该如何修改?