Hex2bin 2.1

This tool is used for converting hexadecimal files (either Motorola or Intel
format) into a binary file. It's a command line tool with basic capabilities.

Hex2bin/mot2bin Features

It can handle the extended Intel hex format in segmented and linear address
modes. Records need not be sorted and there can be gaps between records.
Holes/unused bytes can be specified as any other value than FF. A checksum can
be inserted into the binary file.

License

Usage

Options are now case sensitive and options with parameters need a space
between option and parameter. I.e. -s 0000 instead of -s0000.

A successful execution exits with the error code = 0, If any error occurs,
the program exits immediately with the error code = 1.

Batch/script mode

Normally, if the specified hex file doesn't exist, hex2bin/mot2bin ask
repeatedly for a valid filename. A batch/script mode option is provided for
exiting with an error instead of asking for a file.

hex2bin -b xxxx.hex

If the file xxxx.hex doesn't exist, the program exits immediately with the
error code = 1.

Checksum of source file

By default, it ignores checksum errors, so that someone can change by hand
some bytes allowing quick and dirty changes.

If you want checksum error reporting, specify the option -c.

hex2bin -c example.hex

If there is a checksum error somewhere, the program will continue the
conversion anyway. For convenience,

hex2bin/mot2bin displays the expected checksum at each faulty records.

Extension for output file

By default, the extension will be .bin. Another value can be
specified.

hex2bin -e com example.hex

A file example.com will be
generated.

Padding byte

By default, unused locations will be filled with FF. Another value can be
specified.

hex2bin -p AA example.hex

Starting Address and Length

If the lowest address isn't 0000, ex: 0100: (the first record begins with
:nn010000xxx ) there will be problems when using the binary file to program a
EPROM since the first byte supposed to be at 0100 is stored in the binary file
at 0000.

you can specify the binary file's starting address on the command line:

hex2bin -s 0000 start_at_0100.hex

The bytes will be stored in the binary file with a padding from 0000 to the
lowest address minus 1 (00FF in this case).

Similarly, the binary file can be padded up to Length -1 with FF or another
byte.

Here, the space between the last byte and 07FF will be filled with FF.

hex2bin -l 0800 ends_before_07FF.hex

EPROM, EEPROM and Flash memories contain all FF when erased.

When the source file name is for-example.test.hexthe binary created will have the name for-example.bin