GENERAL: MAKING HEX FILES FROM BINARY FILES
Information in this article applies to:
I need to create a HEX file from a BINARY file. Where can I find a utility that does that?
You may want to consider using the free srec_cat.exe utility which is available as Windows EXE file from https://sourceforge.net/projects/srecord/files/srecord-win32. It is part of the SRecord project hosted on sourceforge.net. With this utility, you can load one or multiple BINARY files, cut out specific address areas, move them to a new address and store them to a HEX file.
You can invoke srec_cat.exe from a Windows command prompt or Make tool:
srec_cat.exe BinaryFile.bin -Binary -o HexFile.hex -Intel
You can also invoke this tool before or after each project build/rebuild by specifying its invocation in the µVision dialog Options for Target - User - Before/After Build/Rebuild. You can use µVision key sequences as parameter for srec_cat.exe. If many parameters are needed, it may be easier to use a command file. When using a command file for srec_cat.exe, be sure to double the '@' character, or µVision might interpret it as a key-sequence.
For a full description of all srec_cat.exe parameters, refer to the SRecord Reference Manual. Here are some options which are useful with Keil tools:
If you want to convert the first 16K of a 32K BINARY file (BinaryFile.bin) (address range 0x000000-0x007FFF) to a HEX file (HexFile.hex) where the data should start at address 0x08010000, you can use the following srec_cat.exe command file:
# take BinaryFile.bin address area 0x000000-0x003FFF and add an offset of 0x08010000 .\OBJ\BinaryFile.bin -Binary -crop 0x000000 0x003FFF -offset 0x08010000 # generate a HEX file -o .\OBJ\HexFile.hex -Intel
Invocation of srec_cat.exe with command file:
The following Discussion Forum threads may provide information related to this topic.
Last Reviewed: Tuesday, July 17, 2018
of your data.