你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

查看: 14823|回复: 7

第一次接触ST芯片,STM8S.H编译不过去,请帮帮忙看看

[复制链接]

1

主题

7

回帖

0

蝴蝶豆

新手上路

最后登录
1970-1-1
发表于 2013-11-20 10:05:47 | 显示全部楼层 |阅读模式
帮朋友修改一段代码,但是他只发了一些函数过来,我下载了“IAR Embedded Workbench”,然后建立工程,将芯片设置为“STM8AF6226”,然后编译报错“Please select first the target STM8S/A device used in your application (in stm8s.h file)”;在STM8.H找不到“STM8AF6226”的定义,大侠们请帮帮忙,帮我编译过去,
 
相关代码如下
 /* #define STM8S208 */      /*!< STM8S High density devices with CAN */
 /* #define STM8S207 */      /*!< STM8S High density devices without CAN */
 /* #define STM8S007 */      /*!< STM8S Value Line High density devices */
 /* #define STM8AF52Ax */    /*!< STM8A High density devices with CAN */
 /* #define STM8AF62Ax */    /*!< STM8A High density devices without CAN */
 /* #define STM8S105 */      /*!< STM8S Medium density devices */
 /* #define STM8S005 */      /*!< STM8S Value Line Medium density devices */
 /* #define STM8AF626x */    /*!< STM8A Medium density devices */
 /* #define STM8S103 */      /*!< STM8S Low density devices */
 /* #define STM8S003 */      /*!< STM8S Value Line Low density devices */
 /* #define STM8S903 */      /*!< STM8S Low density devices */
 
#if !defined (STM8S208) && !defined (STM8S207) && !defined (STM8S105) && \
    !defined (STM8S103) && !defined (STM8S903) && !defined (STM8AF52Ax) && \
    !defined (STM8AF62Ax) && !defined (STM8AF626x) && !defined (STM8S007) && \
    !defined (STM8S003)&& !defined (STM8S005) 
   
 #error &quotlease select first the target STM8S/A device used in your application (in stm8s.h file)"
#endif

 
回复

使用道具 举报

134

主题

4489

回帖

239

蝴蝶豆

版主

最后登录
2020-12-9
发表于 2013-11-20 10:13:47 | 显示全部楼层

RE:第一次接触ST芯片,STM8S.H编译不过去,请帮帮忙看看

你应该用的是下面这个吧。明显头文件不支持6226这个系列,他支持的是626x系列。
/* #define STM8AF626x */    /*!< STM8A Medium density devices */
回复 支持 反对

使用道具 举报

1

主题

7

回帖

0

蝴蝶豆

新手上路

最后登录
1970-1-1
 楼主| 发表于 2013-11-20 10:15:51 | 显示全部楼层

RE:第一次接触ST芯片,STM8S.H编译不过去,请帮帮忙看看

这样做的意思是不是说给我的这个程序对STM8AF6226编译不过去的?!
回复 支持 反对

使用道具 举报

1

主题

7

回帖

0

蝴蝶豆

新手上路

最后登录
1970-1-1
 楼主| 发表于 2013-11-20 10:18:58 | 显示全部楼层

RE:第一次接触ST芯片,STM8S.H编译不过去,请帮帮忙看看

有没有支持STM8AF6226硬件库??
回复 支持 反对

使用道具 举报

1

主题

7

回帖

0

蝴蝶豆

新手上路

最后登录
1970-1-1
 楼主| 发表于 2013-11-20 10:32:00 | 显示全部楼层

RE:第一次接触ST芯片,STM8S.H编译不过去,请帮帮忙看看

