Microcontroller › AVR › how to read hex file
- This topic has 6 replies, 6 voices, and was last updated 11 years, 7 months ago by
AJISH ALFRED.
-
AuthorPosts
-
February 23, 2011 at 6:08 am #745
dagakshay
Participanthello
one interesting thing which might solve your doubt if you are looking for the hex code size of your project.
where you saw the size of your hex file?… just by right clicking on the file and going to the properties? is that the way you have checked?…
you are 100% wrong if you have assumed that is the original amount of hex which is going to be dumped in your controller.
open your hex file with a text editor like notepad.. it should look something like this:
//……………………………………………………………
:100000000C942A000C9434000C9434000C943400AA:100010000C9434000C9434000C9434000C94340090:100020000C9434000C9434000C9434000C94340080:100030000C9434000C9434000C9434000C94340070:100040000C9434000C9434000C9434000C94340060:100050000C94340011241FBECFE5D4E0DEBFCDBF29:100060000E9436000C946E000C940000FF920F93D7:100070001F938FEF87BB81BB8EEFF82E04E02AEF32:1000800030E01DEFBAE0ABEF41E1F7EFEFE17FEEDB:100090006FED5FEBF8BA02BBC9010197F1F718BB2E:1000A000B2BBC9010197F1F7A8BB42BBC9010197D7:1000B000F1F7F8BBE2BBC9010197F1F778BB42BB8E:1000C000C9010197F1F768BB42BBC9010197F1F77C:1000D00058BB42BBC9010197F1F7DCCFF894FFCFC1:00000001FF//………………………………………………………………let me take one line from this hex file
:100000000C942A000C9434000C9434000C943400AA
:CCAAAATTXXXXX……XXSS
1) A new line in hex file always starts from “:” (colon)
2) The first two letters represent the number of bytes in that line (all the values written in hex)…”CC”
3) The AAAA: the next four letters indicate from where this line should start… the starting address…
4) type of the line.. if TT=00 more lines are there in that hex file,,, if TT=01 that is the last line in that hex file…
5) XXXX……..XX is the original code that is going to be dumped onto your controller..
6) at last the SS is the checksum for the complete line.
if you want the original size of your hex code you are going to dump, go to the second last line note the address and add the count bytes (CC) this will tell the original size…
the size you see in the properties of file is the size of that text file which includes all the : , CC , AAAA and SS which you are not goin to dump in your controller ……..
post your comments here if you have any doubts in that or you can add on more information here
March 27, 2011 at 8:16 am #5815Amit Joshi
Participantcan u explain it by giving example.
April 6, 2012 at 10:03 pm #7400Ahmed
ParticipantIf we can see example about this it will be great for us to calculate our HEX file.
Thanks dagakshay
May 11, 2012 at 6:15 am #7732nikhiljain
ParticipantMay 11, 2012 at 6:15 am #7752nikhiljain
ParticipantJuly 13, 2013 at 2:51 pm #10140ravi kant
Participantdo you have more or can u can recommend book about hex file?pls reply
July 16, 2013 at 4:17 am #10149AJISH ALFRED
ParticipantReally useful information. Thanks Dagakshay.
-
AuthorPosts
- You must be logged in to reply to this topic.