Keil Logo

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/2000/XP/7/8/10):
    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 will get located incorrectly using this technique. See knowledgebase article GENERAL: SORTING INTEL HEX FILES for a more robust/easier method.

MORE INFORMATION

SEE ALSO

FORUM THREADS

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

Last Reviewed: Wednesday, September 21, 2016


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.