1srec_intel16(5) File Formats Manual srec_intel16(5)
2
3
4
6 srec_intel16 - Intel Hexadecimal 16-bit file format specification
7
9 This format is also known as the INHX16 format.
10
11 This document describes the hexadecimal object file format for 16-bit
12 microprocessors.
13
14 This format is very similar to the srec_intel(5) format, except that
15 the addresses are word addresses. The count field is a word count.
16
17 The hexadecimal representation of binary is coded in ASCII alphanumeric
18 characters. For example, the 8-bit binary value 0011-1111 is 3F in
19 hexadecimal. To code this in ASCII, one 8-bit byte containing the
20 ASCII code for the character '3' (0011-0011 or 0x33) and one 8-bit byte
21 containing the) ASCII code for the character 'F' (0100-0110 or 0x46)
22 are required. For each byte value, the high-order hexadecimal digit is
23 always the first digit of the pair of hexadecimal digits. This repre‐
24 sentation (ASCII hexadecimal) requires twice as many bytes as the
25 binary representation.
26
27 A hexadecimal object file is blocked into records, each of which con‐
28 tains the record type, length, memory load address and checksum in
29 addition to the data. There are currently six (6) different types of
30 records that are defined, not all combinations of these records are
31 meaningful, however. The record are:
32
33 · Data Record
34
35 · End of File Record
36
37 · Extended Segment Address Record
38
39 · Start Segment Address Record
40
41 · Extended Linear Address Record
42
43 · Start Linear Address Record
44
45 General Record Format
46 ┌───────┬────────┬────────┬────────┬──────┬──────────┐
47 │Record │ Record │ Load │ Record │ Data │ Checksum │
48 │Mark │ Length │ Offset │ Type │ │ │
49 └───────┴────────┴────────┴────────┴──────┴──────────┘
50 Record Mark.
51 Each record begins with a Record Mark field containing 0x3A,
52 the ASCII code for the colon (``:'') character.
53
54 Record Length
55 Each record has a Record Length field which specifies the num‐
56 ber of 16-bit words of information or data which follows the
57 Record Type field of the record. This field is one byte, rep‐
58 resented as two hexadecimal characters. The maximum value of
59 the Record Length field is hexadecimal 'FF' or 255.
60
61 Load Offset
62 Each record has a Load Offset field which specifies the 16-bit
63 starting load offset of the data words, therefore this field is
64 only used for Data Records (if the words are loaded as bytes,
65 the address needs to be doubled). In other records where this
66 field is not used, it should be coded as four ASCII zero char‐
67 acters (``0000'' or 0x30303030). This field one 16-bit word,
68 represented as four hexadecimal characters.
69
70 Record Type
71 Each record has a Record Type field which specifies the record
72 type of this record. The Record Type field is used to inter‐
73 pret the remaining information within the record. This field
74 is one byte, represented as two hexadecimal characters. The
75 encoding for all the current record types are:
76
77 0 Data Record
78
79 1 End of File Record
80
81 5 Start Address Record
82
83 Data Each record has a variable length Data field, it consists of
84 zero or more 16-bit words encoded as set of 4 hexadecimal dig‐
85 its, most significant digit first. The interpretation of this
86 field depends on the Record Type field.
87
88 Checksum
89 Each record ends with a Checksum field that contains the ASCII
90 hexadecimal representation of the two's complement of the
91 8-bit bytes that result from converting each pair of ASCII
92 hexadecimal digits to one byte of binary, from and including
93 the Record Length field to and including the last byte of the
94 Data field. Therefore, the sum of all the ASCII pairs in a
95 record after converting to binary, from the Record Length field
96 to and including the Checksum field, is zero.
97
98 Data Record
99 (8-, 16- or 32-bit formats)
100
101 ┌────────┬────────┬────────┬────────┬──────┬──────────┐
102 │Record │ Record │ Load │ Record │ Data │ Checksum │
103 │Mark │ Length │ Offset │ Type │ │ │
104 │(``:'') │ │ │ │ │ │
105 └T─h─e──D─a─t─a─┴R─e─c─o─r─d──p─r┴o─v─i─d─e─s──a─┴s─e─t──o─f──h─e┴x─a─d─e─c─i─m┴a─l──d─i─g─i─t─s──t┘hat represent the
106 ASCII code for data bytes that make up a portion of a memory image.
107
108 The contents of the individual fields within the record are:
109
110 Record Mark
111 This field contains 0x3A, the hexadecimal encoding of the ASCII
112 colon (``:'') character.
113
114 Record Length
115 The field contains two ASCII hexadecimal digits that specify
116 the number of 16-bit data words in the record. The maximum
117 value is 255 decimal.
118
119 Load Offset
120 This field contains four ASCII hexadecimal digits representing
121 the word address at which the first word of the data is to be
122 placed. (For an exquivalent bytes address, double it.)
123
124 Record Type
125 This field contains 0x3030, the hexadecimal encoding of the
126 ASCII character ``00'', which specifies the record type to be a
127 Data Record.
128
129 Data This field contains sets of four ASCII hexadecimal digits, one
130 set for each 16-bit data word, most significant digit first.
131
132 Checksum
133 This field contains the check sum on the Record Length, Load
134 Offset, Record Type, and Data fields.
135
136 Start Address Record
137 ┌────────┬────────┬────────┬────────┬───────────┬──────────┐
138 │Record │ Record │ Load │ Record │ EIP │ Checksum │
139 │Mark │ Length │ Offset │ Type │ (4 bytes) │ │
140 │(``:'') │ (4) │ (0) │ (5) │ │ │
141 └T─h─e──S─t─a─r─t┴─A─d─d─r─e─s─s─┴R─e─c─o─r─d──i─s┴─u─s─e─d──t─o─┴s─p─e─c─i─f─y──t─h─e─┴e─x─e─c─u─t─i─o─n──s┘tart address
142 for the object file.
143
144 The Start Address Record can appear anywhere in a hexadecimal object
145 file. If such a record is not present in a hexadecimal object file, a
146 loader is free to assign a default start address.
147
148 The contents of the individual fields within the record are:
149
150 Record mark
151 This field contains 0x3A, the hexadecimal encoding of the ASCII
152 colon (``:'') character.
153
154 Record length
155 The field contains 0x3032, the hexadecimal encoding of the
156 ASCII characters ``02'', which is the length, in bytes, of the
157 EIP register content within this record.
158
159 Load Offset
160 This field contains 0x30303030, the hexadecimal encoding of the
161 ASCII characters ``0000'', since this field is not used for
162 this record.
163
164 Record Type
165 This field contains 0x3035, the hexadecimal encoding of the
166 ASCII character ``05'', which specifies the record type to be a
167 Start Address Record.
168
169 EIP This field contains eight ASCII hexadecimal digits that specify
170 the address. The field is encoded big-endian (most significant
171 digit first).
172
173 Checksum
174 This field contains the check sum on the Record length, Load
175 Offset, Record Type, and EIP fields.
176
177 End of File Record
178 This shall be the last record in the file.
179
180 ┌────────┬────────┬────────┬────────┬──────────┐
181 │Record │ Record │ Load │ Record │ Checksum │
182 │Mark │ Length │ Offset │ Type │ (0xFF) │
183 │(``:'') │ (0) │ (0) │ (1) │ │
184 └T─h─e──E─n─d──o┴f──F─i─l─e──R─e┴c─o─r─d──s─p─e─c┴i─f─i─e─s──t─h─e┴──e─n─d───o─f──┘the hexadecimal object
185 file.
186
187 The contents of the individual fields within the record are:
188
189 Record mark
190 This field contains 0x3A, the hexadecimal encoding of the ASCII
191 colon (``:'') character.
192
193 Record Length
194 The field contains 0x3030, the hexadecimal encoding of the
195 ASCII characters ``00''. Since this record does not contain
196 any Data bytes, the length is zero.
197
198 Load Offset
199 This field contains 0x30303030, the hexadecimal encoding of the
200 ASCII characters ``0000'', since this field is not used for
201 this record.
202
203 Record Type
204 This field contains 0x3031, the hexadecimal encoding of the
205 ASCII character ``01'', which specifies the record type to be
206 an End of File Record.
207
208 Checksum
209 This field contains the check sum an the Record Length, Load
210 Offset, and Record Type fields. Since all the fields are
211 static, the check sum can also be calculated statically, and
212 the value is 0x4646, the hexadecimal encoding of the ASCII
213 characters ``FF''.
214
215 Size Multiplier
216 In general, binary data will expand in sized by approximately 2.3 times
217 when represented with this format.
218
220 Here is an example INHX16 file. It contains the data ``Hello, World''
221 to be loaded at address 0.
222 :0700000065486C6C2C6F5720726F646CFF0AA8
223 :00000001FF
224
226 srec_cat version 1.35
227 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
228 2007 Peter Miller
229
230 The srec_cat program comes with ABSOLUTELY NO WARRANTY; for details use
231 the 'srec_cat -VERSion License' command. This is free software and you
232 are welcome to redistribute it under certain conditions; for details
233 use the 'srec_cat -VERSion License' command.
234
236 Peter Miller E-Mail: millerp@canb.auug.org.au
237 /\/\* WWW: http://www.canb.auug.org.au/~millerp/
238
239
240
241Reference Manual SRecord srec_intel16(5)