7.2.2.2 Output HEX files
The HEX files output by Hexmate conform to the same specification described for the input files; however they are standardized in a number of ways, which are detailed in this section.
Hexmate will always write output files:
- Using upper case hexadecimal letters, even if lower cases hexadecimal letters were used in the input file.
- Without comments, regardless of whether any comments in the input files were on a line preceding a record or on a line by themselves.
- With output records in ascending Address Offset order following their corresponding base address (type 2 or type 4) record.
- With data destined for contiguous
addresses placed into as many records as possible with the Data Length specified
by the
-format
option if that option has been used or a length of 16 otherwise, then output the remainder of the data into a record with a smaller length.
The following shows how an input HEX file conforming to the INHX16 format might be
modified by Hexmate using a command similar to the following, which has Hexmate read in
the file called input.hex and output it to the file called
output.hex, ensuring it conforms to the INHX32
format.
Notice the following differences between the input and output files.
hexmate input.hex -format=inhx32 -ooutput.hex
Line # | Input HEX file | Output HEX file |
---|---|---|
1 |
%% production file |
:04000000FEEFFFF020 |
2 |
begin:04000000feeffff020 |
:104010006120737472696E670000000048656C6C03 |
3 |
:1040800050EF20F005C501F506C502F5000E046EDF
|
:1040800050EF20F005C501F506C502F5000E046EDF |
4 |
:104010006120737472696E670000000048656C6C03 |
:1040F000120074686572652C204920616D205BEFA9 |
5 |
:0240F0001200BC |
:0241000020F0AD |
6 |
:0C40F20074686572652C204920616D2007 |
:020000040001F9 |
7 |
:0440FE005BEF20F064 |
:104000000068692074686572652C204920616D2004 |
8 |
:020000021000EC |
:00000001FF |
9 |
:104000000068692074686572652C204920616D2004 |
|
10 |
||
11 |
:00000001FF |
- The whole-line comment on line 1 and the empty line (line 10) of the input file were not output.
- The in-line comment before the record on line 2 of the input was not output (the record it preceded, now appears on line 1 of the output).
- The lowercase hexadecimal letters in the record on line 2 of the input were converted to uppercase letters, as seen in line 1 of the output, where that record now appears.
- The order of lines 3 and 4 of the input were swapped to lines 3 and 2 respectively in the output, so they appear in ascending Address Offset order.
- The data contained in the records appearing on lines 3, 4, and 5 of the input were merged into one record on line 4 of the output with a length of 16 data bytes (the default length) and the remainder of the data was written into another smaller record on line 5.
- The type 2 record on line 8 of the input was replaced with a type 4 record, on line 6 of the output, and its argument value (0x1000) was converted to 0x0001, so that it specifies the same base address.