IAR EWSTM8 HEX格式问题?

[复制链接]
 楼主| crazybee 发表于 2010-8-3 12:38 | 显示全部楼层 |阅读模式
:04 0000 05 0000B191B5

这个是IARSTM8 输出的HEX文件最后部分,请问 05 这里指什么意思呢? 查了HEX格式资料说是“开始线性地址” 不知道在这里是什么意思?
 楼主| crazybee 发表于 2010-8-3 16:04 | 显示全部楼层
有人知道不?
 楼主| crazybee 发表于 2010-8-3 17:11 | 显示全部楼层
MCUISP知道不,你的编程序都做了,下载程序的时候上位机总要读HEX文件吧!
IJK 发表于 2010-8-4 09:24 | 显示全部楼层
:04 0000 05 0000B191B5

04 是长度

000005 是地址,3字节长的地址
 楼主| crazybee 发表于 2010-8-4 09:55 | 显示全部楼层
楼上的,搞错了吧

:    04     0000    05     0000B191   B5
开始  长度  地址    类型  数据         校验

我想问的数 05 在EWSTM8 里代表什么意思,比如 00 代表MEMORY 数据!

而这里的 05 是什么意思呢? STM8 存储器是统一编址的!
05, Start Linear Address Record. The address field is 0000, the byte count is 04. The 4 data bytes represent the 32-bit value loaded into the EIP register of the 80386 and higher CPU.
IJK 发表于 2010-8-4 11:43 | 显示全部楼层
楼上的,搞错了吧

crazybee 发表于 2010-8-4 09:55


呵呵,记错了。

http://en.wikipedia.org/wiki/Intel_HEX

0000B191应该是需要装入的地址,估计是供后面的 hex目标码用。
05, Start Linear Address Record. The address field is 0000, the byte count is 04. The 4 data bytes represent the 32-bit value loaded into the EIP register of the 80386 and higher CPU. There are various format subtypes:
  • I8HEX or INTEL 8, 8-bit format.
  • I16HEX or INTEL 16, 16-bit format. Allows usage of 02 and 03 records. The data field endianness may be byte-swapped.
  • I32HEX or INTEL 32, 32-bit format. Allows usage of 04 and 05 records. The data field endianness may be byte-swapped.
Beware! Byte-swapped data might be more confusing. It is possible to misinterpret the byte order in case of I16HEX and I32HEX.
mcuisp 发表于 2010-8-4 11:56 | 显示全部楼层
hex格式我做好就忘了,呵呵
得去翻资料才能看懂。
 楼主| crazybee 发表于 2010-8-6 09:42 | 显示全部楼层
6# IJK


不对啊,反正我都它是多余的,但是IAR输出这样的“05” 应该有他们的用意!

你的理解,我觉得不对,因为“00”每行都带有START ADDRESS的1
McuPlayer 发表于 2010-8-6 11:58 | 显示全部楼层
不知道的不要乱猜,找资料仔细看下吧,我凭**随便说一点:

:10 0000 05 11 22 33 44 55 66 CC
冒号后分别是长度,地址,记录类型 数据(多个字节) 校验和

类型00是数据
类型05是起始地址,好像是给调试工具用的,芯片烧录可忽略
IJK 发表于 2010-8-6 14:04 | 显示全部楼层
本帖最后由 IJK 于 2010-8-6 14:06 编辑

http://en.wikipedia.org/wiki/Intel_HEX

0000B191应该是需要装入的地址,估计是供后面的 hex目标码用。
05, Start Linear Address Record. The address field is 0000, the byte count is 04. T ...
IJK 发表于 2010-8-4 11:43 [/quote]

还是举例说明,才能弄清楚。我的代码生成的部分HEX如下:
:020000040800F2
:1000000000040020594A0008A1420008A342000849
:10001000A5420008A7420008A9420008000000000D
... ...
:104C700006070809FFFFFFFFFFFFFFFF020406080A
:084C8000FFFFE8030100000042
:0400000508004ABDE8
:00000001FF

此段与LZ的一样,类型为05:
:0400000508004ABDE8
其中的地址是0x08004ABD,当我下载代码到芯片里后(不勾选 run to main),程序恰好停在 0x08004ABD,对应于标号: __iar_program_start

维基百科是这么说:
http://en.wikipedia.org/wiki/Intel_HEX
05, Start Linear Address Record. The address field is 0000, the byte count is 04. The 4 data bytes represent the 32-bit value loaded into the EIP register of the 80386 and higher CPU.

根据 http://en.wikipedia.org/wiki/X86_assembly_language
The instruction pointer is called ip in 16-bit mode, eip in 32-bit mode, and rip in 64-bit mode. The instruction pointer register points to the memory address which the processor will next attempt to execute
实际上 EIP 寄存器就是 STM8或者ARM芯片的PC指针。

可见,上面维基百科的描述是对的:类型05后面跟的是4字节地址,将赋给(STM8或者ARM芯片的)PC指针。
FAQ 发表于 2014-10-12 13:10 | 显示全部楼层
有道理
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:MSN: ihuangwh@foxmail.com

149

主题

800

帖子

5

粉丝
快速回复 在线客服 返回列表 返回顶部
个人签名:MSN: ihuangwh@foxmail.com

149

主题

800

帖子

5

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