英特尔十六进制文件格式 [英] intel hex file format
本文介绍了英特尔十六进制文件格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我有一个长度为31的ushort类型的数组.我要以一种特殊的格式将其数据存储为数据记录:"intel hex文件格式".我怎样才能做到这一点?任何现成的东西吗? ;)
Hi
I have an array of type ushort with a length of 31. I wana store it''s data as a data record in a special format called: "intel hex file format". How can I do this? Any ready-to-use sth? ;)
推荐答案
基于本文- http://en. wikipedia.org/wiki/Intel_HEX [ ^ ]-直接执行此操作似乎相当容易.该格式很简单,因此您实际上不需要任何第三方库即可.
Based on this article - http://en.wikipedia.org/wiki/Intel_HEX[^] - it seems fairly easy to do this directly. The format is straightforward, so you don''t really need any 3rd party library to do this.
正如Nish所说,Intel HEX格式非常简单.
这是我不得不为HEX文件编写解析器时从后面的笔记中找到的信息:
英特尔HEX记录格式:
领导者-1个字符(:")
count-2个字符(数据部分中2个字符对的数量)
地址-4个字符(应将数据放置在内存中的16位地址)
EOF标志-2个字符(00 =正常记录,01 =文件中的最后一个记录)
数据-0-512(?)字符
校验和-2个字符(数据字节总和+校验和+ 1 = 0 mod 256)
注意:校验和使用实际的数据字节,而不是代表它们的字符.
我认为HEX文件可能允许其他地址大小,因此您可能必须相应地更改地址字段.
As Nish said, the Intel HEX format is pretty simple.
Here''s the information I found in my notes from back when I had to write a parser for HEX files:
Intel HEX record format:
Leader - 1 char (":")
count - 2 chars (number of 2 character pairs in the data section)
address - 4 chars (16-bit address where the data should be placed in memory)
EOF Flag - 2 chars (00 = normal record, 01 = last record in the file)
data - 0-512(?) chars
checksum - 2 chars (sum of data bytes + checksum + 1 = 0 mod 256)
NOTE: The checksum uses the actual data bytes, not the characters that represent them.
I think HEX files may allow other address sizes, so you may have to change the address field accordingly.
这篇关于英特尔十六进制文件格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文