Keil™, An ARM® Company

Technical Support

OH51: KEEPING HEX RECORDS IN ORDER


Information in this article applies to:

  • C51 Version 5.50 and later

SYMPTOMS

OH51 doesn't seem to generate Intel HEX records that are in address order. This causes havoc with the emulator I use. Is there a way around this problem?

CAUSE

This is correct operation of OH51. There is nothing in the Intel HEX specification that stated that the records must be in any specific order.

RESOLUTION

The easiest resolution to this problem is to use the MS-DOS SORT utility to sort the records into a new HEX file. To do this.

  1. Edit the original HEX file (called oldfile.hex in this example) and remove the last line of the file. This line is the EOF record and can't be correctly sorted. It appears exactly as follows:
    :00000001FF
    
  2. Use the following DOS command line to sort the edited HEX file (this works from MS-DOS as well as from Windows 95/98/NT):
    sort /+4 oldfile.hex > newfile.hex
    
  3. Edit newfile.hex and, on a new line, add the EOF record at the end of the file.
    :00000001FF
    

    Note that only Intel HEX-86 files may be sorted using this method. HEX-286 and HEX-386 files have segment records that may get located incorrectly using this technique.

MORE INFORMATION

SEE ALSO

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Tuesday, July 10, 2007


Did this article provide the answer you needed?
 
Yes
No
Not Sure