Archive for the ‘embedded’ Category

embedded: convert intel hex into bin

December 28, 2016

The post discusses converting a intel hex file into a binary file.

what is hex file
It’s a text file to describe binary file. Some embedded module uses it as input while flashing firmware.

:020000040000FA
:100000000203370218034100C4002202180B222207
:0100100022CD
:07001300021813E4FFA10E27
:07001B0002181B75C8012249
:030023000218239D
:03002B0002182B8D
:030033000218337D
:03003B0002183B6D
:030043000218435D
:03004B0002184B4D
:030053000218533D
:03005B0002185B2D
:030063000218631D
:03006B0002186B0D
:10007300021873BB010689828A83E0225002E722B9
:10008300BBFE02E32289828A83E49322BB010CE54F
:100093008229F582E5833AF583E0225006E9258239
:1000A300F8E622BBFE06E92582F8E222E58229F57D
:1000B30082E5833AF583E49322BB010689828A832E

how to convert it into bin file

  • Download hex2bin .
  • Extract it: tar -xvf Hex2bin-2.3.tar.bz2
  • Then, hex2bin is under Hex2bin-2.3 directory.

use hex2bin to convert file
This command creates a bin file in current directory.

$ ./hex2bin input.hex

use xxd to verify the binary file

$ xxd input.bin | less

conclusion
The post discusses converting a intel hex file into a binary file.


%d bloggers like this: