懂事儿 发表于 2016-3-14 16:27:23

求助:“STM8S.H”中的错误!

MCU"STM8S003F3P6"。
在IAR中建立项目,加入CLK.C后,编译提示:“Please select first the target STM8S/A device used in your application (in stm8s.h file)”

别笑,新手。

求高手指点!

zhuoyemp4 发表于 2016-3-14 17:18:14

亲,你好!
这是因为你在stm8s.h里没有加入宏定义或宏定义不是你的器件,
在stm8s.h里有这样几行,
#if !defined (STM8S208) && !defined (STM8S207) && !defined (STM8S105) && !defined (STM8S103) && !defined (STM8S903) && !defined (STM8AF52Ax) && !defined (STM8AF62Ax) && !defined (STM8AF626x)
#error "Please select first the target STM8S/A device used in your application (in stm8s.h file)"
#endif
在你编译时,如果没有以上宏定义,就会报这个错。

在stm8s.h里有一段选择器件的代码:
// #define STM8S207      /*!< STM8S High density devices without CAN */

/* #define STM8AF52Ax */    /*!< STM8A High density devices with CAN */
/* #define STM8AF62Ax */    /*!< STM8A High density devices without CAN */
/* #define STM8S105 */      /*!< STM8S Medium density devices */
/* #define STM8AF626x */    /*!< STM8A Medium density devices */
/* #define STM8S903 */      /*!< STM8S Low density devices */

你选的器件是STM8S Low density devices ,所以可以 把/* #define STM8S903 */的注释符去掉,或者自己定义#define STM8S003

zcl201207 发表于 2016-3-14 22:29:28

:):):):):)

懂事儿 发表于 2016-3-15 14:54:08

这段代码我也看到了,可是上面没有我的“STM8S003F3P6”呀!
可以用哪个替代吗?

zcl201207 发表于 2016-3-15 23:25:27

STM8S103:):):):)

liu553824989 发表于 2016-3-16 08:39:06

二楼正解

懂事儿 发表于 2016-3-16 10:21:16

谢过各位!
页: [1]
查看完整版本: 求助:“STM8S.H”中的错误!