OpenCores
URL https://opencores.org/ocsvn/eco32/eco32/trunk

Subversion Repositories eco32

[/] [eco32/] [trunk/] [tools/] [bin2exo/] [srecord.html] - Blame information for rev 87

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 39 hellwig
<!DOCTYPE doctype PUBLIC "-//IETF//DTD HTML//EN">
2
<html><head>
3
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
4
  <meta name="GENERATOR" content="Internet Assistant for Word 1.0Z">
5
  <meta name="SUBJECT" content="EE/CS 373">
6
  <meta name="AUTHOR" content="Val Tareski"><title>Motorola S-record description</title></head><body>
7
<h1>
8
  <a name="top">Motorola S-records</a>
9
</h1>
10
 
11
The following fairly complete description of Motorola S-records was found
12
a number of years ago on the man pages of a UNIX system.
13
 
14
<hr>
15
 
16
NAME
17
<blockquote>
18
  srec - S-record file and record format
19
</blockquote>
20
<p>
21
DESCRIPTION
22
</p><blockquote>
23
  An S-record file consists of a sequence of specially formatted ASCII character
24
  strings. An S-record will be less than or equal to 78 bytes in length.
25
  <p>
26
  The order of S-records within a file is of no significance and no particular
27
  order may be assumed.
28
  </p><p>
29
  The general format of an S-record follows:
30
</p></blockquote>
31
<pre><tt>+-------------------//------------------//-----------------------+
32
| type | count | address  |            data           | checksum |
33
+-------------------//------------------//-----------------------+</tt>
34
</pre>
35
<blockquote>
36
  type -- A char[2] field. These characters describe the type of record (S0,
37
  S1, S2, S3, S5, S7, S8, or S9).
38
  <p>
39
  count -- A char[2] field. These characters when paired and interpreted as
40
  a hexadecimal value, display the count of remaining character pairs in the
41
  record.
42
  </p><p>
43
  address -- A char[4,6, or 8] field. These characters grouped and interpreted
44
  as a hexadecimal value, display the address at which the data field is to
45
  be loaded into memory. The length of the field depends on the number of bytes
46
  necessary to hold the address. A 2-byte address uses 4 characters, a 3-byte
47
  address uses 6 characters, and a 4-byte address uses 8 characters.
48
  </p><p>
49
  data -- A char [0-64] field. These characters when paired and interpreted
50
  as hexadecimal values represent the memory loadable data or descriptive
51
  information.
52
  </p><p>
53
  checksum -- A char[2] field. These characters when paired and interpreted
54
  as a hexadecimal value display the least significant byte of the ones complement
55
  of the sum of the byte values represented by the pairs of characters making
56
  up the count, the address, and the data fields.
57
  </p><p>
58
  Each record is terminated with a line feed. If any additional or different
59
  record terminator(s) or delay characters are needed during transmission to
60
  the target system it is the responsibility of the transmitting program to
61
  provide them.
62
  </p><p>
63
  S0 Record. The type of record is 'S0' (0x5330). The address field is unused
64
  and will be filled with zeros (0x0000). The header information within the
65
  data field is divided into the following subfields.
66
  </p><p>
67
</p><blockquote>
68
<blockquote>
69
  mname is char[20] and is the module name.<br>
70
  ver is char[2] and is the version number.<br>
71
  rev is char[2] and is the revision number.<br>
72
  description is char[0-36] and is a text comment.
73
  <p>
74
</p></blockquote>
75
  Each of the subfields is composed of ASCII bytes whose associated characters,
76
  when paired, represent one byte hexadecimal values in the case of the version
77
  and revision numbers, or represent the hexadecimal values of the ASCII characters
78
  comprising the module name and description.
79
</blockquote>
80
<p>
81
  S1 Record. The type of record field is 'S1' (0x5331). The address field is
82
  intrepreted as a 2-byte address. The data field is composed of memory loadable
83
  data.
84
  </p><p>
85
  S2 Record. The type of record field is 'S2' (0x5332). The address field is
86
  intrepreted as a 3-byte address. The data field is composed of memory loadable
87
  data.
88
  </p><p>
89
  S3 Record. The type of record field is 'S3' (0x5333). The address field is
90
  intrepreted as a 4-byte address. The data field is composed of memory loadable
91
  data.
92
  </p><p>
93
  S5 Record. The type of record field is 'S5' (0x5335). The address field is
94
  intrepreted as a 2-byte value and contains the count of S1, S2, and S3 records
95
  previously transmitted. There is no data field.
96
  </p><p>
97
  S7 Record. The type of record field is 'S7' (0x5337). The address field contains
98
  the starting execution address and is intrepreted as 4-byte address. There
99
  is no data field.
100
  </p><p>
101
  S8 Record. The type of record field is 'S8' (0x5338). The address field contains
102
  the starting execution address and is intrepreted as 3-byte address. There
103
  is no data field.
104
  </p><p>
105
  S9 Record. The type of record field is 'S9' (0x5339). The address field contains
106
  the starting execution address and is intrepreted as 2-byte address. There
107
  is no data field.
108
</p></blockquote>
109
<p>
110
EXAMPLE
111
</p><blockquote>
112
  Shown below is a typical S-record format file.
113
  <p>
114
 
115
</p><blockquote>
116
  <tt>S00600004844521B<br>
117
  S1130000285F245F2212226A000424290008237C2A<br>
118
  S11300100002000800082629001853812341001813<br>
119
  S113002041E900084E42234300182342000824A952<br>
120
  S107003000144ED492<br>
121
  S5030004F8<br>
122
  S9030000FC</tt>
123
</blockquote>
124
  <p>
125
  The file consists of one S0 record, four S1 records, one S5 record and an
126
  S9 record.
127
  </p><p>
128
  The S0 record is comprised as follows:
129
</p><ul>
130
  <li>S0 S-record type S0, indicating it is a header record.
131
  </li><li>06 Hexadecimal 06 (decimal 6), indicating that six character pairs (or ASCII
132
  bytes) follow.
133
  </li><li>00 00 Four character 2-byte address field, zeroes in this example.<br>
134
  </li><li>48 44 52 ASCII H, D, and R - "HDR".
135
  </li><li>1B The checksum.
136
 
137
</li></ul>
138
  The first S1 record is comprised as follows:
139
<ul>
140
  <li>S1 S-record type S1, indicating it is a data record to be loaded at a 2-byte
141
  address.
142
  </li><li>13 Hexadecimal 13 (decimal 19), indicating that nineteen character pairs,
143
  representing a 2 byte address, 16 bytes of binary data, and a 1 byte checksum,
144
  follow.
145
  </li><li>00 00 Four character 2-byte address field; hexidecimal address 0x0000, where
146
  the data which follows is to be loaded.
147
  </li><li>28 5F 24 5F 22 12 22 6A 00 04 24 29 00 08 23 7C Sixteen character pairs
148
  representing the actual binary data.
149
  </li><li>2A The checksum.
150
</li></ul>
151
  <p>
152
  The second and third S1 records each contain 0x13 (19) character pairs and
153
  are ended with checksums of 13 and 52, respectively. The fourth S1 record
154
  contains 07 character pairs and has a checksum of 92.
155
</p><p>
156
  The S5 record is comprised as follows:
157
</p><ul>
158
  <li>S5 S-record type S5, indicating it is a count record indicating the number
159
  of S1 records
160
  </li><li>03 Hexadecimal 03 (decimal 3), indicating that three character pairs
161
  follow.
162
  </li><li>00 04 Hexadecimal 0004 (decimal 4), indicating that there are four data records
163
  previous to this record.
164
  </li><li>F8 The checksum.
165
</li></ul>
166
<p>
167
  The S9 record is comprised as follows:
168
</p><ul>
169
  <li>S9 S-record type S9, indicating it is a termination record.
170
  </li><li>03 Hexadecimal 03 (decimal 3), indicating that three character pairs
171
  follow.
172
  </li><li>00 00 The address field, hexadecimal 0 (decimal 0) indicating the starting
173
  execution address.
174
  </li><li>FC The checksum.
175
</li></ul>
176
</blockquote>
177
<p>
178
  </p><hr>
179
<h2>
180
  Instructor Notes
181
</h2>
182
<ul>
183
  <li>
184
    There isn't any evidence that Motorola ever has made use of the header
185
    information within the data field of the S0 record, as described above. This
186
    must have been used by some third party vendors.
187
  </li><li>
188
    This is the only place that a 78-byte limit on total record length or 64-byte
189
    limit on data length is documented. These values shouldn't be trusted for
190
    the general case.
191
  </li><li>
192
    The count field can have values in the range of 0x3 (2 bytes of address +
193
    1 byte checksum = 3, a not very useful record) to 0xff; this is the count
194
    of remaining character <big><b>pairs</b></big>, including checksum.
195
  </li><li>
196
    If you write code to convert S-Records, you should always assume that a record
197
    can be as long as 514 (decimal) characters in length (255 * 2 = 510, plus
198
    4 characters for the type and count fields), plus any terminating character(s).
199
    That is, in establishing an input buffer in C, you would declare it to be
200
    an array of 515 chars, thus leaving room for the terminating null character.
201
</li></ul>
202
<p>
203
  </p><hr>
204
<a href="#top">Beginning of document</a><br>
205
</body></html>

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.