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 │ Check │
48 │Mark │ Length │ Offset │ Type │ │ sum │
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 Execution 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 │ Check │
103 │Mark │ Length │ Offset │ Type │ │ sum │
104 │(“:”) │ │ │ │ │ │
105 └───────┴────────┴────────┴────────┴────────┴────────┘
106 The Data Record provides a set of hexadecimal digits that represent the
107 ASCII code for data bytes that make up a portion of a memory image.
108
109 The contents of the individual fields within the record are:
110
111 Record Mark
112 This field contains 0x3A, the hexadecimal encoding of the ASCII
113 colon (“:”) character.
114
115 Record Length
116 The field contains two ASCII hexadecimal digits that specify
117 the number of 16‐bit data words in the record. The maximum
118 value is 255 decimal.
119
120 Load Offset
121 This field contains four ASCII hexadecimal digits representing
122 the word address at which the first word of the data is to be
123 placed. (For an exquivalent bytes address, double it.)
124
125 Record Type
126 This field contains 0x3030, the hexadecimal encoding of the
127 ASCII character “00”, which specifies the record type to be a
128 Data Record.
129
130 Data This field contains sets of four ASCII hexadecimal digits, one
131 set for each 16‐bit data word, most significant digit first.
132
133 Checksum
134 This field contains the check sum on the Record Length, Load
135 Offset, Record Type, and Data fields.
136
137 Execution Start Address Record
138 ┌───────┬────────┬────────┬────────┬────────┬────────┐
139 │Record │ Record │ Load │ Record │ EIP (4 │ Check │
140 │Mark │ Length │ Offset │ Type │ bytes) │ sum │
141 │(“:”) │ (4) │ (0) │ (5) │ │ │
142 └───────┴────────┴────────┴────────┴────────┴────────┘
143 The Execution Start Address Record is used to specify the execution
144 start address for the object file. This is where the loader is to jump
145 to begin execution once the hex load is complete.
146
147 The Execution Start Address Record can appear anywhere in a hexadecimal
148 object file. If such a record is not present in a hexadecimal object
149 file, a loader is free to assign a default execution start address.
150
151 The contents of the individual fields within the record are:
152
153 Record mark
154 This field contains 0x3A, the hexadecimal encoding of the ASCII
155 colon (“:”) character.
156
157 Record length
158 The field contains 0x3032, the hexadecimal encoding of the
159 ASCII characters “02”, which is the length, in bytes, of the
160 EIP register content within this record.
161
162 Load Offset
163 This field contains 0x30303030, the hexadecimal encoding of the
164 ASCII characters “0000”, since this field is not used for this
165 record.
166
167 Record Type
168 This field contains 0x3035, the hexadecimal encoding of the
169 ASCII character “05”, which specifies the record type to be a
170 Start Address Record.
171
172 EIP This field contains eight ASCII hexadecimal digits that specify
173 the address. The field is encoded big‐endian (most significant
174 digit first).
175
176 Checksum
177 This field contains the check sum on the Record length, Load
178 Offset, Record Type, and EIP fields.
179
180 End of File Record
181 This shall be the last record in the file.
182
183 ┌───────┬────────┬────────┬────────┬────────┐
184 │Record │ Record │ Load │ Record │ Check │
185 │Mark │ Length │ Offset │ Type │ sum │
186 │(“:”) │ (0) │ (0) │ (1) │ (0xFF) │
187 └───────┴────────┴────────┴────────┴────────┘
188 The End of File Record specifies the end of the hexadecimal object
189 file.
190
191 The contents of the individual fields within the record are:
192
193 Record mark
194 This field contains 0x3A, the hexadecimal encoding of the ASCII
195 colon (“:”) character.
196
197 Record Length
198 The field contains 0x3030, the hexadecimal encoding of the
199 ASCII characters “00”. Since this record does not contain any
200 Data bytes, the length is zero.
201
202 Load Offset
203 This field contains 0x30303030, the hexadecimal encoding of the
204 ASCII characters “0000”, since this field is not used for this
205 record.
206
207 Record Type
208 This field contains 0x3031, the hexadecimal encoding of the
209 ASCII character “01”, which specifies the record type to be an
210 End of File Record.
211
212 Checksum
213 This field contains the check sum an the Record Length, Load
214 Offset, and Record Type fields. Since all the fields are
215 static, the check sum can also be calculated statically, and
216 the value is 0x4646, the hexadecimal encoding of the ASCII
217 characters “FF”.
218
219 Size Multiplier
220 In general, binary data will expand in sized by approximately 2.3 times
221 when represented with this format.
222
224 Here is an example INHX16 file. It contains the data “Hello, World” to
225 be loaded at address 0.
226 :0700000065486C6C2C6F5720726F646CFF0AA8
227 :00000001FF
228
230 srec_cat version 1.64
231 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
232 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Peter Miller
233
234 The srec_cat program comes with ABSOLUTELY NO WARRANTY; for details use
235 the 'srec_cat -VERSion License' command. This is free software and you
236 are welcome to redistribute it under certain conditions; for details
237 use the 'srec_cat -VERSion License' command.
238
240 Scott Finneran E‐Mail: scottfinneran@yahoo.com.au
241 Peter Miller E‐Mail: pmiller@opensource.org.au
242
243
244
245Reference Manual SRecord srec_intel16(5)