Script hex2bin.pyΒΆ

You can use as handy hex-to-bin converter. This script is just a frontend for function hex2bin from intelhex package.

    python [options] INFILE [OUTFILE]

    INFILE      name of hex file for processing.
    OUTFILE     name of output file. If omitted then output
                will be writing to stdout.

    -h, --help              this help message.
    -p, --pad=FF            pad byte for empty spaces (hex value).
    -r, --range=START:END   specify address range for writing output
                            (hex value).
                            Range can be in form 'START:' or ':END'.
    -l, --length=NNNN,
    -s, --size=NNNN         size of output (decimal value).

Per example, converting content of foo.hex to foo.bin addresses from 0 to FF:

$ python -r 0000:00FF foo.hex

Or (equivalent):

$ python -r 0000: -s 256 foo.hex