打印
[STM8]

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

[复制链接]
8394|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配套的上位机程序?

使用特权

评论回复
5
qq642131851| | 2010-9-16 09:14 | 只看该作者
。。。。。。。。。。。。。。。

使用特权

评论回复
6
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]);

使用特权

评论回复
7
香水城| | 2010-9-19 10:01 | 只看该作者
DataAddress 是什么类型?

使用特权

评论回复
8
pkat| | 2010-9-19 10:20 | 只看该作者
楼主的问题还真不少:lol

使用特权

评论回复
9
wqz|  楼主 | 2010-9-19 10:42 | 只看该作者
DataAddress 是什么类型?
香水城 发表于 2010-9-19 10:01


原文档是
@far u8* DataAddress;

IAR下我改成
__far unsigned char* DataAddress;

使用特权

评论回复
10
liuxiaoyun1210| | 2012-6-15 17:05 | 只看该作者
1# wqz
楼主,你的IAR编写STM8S的IAP成功了没有?

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

wqz

12

主题

117

帖子

2

粉丝