I need to write a parser of an iHEX ( http://www.keil.com/support/docs/1584/ ) files resource limited system (low clock frequency). I am trying to find out either those 2 questions can be answered without having to read the whole iHEX while through:
1. Can the beginning address for the end BIN file be specified? 2. Can the end BIN file total size be specified?
As for the first question, I have noted that the iHEX files generated by my compiler always start with an extended address record and a data record that shows the true start address, ie:
:020000040803EF (extended linear address record with value 0x0803) :1070000000800220113A0608E11E0508EF1E05085F (Data record with address 0x7000)
From this one can derive that start address of the end BIN file would be 0x08037000. The question is, is it a standard that all iHEX files has to start this way?
As for the second question, I have no idea of how to derive the end BIN file size without reading all iHEX records and counting by hand.
I would appreciate all help.
srecord.sourceforge.net/
(despite the name, it does support Intel Hex)