ARM Technical Support Knowledge Articles

SPLITTING HEX FILES

Applies to: General Topics

Answer


Information in this article applies to:


QUESTION

I have generated an Intel HEX-386 file, however in order to download it to my Phytec KC167 board I need to split the HEX file into two, one for each bank of Flash memory. How can I do this?

ANSWER

You can use the BIN2HEX and HEX2BIN utilities to split a HEX-386 file.

  1. Convert your HEX file to a binary file. Note that this binary file will be quite big.
  2. Convert ranges of addresses from the binary file into HEX files. You can specify the starting address and the number of bytes to read. Be sure to specify the /4 switch in order to generate Hex-386 files.

The following are utilities available from the Keil web site:

The utilities are DOS based, and running them without arguments will show all the available options:

HEX2BIN

Syntax: HEX2BIN [/option] hexfile [binfile]

hexfile is the Intel HEX input file
binfile is the binary file to create

option  may be any of the following

Note: n is a decimal number.

  /Ln     Binary file length
  /Pn     Pad data for binary file
  /On     Address offset (to add to HEX records)
  /M      Merge data into existing BIN file
  /Q      Quiet mode (no statistics are displayed)
  /X      Don't process ext. segment/linear address records

  /?      This help text

BIN2HEX

Syntax: BIN2HEX [/option] binfile [hexfile]

binfile is the binary input file
hexfile is the Intel HEX file to create

option  may be any of the following

Note: n is a decimal number.

  /Ln     Bytes to read from binary file
  /In     Binary file starting offset
  /On     Output file address offset (where HEX data starts)
  /M      Merge data into existing HEX file
  /2      Generate HEX file using ext. segment address records (HEX86)
  /4      Generate HEX file using ext. linear address records (HEX386)
  /Q      Quiet mode (no statistics are displayed)
  /T      Exclude EOF record
  /A      Append to end of existing HEX file

  /?      This help text

Article last edited on: 2005-09-22 13:22:57

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential