[STM8] 使用IAR编写STM8S的IAP学习过程中碰到不少问题

[复制链接]
9774|9
 楼主| wqz 发表于 2010-9-15 13:45 | 显示全部楼层 |阅读模式
之前既没有学过IAR,也没有玩过IAP,这次乘学习STM8的机会想把这两样都给学了,所以我选用IAR作为STM8的开发工具。
初次尝试编写IAP,遇到许多问题,盼可以得到高手们的指点。
1.使用AN2659里的代码修改后放在IAR里编译,有几条语句出现编译错误
    a.DataAddress = *(__far unsigned char**)(&DataBuffer[N_ADDR_3]);
      Error[Pe513]: a value of type "unsigned char __far *" cannot be assigned to an entity of type "unsigned char *" D:\Backup\我的文档\STM8\IAP\main.c 249

     b.if (!WriteBuffer(DataAddress, DataCount+1))
        Error[Pe167]: argument of type "unsigned char volatile *" is incompatible with parameter of type "unsigned char *" D:\Backup\我的文档\STM8\IAP\main.c 338

      c. if ((DataAddress >= RAM_START) && (DataAddress <= RAM_END))
          Warning[Pe186]: pointless comparison of unsigned integer with zero D:\Backup\我的文档\STM8\IAP\main.c 380

2.因为boot部分占用了CODE区的开始部分,AP程序在编译的时候要重新指向中断向量地址,在IAR里代码应该怎么实现?
 楼主| wqz 发表于 2010-9-15 13:56 | 显示全部楼层
Warning[Pe186]: pointless comparison of unsigned integer with zero D:\Backup\我的文档\STM8\IAP\main.c 380
这个编译警告已经搞定。
 楼主| wqz 发表于 2010-9-15 14:02 | 显示全部楼层
b.if (!WriteBuffer(DataAddress, DataCount+1))
        Error[Pe167]: argument of type "unsigned char volatile *" is incompatible with parameter of type "unsigned char *" D:\Backup\我的文档\STM8\IAP\main.c 338

这个编译错误也已经搞定
将   volatile __far unsigned char* DataAddress;
改成  __far unsigned char* DataAddress;
 楼主| wqz 发表于 2010-9-15 14:48 | 显示全部楼层
另外请教一下有没有AN2659配套的上位机程序?
qq642131851 发表于 2010-9-16 09:14 | 显示全部楼层
。。。。。。。。。。。。。。。
 楼主| wqz 发表于 2010-9-19 09:51 | 显示全部楼层
哪位对语法擅长的帮忙找一下这个语句的错误
DataAddress = *(__far unsigned char**)(&DataBuffer[N_ADDR_3]);
      Error[Pe513]: a value of type "unsigned char __far *" cannot be assigned to an entity of type "unsigned char *" D:\Backup\我的文档\STM8\IAP\main.c 249

下面是AN2659源码里的第229、230行的原文
//update address to read from
  DataAddress = *(@far u8**)(&DataBuffer[N_ADDR_3]);
香水城 发表于 2010-9-19 10:01 | 显示全部楼层
DataAddress 是什么类型?
pkat 发表于 2010-9-19 10:20 | 显示全部楼层
楼主的问题还真不少:lol
 楼主| wqz 发表于 2010-9-19 10:42 | 显示全部楼层
DataAddress 是什么类型?
香水城 发表于 2010-9-19 10:01


原文档是
@far u8* DataAddress;

IAR下我改成
__far unsigned char* DataAddress;
liuxiaoyun1210 发表于 2012-6-15 17:05 | 显示全部楼层
1# wqz
楼主,你的IAR编写STM8S的IAP成功了没有?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

wqz

12

主题

117

帖子

2

粉丝
快速回复 在线客服 返回列表 返回顶部