#define STM8AF626x 后
编译报错
Building configuration: sbstcx - Release
Updating build tree...
STM8_EEPROM.c  
Warning[Pa050]: non-native end of line sequence detected (this diagnostic is only issued once) F:\新建文件夹 (2)\stcx\Source\main.h 51
Error[Pe029]: expected an expression F:\新建文件夹 (2)\stcx\Source\STM8_EEPROM.c 5
Error[Pe029]: expected an expression F:\新建文件夹 (2)\stcx\Source\STM8_EEPROM.c 14
Error while running C/C++ Compiler
main.c  
Warning[Pa050]: non-native end of line sequence detected (this diagnostic is only issued once) F:\新建文件夹 (2)\stcx\Source\main.h 51
Warning[Pe177]: variable "Data" was declared but never referenced F:\新建文件夹 (2)\stcx\Source\main.c 42
Warning[Pe177]: variable "Address" was declared but never referenced F:\新建文件夹 (2)\stcx\Source\main.c 43
Warning[Pe177]: variable "value_optbyte" was declared but never referenced F:\新建文件夹 (2)\stcx\Source\main.c 44
Warning[Pe177]: variable "value_optbyte_complement" was declared but never referenced F:\新建文件夹 (2)\stcx\Source\main.c 44
Warning[Pe177]: variable "res_value" was declared but never referenced F:\新建文件夹 (2)\stcx\Source\main.c 45
Error[Pe136]: struct "TIM3_struct" has no field "SMCR" F:\新建文件夹 (2)\stcx\Source\main.c 116
Error[Pe020]: identifier "TIM3_SMCR_TS" is undefined F:\新建文件夹 (2)\stcx\Source\main.c 116
Error[Pe136]: struct "TIM3_struct" has no field "SMCR" F:\新建文件夹 (2)\stcx\Source\main.c 117
Error[Pe020]: identifier "TIM3_SMCR_SMS" is undefined F:\新建文件夹 (2)\stcx\Source\main.c 117
Error[Pe136]: struct "TIM3_struct" has no field "SMCR" F:\新建文件夹 (2)\stcx\Source\main.c 118
Error[Pe020]: identifier "TIM3_SMCR_MSM" is undefined F:\新建文件夹 (2)\stcx\Source\main.c 118
Error while running C/C++ Compiler
stm8_interrupt_vector.c  
Warning[Pe375]: declaration requires a typedef name F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 7
Error[Pe169]: expected a declaration F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 7
Error[Pe020]: identifier "interrupt_handler_t" is undefined F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 11
Error[Pe020]: identifier "interrupt_handler_t" is undefined F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 15
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 15
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 16
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 17
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 18
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 19
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 20
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 21
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 22
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 23
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 24
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 33
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 34
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 36
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 37
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 38
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 45
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 46
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 51
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 52
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 59
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 60
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 65
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 72
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 73
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 83
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 90
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 92
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 93
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 94
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 95
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 96
Error[Pe067]: expected a "}" F:\新建文件夹 (2)\stcx\Source\stm8_interrupt_vector.c 97
Error while running C/C++ Compiler

Total number of errors: 43
Total number of warnings: 8
回复 支持 反对

使用道具 举报

1

主题

7

回帖

0

蝴蝶豆

新手上路

最后登录
1970-1-1
 楼主| 发表于 2013-11-20 10:46:07 | 显示全部楼层

RE:第一次接触ST芯片,STM8S.H编译不过去,请帮帮忙看看

在“stm8_interrupt_vector.c”里找到其中一句报错得代码“typedef void @far (*interrupt_handler_t)(void);”
然后我在“STM8S.H”里找“@far”的定义,
#ifdef _COSMIC_
#define FAR  @far
#define NEAR @near
#define TINY @tiny
#define EEPROM @eeprom
#define CONST  const
#elif defined (_RAISONANCE_) /* __RCST7__ */
#define FAR  far
#define NEAR data
#define TINY page0
#define EEPROM eeprom
#define CONST  code
#if defined (STM8S208) || defined (STM8S207) || defined (STM8S007) || defined (STM8AF52Ax) || \
     defined (STM8AF62Ax)
   /*!< Used with memory Models for code higher than 64K */
  #define MEMCPY fmemcpy
#else /* STM8S903, STM8S103, STM8S003, STM8S105, STM8AF626x */
  /*!< Used with memory Models for code less than 64K */
  #define MEMCPY memcpy
#endif /* STM8S208 or STM8S207 or STM8S007 or STM8AF62Ax or STM8AF52Ax */
#else /*_IAR_*/
#define FAR  __far
#define NEAR __near
#define TINY __tiny
#define EEPROM __eeprom
#define CONST  const
#endif /* __CSMC__ */
我现在用的是IAR编译,是不是说只能用COSMIC编译??
回复 支持 反对

使用道具 举报

134

主题

4489

回帖

239

蝴蝶豆

版主

最后登录
2020-12-9
发表于 2013-11-21 09:17:50 | 显示全部楼层

RE:第一次接触ST芯片,STM8S.H编译不过去,请帮帮忙看看

我找找看有没有对应的库。
回复 支持 反对

使用道具 举报

134

主题

4489

回帖

239

蝴蝶豆

版主

最后登录
2020-12-9
发表于 2013-11-21 10:00:46 | 显示全部楼层

RE:第一次接触ST芯片,STM8S.H编译不过去,请帮帮忙看看

我看了一下,定义就是用626x,这些错误你应该看一下对应报错的位置,查一下错误的原因。很可能是语法的错误。
回复 支持 反对

使用道具 举报

关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
STM32N6 AI生态系统
STM32MCU,MPU高性能GUI
ST ACEPACK电源模块
意法半导体生物传感器
STM32Cube扩展软件包
关注我们
微信公众号二维码 微信公众号
手机版二维码 手机版