1

I'm trying to write simple Intel HEX parser by myself.

And after reading http://en.wikipedia.org/wiki/Intel_HEX wiki I still have some questions.

1.Can be addresses overlapped? I mean is this check is always correct?

if (hexl[k]->address + hexl[k]->count > hexl[k+1]->address)
{
    // These addresses are sorted
    HEX_DEBUG("Addresses [%" PRIx16 "] and [%"PRIx16"]"
              " are overlapping", hexl[k]->address,
              hexl[k+1]->address);
    return HEX_EOVERLAP;
}

2.Can the HEX file which is used for loading to some EPROM have gaps between addresses? I mean should I use

if (hexl[k]->address + hexl[k]->count > hexl[k+1]->address) {} // > comparison
or 
if (hexl[k]->address + hexl[k]->count != hexl[k+1]->address) {} // != comparison

check. I couldn't find some restrictions about that.

likern
  • 3,744
  • 5
  • 36
  • 47

1 Answers1

0
  1. In my practice I never faced with overlapping, so I'm also interested to know such thing, but more widely, considering the case, when overlapping may occur at any record, not only next one. intelhex Python library considers the case as erroneous.
  2. It's very specific to target memory, but it's very common to take place. I'm developing firmware for microcontroller and resulting hex file has several memory regions. Each region starts with "Extended Linear Address" record.
Artem Pisarenko
  • 123
  • 1
  • 2
  • 13