µVISION: HEX FILE START AND END ADDRESSES HAVE NO EFFECT
Information in this article applies to:
In µVision, if I choose Options for Target and click on the Output tab I can specify the start and end address for the generated Hex file. My code ranges from 0xC00000 to 0xC073EF. However, the HEX file must include all bytes from 0xC00000h to 0xC0FFFFh (even unused bytes).
I specified start and end addresses for the Hex file of 0xC00000 to 0xC0FFFFh but the Hex file generated only had data up to 0xC073EFh.
How can I get a HEX file with a full 64K of data in it?
The start and end addresses may not be used in this way. They may only be used to truncate the Hex file.
However, there is a project called SRecord hosted on sourceforge.net which contains utilities to convert Intel HEX files in many ways. The free of charge Windows version 1.64 or later can be downloaded here: https://sourceforge.net/projects/srecord/files/srecord-win32
The command line utility srec_cat.exe is part of this package. It can be used to read an Intel HEX file which was created by Keil OH166. srec_cat.exe can fill up unused address areas in a certain range with a constant value. Usually a padding value of 0xFF is used which represents an erased Flash. This tool always stores Intel HEX records in ascending order.
Useful options for srec_cat:
Example: If you need an Intel HEX file which covers exactly 64K (0xC00000 and 0xC0FFFF) of code and where all gaps in this area are filled with value 0xFF, you can use the following command file:
-Disable_Sequence_Warnings #disable warning about hex records not in ascending order MyHexFile.hex #input file name -Intel #read input file in intel hex format -fill 0xFF 0xC00000 0xC0FFFF #fill gaps from 0xC00000-0xC0FFFF (64K) with value 0xFF -Output_Block_Size=16 #generate hex records with 16 byte (default 32 byte) -address-length=4 #generate extended adress records type 04 -o MyPaddedHexFile.hex #output file name -Intel #generate intel hex output file
You can then invoke srec_cat.exe with this command file:
You can execute this tool after each project build/rebuild by specifying its invocation in the µVision dialog Options for Target - User - After Build/Rebuild. You may use µVision key sequences for the invocation.The key sequence '#H' can be used for the input hex file name. When using a command file for srec_cat.exe, be sure to double the '@' character, or µVision might interpret it as a key-sequence.
Last Reviewed: Tuesday, July 17, 2018
of your data.