00848859 发表于 2013-11-20 10:05:47

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

帮朋友修改一段代码,但是他只发了一些函数过来,我下载了“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 "Please select first the target STM8S/A device used in your application (in stm8s.h file)"
#endif

 

废鱼 发表于 2013-11-20 10:13:47

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

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

00848859 发表于 2013-11-20 10:15:51

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

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

00848859 发表于 2013-11-20 10:18:58

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

有没有支持STM8AF6226硬件库??

00848859 发表于 2013-11-20 10:32:00

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

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

00848859 发表于 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 CONSTconst
#elif defined (_RAISONANCE_) /* __RCST7__ */
#define FARfar
#define NEAR data
#define TINY page0
#define EEPROM eeprom
#define CONSTcode
#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 CONSTconst
#endif /* __CSMC__ */
我现在用的是IAR编译,是不是说只能用COSMIC编译??

废鱼 发表于 2013-11-21 09:17:50

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

我找找看有没有对应的库。

废鱼 发表于 2013-11-21 10:00:46

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

我看了一下,定义就是用626x,这些错误你应该看一下对应报错的位置,查一下错误的原因。很可能是语法的错误。
页: [1]
查看完整版本: 第一次接触ST芯片,STM8S.H编译不过去,请帮帮忙看看