Reputation: 6126
I have a firmware file with Intel Hex format which belongs to a P80C528EBA microcontroller. This microcontroller is an 8-Bit mC and it is based on 80C51 architecture.
Below, you can see the first 5 lines of the file:
:llaaaattddddddcc
1 :03800000028100FA
2 :028003008028D3
3 :02800B00806093
4 :0280130080608B
5 :01801B003232
As you may know and I have added in the above, Intel Hex format lines have structure as below:
:llaaaattddddd..............cc
||||||||||| CC->Checksum
|||||||||DD->Data...
|||||||TT->Record Type
|||AAAA->Address
|LL->Record Length
:->Colon
As you see above in the first 5 line of my file, the AAAA
value of the line #2 is 0x8003
and it is equal to LL
+ AAAA
of line #1 (0x03 + 0x8000). But this pattern is not correct for the next 3 lines. For example for the line #3 we expect 0x8005 which is equal to 0x8003 + 0x02 (AAAA
+ LL
Of line #2), but surprisingly we have 0x800B. I have about 10 lines with wrong patterns in this file (which have about 2000 lines).
Question: Does that mean that the file is corrupted and some lines are deleted? Or it is OK to have some hollows between lines (as above) in the Intel Hex format?
Upvotes: 0
Views: 303
Reputation: 12600
The files is not corrupted, all checksums are correct.
The only thing I would expect is the end-of-file record
:00000001FF
But as you say, the file is much longer than the extract you show.
Anyway, it is completely OK for an Intelhex file to have gaps.
Additionally, the records don't have to be in order.
If you disassemble the machine code, you get
C8000: ljmp C8100
C8003: sjmp C802D
C800B: sjmp C806D
C8013: sjmp C8075
C801B: reti
You are looking at the locations where reset and interrupt routines start.
Upvotes: 3