OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 4343|回复: 7

有一点疑问

[复制链接]

15

主题

49

帖子

0

精华

初级会员

Rank: 2

积分
117
金钱
117
注册时间
2016-9-22
在线时间
26 小时
发表于 2016-10-12 20:11:09 | 显示全部楼层 |阅读模式
1金钱
为什么在system_stm32f4xx.h头文件中的一个语句  extern uint32_t SystemCoreClock中前边有一个x啊?显示没有定义uint32_t什么的     我在前边加上include "stm32f4xx.h"  就没有了,因为顶层头文件里有u32的定义 ,但是加上"sys.h" 就会报错,明明sys.h里边也有stm32f4xx.h啊?这里不是很明白  求解释?

最佳答案

查看完整内容[请看2#楼]

你这是库函数版本代码。加库函数版本的sys.h才可以。
正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

530

主题

11万

帖子

34

精华

管理员

Rank: 12Rank: 12Rank: 12

积分
165536
金钱
165536
注册时间
2010-12-1
在线时间
2117 小时
发表于 2016-10-12 20:11:10 | 显示全部楼层
你这是库函数版本代码。加库函数版本的sys.h才可以。
我是开源电子网www.openedv.com站长,有关站务问题请与我联系。
正点原子STM32开发板购买店铺http://openedv.taobao.com
正点原子官方微信公众平台,点击这里关注“正点原子”
回复

使用道具 举报

15

主题

49

帖子

0

精华

初级会员

Rank: 2

积分
117
金钱
117
注册时间
2016-9-22
在线时间
26 小时
 楼主| 发表于 2016-10-12 20:14:01 | 显示全部楼层
加入sys.h报错 是说在编译过程中报错了     当然什么都不加的话  即使有x也能编译通过  很奇怪啊
回复

使用道具 举报

530

主题

11万

帖子

34

精华

管理员

Rank: 12Rank: 12Rank: 12

积分
165536
金钱
165536
注册时间
2010-12-1
在线时间
2117 小时
发表于 2016-10-12 20:22:16 | 显示全部楼层
加入sys.h,看报什么错,根据报错提示去修改
回复

使用道具 举报

15

主题

49

帖子

0

精华

初级会员

Rank: 2

积分
117
金钱
117
注册时间
2016-9-22
在线时间
26 小时
 楼主| 发表于 2016-10-12 21:08:11 | 显示全部楼层
正点原子 发表于 2016-10-12 20:22
加入sys.h,看报什么错,根据报错提示去修改

这个报错我不是很懂   

Build target 'Template'
compiling main.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
main.c: 0 warnings, 1 error
compiling stm32f4xx_it.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
stm32f4xx_it.c: 0 warnings, 1 error
compiling system_stm32f4xx.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
system_stm32f4xx.c: 0 warnings, 1 error
assembling startup_stm32f40_41xxx.s...
compiling misc.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\misc.c: 0 warnings, 1 error
compiling stm32f4xx_adc.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_adc.c: 0 warnings, 1 error
compiling stm32f4xx_can.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_can.c: 0 warnings, 1 error
compiling stm32f4xx_crc.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_crc.c: 0 warnings, 1 error
compiling stm32f4xx_cryp.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_cryp.c: 0 warnings, 1 error
compiling stm32f4xx_cryp_aes.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_cryp_aes.c: 0 warnings, 1 error
compiling stm32f4xx_cryp_des.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_cryp_des.c: 0 warnings, 1 error
compiling stm32f4xx_cryp_tdes.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_cryp_tdes.c: 0 warnings, 1 error
compiling stm32f4xx_dac.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_dac.c: 0 warnings, 1 error
compiling stm32f4xx_dbgmcu.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_dbgmcu.c: 0 warnings, 1 error
compiling stm32f4xx_dcmi.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_dcmi.c: 0 warnings, 1 error
compiling stm32f4xx_dma2d.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_dma2d.c: 0 warnings, 1 error
compiling stm32f4xx_dma.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_dma.c: 0 warnings, 1 error
compiling stm32f4xx_exti.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_exti.c: 0 warnings, 1 error
compiling stm32f4xx_flash.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_flash.c: 0 warnings, 1 error
compiling stm32f4xx_flash_ramfunc.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_flash_ramfunc.c: 0 warnings, 1 error
compiling stm32f4xx_fsmc.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_fsmc.c: 0 warnings, 1 error
compiling stm32f4xx_gpio.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_gpio.c: 0 warnings, 1 error
compiling stm32f4xx_hash.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_hash.c: 0 warnings, 1 error
compiling stm32f4xx_hash_md5.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_hash_md5.c: 0 warnings, 1 error
compiling stm32f4xx_hash_sha1.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_hash_sha1.c: 0 warnings, 1 error
compiling stm32f4xx_i2c.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_i2c.c: 0 warnings, 1 error
compiling stm32f4xx_iwdg.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_iwdg.c: 0 warnings, 1 error
compiling stm32f4xx_ltdc.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_ltdc.c: 0 warnings, 1 error
compiling stm32f4xx_pwr.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_pwr.c: 0 warnings, 1 error
compiling stm32f4xx_rcc.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_rcc.c: 0 warnings, 1 error
compiling stm32f4xx_rng.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_rng.c: 0 warnings, 1 error
compiling stm32f4xx_rtc.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_rtc.c: 0 warnings, 1 error
compiling stm32f4xx_sai.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_sai.c: 0 warnings, 1 error
compiling stm32f4xx_sdio.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_sdio.c: 0 warnings, 1 error
compiling stm32f4xx_spi.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_spi.c: 0 warnings, 1 error
compiling stm32f4xx_syscfg.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_syscfg.c: 0 warnings, 1 error
compiling stm32f4xx_tim.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_tim.c: 0 warnings, 1 error
compiling stm32f4xx_usart.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_usart.c: 0 warnings, 1 error
compiling stm32f4xx_wwdg.c...
..\SYSTEM\sys\sys.h(86): error:  #20: identifier "u32" is undefined
  void MSR_MSP(u32 addr);       //设置堆栈地址
..\FWLIB\src\stm32f4xx_wwdg.c: 0 warnings, 1 error
回复

使用道具 举报

15

主题

49

帖子

0

精华

初级会员

Rank: 2

积分
117
金钱
117
注册时间
2016-9-22
在线时间
26 小时
 楼主| 发表于 2016-10-13 13:17:41 | 显示全部楼层
回复

使用道具 举报

13

主题

611

帖子

0

精华

金牌会员

Rank: 6Rank: 6

积分
1929
金钱
1929
注册时间
2014-10-6
在线时间
625 小时
发表于 2016-10-13 15:48:03 | 显示全部楼层
好像是u32 数据类型没有定义,你用个宏定义一下吧!
回复

使用道具 举报

15

主题

49

帖子

0

精华

初级会员

Rank: 2

积分
117
金钱
117
注册时间
2016-9-22
在线时间
26 小时
 楼主| 发表于 2016-10-13 21:51:11 | 显示全部楼层
烟酒不沾 发表于 2016-10-13 15:48
好像是u32 数据类型没有定义,你用个宏定义一下吧!

谢谢回答   这个宏在stm31f4xx.h里有  加上去就不报错了   但是sys.h里包含stm31f4xx.h  加上sys.h却不行
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-6-13 17:42

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表