This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Options for HEX2BIN utility ?

The help screen on the HEX2BIN utility does not give any hint to the usage of 'n'.

I want to convert a HEX file (less than 32k) to a binary file with size=32k (8000 Hex).
Unused bytes should be padded with FF.

I expected the following command to work:

HEX2BIN /P0xFF myfile.hex

but this cmd pads with 00.

To my surprise it works with this command:

HEX2BIN /L0x8000 myfile.hex

Can anyone explain?

Parents
  • There is no length specification in an Intel HEX file. Therefore, when you run HEX2BIN, only the data from the HEX file are converted to the binary file. No additional pad bytes are appended. For example:

    HEX2BIN myfile.hex

    creates myfile.bin. If myfile.hex only contains 3 bytes, the resulting .bin file will only be 3 bytes long.

    The /L argument allows you to specify a LENGTH for the binary file. So,

    HEX2BIN /L32768 myfile.hex

    creates myfile.bin that is 32768 bytes long. The 3 bytes from myfile.hex will be copied and all other bytes will be filled with the default pad value (0xFF).

    The arguments to HEX2BIN may be in decimal or in hex (prefixed with 0x).

    Jon

Reply
  • There is no length specification in an Intel HEX file. Therefore, when you run HEX2BIN, only the data from the HEX file are converted to the binary file. No additional pad bytes are appended. For example:

    HEX2BIN myfile.hex

    creates myfile.bin. If myfile.hex only contains 3 bytes, the resulting .bin file will only be 3 bytes long.

    The /L argument allows you to specify a LENGTH for the binary file. So,

    HEX2BIN /L32768 myfile.hex

    creates myfile.bin that is 32768 bytes long. The 3 bytes from myfile.hex will be copied and all other bytes will be filled with the default pad value (0xFF).

    The arguments to HEX2BIN may be in decimal or in hex (prefixed with 0x).

    Jon

Children