[go: up one dir, main page]

File: srec_intel.5

package info (click to toggle)
srecord 1.39-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 3,624 kB
  • ctags: 1,822
  • sloc: cpp: 18,283; sh: 5,839; makefile: 1,701; awk: 201; vhdl: 15
file content (584 lines) | stat: -rw-r--r-- 18,426 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
'\" t
.\"     srecord - manipulate eprom load files
.\"     Copyright (C) 1998, 2000, 2001, 2006, 2007 Peter Miller
.\"
.\"     This program is free software; you can redistribute it and/or modify
.\"     it under the terms of the GNU General Public License as published by
.\"     the Free Software Foundation; either version 3 of the License, or
.\"     (at your option) any later version.
.\"
.\"     This program is distributed in the hope that it will be useful,
.\"     but WITHOUT ANY WARRANTY; without even the implied warranty of
.\"     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
.\"     GNU General Public License for more details.
.\"
.\"     You should have received a copy of the GNU General Public License
.\"     along with this program. If not, see
.\"     <http://www.gnu.org/licenses/>.
.\"
.ds n) srec_intel
.TH \*(n) 5 SRecord "Reference Manual"
.SH NAME
srec_intel \- Intel Hexadecimal object file format specification
.XX "srec_intel(5)" "Intel Hexadecimal object file format specification"
.SH DESCRIPTION
This format is also known as the \fIIntel MCS-86 Object\fP format.
.PP
This document describes the hexadecimal object file format for the Intel
8-bit, 16-bit, and 32-bit microprocessors.  The hexadecimal format is
suitable as input to PROM programmers or hardware emulators.
.PP
Hexadecimal object file format is a way of representing an absolute binary
object file in ASCII.  Because the file is in ASCII instead of binary,
it is possible to store the file is non-binary medium such as paper-tape,
punch cards, etc.; and the file can also be displayed on CRT terminals,
line printers, etc..  The 8-bit hexadecimal object file format allows for
the placement of code and data within the 16-bit linear address space
of the Intel 8-bit processors.  The 16-bit hexadecimal format allows
for the 20-bit segmented address space of the Intel 16-bit processors.
And the 32-bit format allows for the 32-bit linear address space of the
Intel 32-bit processors.
.PP
The hexadecimal representation of binary is coded in ASCII alphanumeric
characters.  For example, the 8-bit binary value 0011-1111 is 3F in
hexadecimal.  To code this in ASCII, one 8-bit byte containing the
ASCII code for the character '3' (0011-0011 or 0x33) and one 8-bit
byte containing the) ASCII code for the character 'F' (0100-0110 or
0x46) are required.  For each byte value, the high-order hexadecimal
digit is always the first digit of the pair of hexadecimal digits.
This representation (ASCII hexadecimal) requires twice as many bytes
as the binary representation.
.PP
A hexadecimal object file is blocked into records, each of which contains
the record type, length, memory load address and checksum in addition
to the data.  There are currently six (6) different types of records
that are defined, not all combinations of these records are meaningful,
however.  The record are:
.TP 2n
\(bu
Data Record (8-, 16-, or 32-bit formats)
.TP 2n
\(bu
End of File Record (8-, 16-, or 32-bit formats)
.TP 2n
\(bu
Extended Segment Address Record (16- or 32-bit formats)
.TP 2n
\(bu
Start Segment Address Record (16- or 32-bit formats)
.TP 2n
\(bu
Extended Linear Address Record (32-bit format only)
.TP 2n
\(bu
Start Linear Address Record (32-bit format only)
.SS General Record Format
.TS
allbox,tab(;);
lw(0.6i) lw(0.6i) lw(0.6i) lw(0.6i) l l.
T{
Record Mark
T};T{
Record Length
T};T{
Load Offset
T};T{
Record Type
T};Data;Checksum
.TE
.TP 8n
Record Mark.
Each record begins with a Record Mark field containing 0x3A, the ASCII
code for the colon (``:'') character.
.TP 8n
Record Length
Each record has a Record Length field which specifies the number of bytes
of information or data which follows the Record Type field of the record.
This field is one byte, represented as two hexadecimal characters.
The maximum value of the Record Length field is hexadecimal 'FF' or 255.
.TP 8n
Load Offset
Each record has a Load Offset field which specifies the 16-bit starting
load offset of the data bytes, therefore this field is only used for
Data Records.  In other records where this field is not used, it should
be coded as four ASCII zero characters (``0000'' or 0x30303030).
This field is two byte, represented as four hexadecimal characters.
.TP 8n
Record Type
.RS
Each record has a Record Type field which specifies the record type of
this record.  The Record Type field is used to interpret the remaining
information within the record.  This field is one byte, represented as
two hexadecimal characters.  The encoding for all the current record
types are:
.TP 3n
0
Data Record
.TP 3n
1
End of File Record
.TP 3n
2
Extended Segment Address Record
.TP 3n
3
Start Segment Address Record
.TP 3n
4
Extended Linear Address Record
.TP 3n
5
Start Linear Address Record
.RE
.TP 8n
Data
Each record has a variable length Data field, it consists of zero or
more bytes encoded as pairs of hexadecimal digits.  The interpretation
of this field depends on the Record Type field.
.TP 8n
Checksum
Each record ends with a Checksum field that contains the ASCII hexadecimal
representation of the two's complement of  the 8-bit bytes that result
from converting each pair of ASCII hexadecimal digits to one byte of
binary, from and including the Record Length field to and including the
last byte of the Data field.  Therefore, the sum of all the ASCII pairs
in a record after converting to binary, from the Record Length field to
and including the Checksum field, is zero.
.SS Extended Linear Address Record
(32-bit format only)
.TS
allbox,tab(;);
lw(0.6i) lw(0.6i) lw(0.6i) lw(0.6i) l l.
T{
Record Mark
(``:'')
T};T{
Record Length
(2)
T};T{
Load Offset
(0)
T};T{
Record Type
(4)
T};T{
ULBA
.br
(2 bytes)
T};Checksum
.TE
The 32-bit Extended Linear Address Record is used to specify bits 16-31
of the Linear Base Address (LBA), where bits 0-15 of the LBA are zero.
Bits 16-31 of the LBA are referred to as the Upper Linear Base Address
(ULBA).  The absolute memory address of a content byte in a subsequent
Data Record is) obtained by adding the LBA to an offset calculated by
adding the Load Offset field of the containing Data Record to the index of
the byte in the Data Record (0, 1, 2, ... \fIn\fP).  This offset addition
is done) modulo 4G (\fIi.e.\fP 32-bits from 0xFFFFFFFF to 0x00000000)
results in wrapping around from the end to the beginning of the 4G linear
address defined by the LBA.  The linear address at which a particular
byte is loaded is calculated as:
.RS
(LBA + DRLO + DRI) MOD 4G
.RE
where:
.RS
.TP 5m
DRLO
is the Load Offset field of a Data Record.
.TP 5m
DRI
is the data byte index within the Data Record.
.RE
When an Extended Linear Address Record defines the value of LBA,
it may appear anywhere within a 32-bit hexadecimal object file. This
value remains in effect until another Extended Linear Address Record is
encountered.  The LBA defaults to zero until an Extended Linear Address
Record is encountered.  The contents of the individual fields within
the record are:
.TP 8n
Record Mark
This field contains 0x3A, the hexadecimal encoding of the ASCII colon
(``:'') character.
.TP 8n
Record Length
The field contains 0x3032, the hexadecimal encoding of the ASCII
characters ``02'', which is the length, in bytes, of the ULBA data
information within this record.
.TP 8n
Load Offset
This field contains 0x30303030, the hexadecimal encoding of the ASCII
characters ``0000'', since this field is not used for this record.
.TP 8n
Record Type
This field contains 0x3034, the hexadecimal encoding of the ASCII
character ``04'', which specifies the record type to be an Extended
Linear Address Record.
.TP 8n
ULBA
This field contains four ASCII hexadecimal digits that specify the 16-bit
Upper Linear Base Address value.  The value is encoded big-endian (most
significant digit first).
.TP 8n
Checksum
This field contains the check sum on the Record Length, Load Offset,
Record Type, and ULBA fields.
.SS Extended Segment Address Record
(16- or 32-bit formats)
.TS
allbox,tab(;);
lw(0.6i) lw(0.6i) lw(0.6i) lw(0.6i) l l.
T{
Record Mark
(``:'')
T};T{
Record Length
(2)
T};T{
Load Offset
(0)
T};T{
Record Type
(2)
T};T{
USBA
.br
(2 bytes)
T};Checksum
.TE
The 16-bit Extended Segment Address Record is used to specify bits 4-19
of the Segment Base Address (SBA), where bits 0-3 of the SBA are zero.
Bits 4-19 of the SBA are referred to as the Upper Segment Base Address
(USBA).  The absolute memory address of a content byte in a subsequent
Data Record is) obtained by adding the SBA to an offset calculated by
adding the Load Offset field of the containing Data Record to the index
of the byte in the Data Record (0, 1, 2, ... \fIn\fP).  This offset
addition is done modulo 64K (\fIi.e.\fP 16-bits from 0xFFFF to 0x0000
results in wrapping around from the end to the beginning of the 64K
segment defined by the SBA.  The address at which a particular byte is
loaded is calculated as:
.RS
SBA + ((DRLO + DRI) MOD 64K)
.RE
where:
.RS
.TP 5m
DRLO
is the LOAD OFFSET field of a Data Record.
.TP 5m
DRI
is the data byte index within the Data Record.
.RE
.PP
When an Extended Segment Address Record defines the value of SBA,
it may appear anywhere within a 16-bit hexadecimal object file.
This value remains in effect until another Extended Segment Address
Record is encountered.  The SBA defaults to zero until an Extended
Segment Address Record is encountered.
.PP
The contents of the individual fields within the record are:
.TP 8n
Record Mark
This field contains 0x3A, the hexadecimal encoding of the ASCII colon
(``:'') character.
.TP 8n
Record Length
The field contains 0x3032, the hexadecimal encoding of the ASCII
characters '02', which is the length, in bytes, of the USBA data
information within this record.
.TP 8n
Load Offset
This field contains 0x30303030, the hexadecimal encoding of the ASCII
characters '0000', since this field is not used for this record.
.TP 8n
Record Type
This field contains 0x3032, the hexadecimal encoding of the ASCII
character ``02'', which specifies the record type to be an Extended
Segment Address Record.
.TP 8n
USBA
This field contains four ASCII hexadecimal digits that specify the
16-bit Upper Segment Base Address value.  The field is encoded big-endian
(most significant digit first).
.TP 8n
Checksum
This field contains the check sum on the Record length, Load Offset,
Record Type, and USBA fields.
.SS Data Record
(8-, 16- or 32-bit formats)
.TS
allbox,tab(;);
lw(0.6i) lw(0.6i) lw(0.6i) lw(0.6i) l l.
T{
Record Mark
.br
(``:'')
T};T{
Record Length
T};T{
Load Offset
T};T{
Record Type
T};Data;Checksum
.TE
The Data Record provides a set of hexadecimal digits that represent
the ASCII code for data bytes that make up a portion of a memory image.
The method for calculating the absolute address (linear in the 8-bit and
32-bit case and segmented in the 16-bit case) for each byte of data is
described in the discussions of the Extended Linear Address Record and
the Extended Segment Address Record.
.PP
The contents of the individual fields within the record are:
.TP 8n
Record Mark
This field contains 0x3A, the hexadecimal encoding of the ASCII colon
(``:'') character.
.TP 8n
Record Length
The field contains two ASCII hexadecimal digits that specify the number
of data bytes in the record.  The maximum value is 255 decimal.
.TP 8n
Load Offset
This field contains four ASCII hexadecimal digits representing the offset
from the LBA (see Extended Linear Address Record see Extended Segment
Address Record) defining the address which the first byte of the data
is to be placed.
.TP 8n
Record Type
This field contains 0x3030, the hexadecimal encoding of the ASCII
character ``00'', which specifies the record type to be a Data Record.
.TP 8n
Data
This field contains pairs of ASCII hexadecimal digits, one pair for each
data byte.
.TP 8n
Checksum
This field contains the check sum on the Record Length, Load Offset,
Record Type, and Data fields.
.SS Start Linear Address Record
(32-bit format only)
.TS
allbox,tab(;);
lw(0.6i) lw(0.6i) lw(0.6i) lw(0.6i) l l.
T{
Record Mark
.br
(``:'')
T};T{
Record Length
(4)
T};T{
Load Offset
(0)
T};T{
Record Type
(5)
T};T{
EIP
.br
(4 bytes)
T};Checksum
.TE
The Start Linear Address Record is used to specify the execution start
address for the object file.  The value given is the 32-bit linear
address for the EIP register.  Note that this record only specifies
the code address within the 32-bit linear address space of the 80386.
If the code is to start execution in the real mode of the 80386, then the
Start Segment Address Record should be used instead, since that record
specifies both the CS and IP register contents necessary for real mode.
.PP
The Start Linear Address Record can appear anywhere in a 32-bit
hexadecimal object file.  If such a record is not present in a hexadecimal
object file, a loader is free to assign a default start address.
.PP
The contents of the individual fields within the record are:
.TP 8n
Record mark
This field contains 0x3A, the hexadecimal encoding of the ASCII colon
(``:'') character.
.TP 8n
Record length
The field contains 0x3034, the hexadecimal encoding of the ASCII
characters ``04'', which is the length, in bytes, of the EIP register
content within this record.
.TP 8n
Load Offset
This field contains 0x30303030, the hexadecimal encoding of the ASCII
characters ``0000'', since this field is not used for this record.
.TP 8n
Record Type
This field contains 0x3035, the hexadecimal encoding of the ASCII
character ``05'', which specifies the record type to be a Start Linear
Address Record.
.TP 8n
EIP
This field contains eight ASCII hexadecimal digits that specify the
32-bit EIP register contents.  The field is encoded big-endian (most
significant digit first).
.TP
Checksum
This field contains the check sum on the Record length, Load Offset,
Record Type, and EIP fields.
.SS Start Segment Address Record
(16- or 32-bit formats)
.TS
allbox,tab(;);
lw(0.6i) lw(0.6i) lw(0.6i) lw(0.6i) l l l.
T{
Record Mark
(``:'')
T};T{
Record Length
(4)
T};T{
Load Offset
(0)
T};T{
Record Type
(3)
T};T{
CS
(2 bytes)
T};T{
IP
(2 bytes)
T};Checksum
.TE
The Start Segment Address Record is used to specify the execution
start address for the object file.  The value given is the 20-bit
segment address for the CS and IP registers.  Note that this record only
specifies the code address within the 20-bit segmented address space of
the 8086/80186.  The Start Segment Address Record can appear anywhere
in a 16-bit hexadecimal object file.   If such a record is not present
in a hexadecimal object file, a loader is free to assign a default
start address.
.PP
The contents of the individual fields within the record are:
.TP 8n
Record Mark
This field contains 0x3A, the hexadecimal encoding of the ASCII colon
(``:'') character.
.TP 8n
Record Length
The field contains 0x3034, the hexadecimal encoding of the ASCII
characters ``04'', which is the length, in bytes, of the CS and IP register
contents within this record.
.TP 8n
Load Offset
This field contains 0x30303030, the hexadecimal encoding of the ASCII
characters ``0000'', since this field is not used for this record.
.TP 8n
Record Type
This field contains 0x3033, the hexadecimal encoding of the ASCII
character '03', which specifies the record type to be a Start Segment
Address Record.
.TP 8n
CS
This field contains four ASCII hexadecimal digits that specify the 16-bit
CS register contents.  The field is encoded big-endian (most significant
digit first).
.TP 8n
IP
This field contains four ASCII hexadecimal digits that specify the 16-bit
IP register contents.  The field is encoded big-endian (most significant
digit first).
.TP 8n
Checksum
This field contains the check sum on the Record length, Load Offset,
Record Type, CS, and IP fields.
.SS End of File Record
(8-, 16-, or 32-bit formats)
.TS
allbox,tab(;);
lw(0.6i) lw(0.6i) lw(0.6i) lw(0.6i) l.
T{
Record Mark
(``:'')
T};T{
Record Length
(0)
T};T{
Load Offset
(0)
T};T{
Record Type
(1)
T};T{
Checksum
(0xFF)
T}
.TE
The End of File Record specifies the end of the hexadecimal object file.
.PP
The contents of the individual fields within the record are:
.TP 8n
Record mark
This field contains 0x3A, the hexadecimal encoding of the ASCII colon
(``:'') character.
.TP 8n
Record Length
The field contains 0x3030, the hexadecimal encoding of the ASCII
characters ``00''.  Since this record does not contain any Data bytes,
the length is zero.
.TP 8n
Load Offset
This field contains 0x30303030, the hexadecimal encoding of the ASCII
characters ``0000'', since this field is not used for this record.
.TP 8n
Record Type
This field contains 0x3031, the hexadecimal encoding of the ASCII
character ``01'', which specifies the record type to be an End of File
Record.
.TP 8n
Checksum
This field contains the check sum an the Record Length, Load Offset,
and Record Type fields.  Since all the fields are static, the check
sum can also be calculated statically, and the value is 0x4646, the
hexadecimal encoding of the ASCII characters ``FF''.
.SS Size Multiplier
In general, binary data will expand in sized by approximately 2.3 times
when represented with this format.
.\" ------------------------------------------------------------------------
.br
.ne 2i
.SH EXAMPLE
Here is an example Intel hex file.
It contains the data ``Hello, World'' to be loaded at address 0.
.RS
.nf
.ft CW
:0D00000048656C6C6F2C20576F726C640AA1
:00000001FF
.ft P
.fi
.RE
.\" ------------------------------------------------------------------------
.br
.ne 2i
.SH REFERENCE
This information comes (very indirectly) from
.I "Microprocessors and Programmed Logic,"
Second Edition,
Kenneth L. Short,
1987,
Prentice-Hall,
ISBN 0-13-580606-2.
.\" ------------------------------------------------------------------------
.ds n) srec_cat
.so ../man1/z_copyright.so
.SS Derivation
This manual page is derived from a file marked as follows:
.PP
Intel
Hexadecimal Object File
Format Specification;
Revision A, 1/6/88
.PP
Disclaimer:
Intel makes no representation or warranties with respect to the
contents hereof and specifically disclaims any implied warranties of
merchantability or fitness for any particular purpose.  Further, Intel
reserves the right to revise this publication from time to time in the
content hereof without obligation of Intel to notify any person of such
revision or changes.  The publication of this specification should not
be construed as a commitment on Intel's part to implement any product.