home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / m68k / 1512 < prev    next >
Encoding:
Internet Message Format  |  1993-01-07  |  10.4 KB

  1. Path: sparky!uunet!spool.mu.edu!olivea!charnel!sifon!CC.UMontreal.CA!archamba
  2. From: archamba@ERE.UMontreal.CA (Archambault Benoit)
  3. Newsgroups: comp.sys.m68k
  4. Subject: S1-S9 etc ...
  5. Message-ID: <1993Jan7.164752.28297@cc.umontreal.ca>
  6. Date: 7 Jan 93 16:47:52 GMT
  7. Sender: news@cc.umontreal.ca (Administration de Cnews)
  8. Organization: Universite de Montreal
  9. Lines: 286
  10.  
  11.  
  12.      SREC(4)                UNIX 5.0 (03/21/84)                SREC(4)
  13.  
  14.  
  15.  
  16.      NAME
  17.           srec - S-record file and record format
  18.  
  19.      DESCRIPTION
  20.           An S-record file consists of a sequence of specially
  21.           formatted ASCII character strings.  An S-record will be less
  22.           than or equal to 78 bytes in length.
  23.  
  24.           The order of S-records within a file is of no significance
  25.           and no particular order may be assumed.
  26.  
  27.           The general format of an S-record follows:
  28.  
  29.           +-------------------//------------------//-----------------------+
  30.           | type | count | address  |            data           | checksum |
  31.           +-------------------//------------------//-----------------------+
  32.  
  33.  
  34.  
  35.           type      A char[2] field.  These characters describe the
  36.                     type of record (S0, S1, S2, S3, S5, S7, S8, or
  37.                     S9).
  38.           count     A char[2] field.  These characters when paired and
  39.                     interpreted as a hexadecimal value, display the
  40.                     count of remaining character pairs in the record.
  41.  
  42.           address   A char[4,6, or 8] field.  These characters grouped
  43.                     and interpreted as a hexadecimal value, display
  44.                     the address at which the data field is to be
  45.                     loaded into memory.  The length of the field
  46.                     depends on the number of bytes necessary to hold
  47.                     the address.  A 2-byte address uses 4 characters,
  48.                     a 3-byte address uses 6 characters, and a 4-byte
  49.                     address uses 8 characters.
  50.           data      A char [0-64] field.  These characters when paired
  51.                     and interpreted as hexadecimal values represent
  52.                     the memory loadable data or descriptive
  53.                     information.
  54.  
  55.           checksum  A char[2] field.  These characters when paired and
  56.                     interpreted as a hexadecimal value display the
  57.                     least significant byte of the ones complement of
  58.                     the sum of the byte values represented by the
  59.                     pairs of characters making up the count, the
  60.                     address, and the data fields.
  61.  
  62.           Each record is terminated with a line feed.  If any
  63.           additional or different record terminator(s) or delay
  64.           characters are needed during transmission to the target
  65.           system it is the responsibility of the transmitting program
  66.           to provide them.
  67.           S0 Record  The type of record is 'S0' (0x5330).  The address
  68.  
  69.  
  70.  
  71.      Page 1                                        (last mod. 8/15/84)
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.      SREC(4)                UNIX 5.0 (03/21/84)                SREC(4)
  79.  
  80.  
  81.  
  82.                      field is unused and will be filled with zeros
  83.                      (0x0000).  The header information within the data
  84.                      field is divided into the following subfields.
  85.  
  86.                                   mname      is char[20] and is the
  87.                                              module name.
  88.                                   ver        is char[2] and is the
  89.                                              version number.
  90.  
  91.                                   rev        is char[2] and is the
  92.                                              revision number.
  93.                                   description is char[0-36] and is a
  94.                                              text comment.
  95.  
  96.                      Each of the subfields is composed of ASCII bytes
  97.                      whose associated characters, when paired,
  98.                      represent one byte hexadecimal values in the case
  99.                      of the version and revision numbers, or represent
  100.                      the hexadecimal values of the ASCII characters
  101.                      comprising the module name and description.
  102.  
  103.           S1 Record  The type of record field is 'S1' (0x5331).  The
  104.                      address field is intrepreted as a 2-byte address.
  105.                      The data field is composed of memory loadable
  106.                      data.
  107.           S2 Record  The type of record field is 'S2' (0x5332).  The
  108.                      address field is intrepreted as a 3-byte address.
  109.                      The data field is composed of memory loadable
  110.                      data.
  111.  
  112.           S3 Record  The type of record field is 'S3' (0x5333).  The
  113.                      address field is intrepreted as a 4-byte address.
  114.                      The data field is composed of memory loadable
  115.                      data.
  116.           S5 Record  The type of record field is 'S5' (0x5335).  The
  117.                      address field is intrepreted as a 2-byte value
  118.                      and contains the count of S1, S2, and S3 records
  119.                      previously transmitted.  There is no data field.
  120.  
  121.           S7 Record  The type of record field is 'S7' (0x5337).  The
  122.                      address field contains the starting execution
  123.                      address and is intrepreted as  4-byte address.
  124.                      There is no data field.
  125.           S8 Record  The type of record field is 'S8' (0x5338).  The
  126.                      address field contains the starting execution
  127.                      address and is intrepreted as  3-byte address.
  128.                      There is no data field.
  129.  
  130.           S9 Record  The type of record field is 'S9' (0x5339).  The
  131.                      address field contains the starting execution
  132.                      address and is intrepreted as  2-byte address.
  133.                      There is no data field.
  134.  
  135.  
  136.  
  137.      Page 2                                        (last mod. 8/15/84)
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.      SREC(4)                UNIX 5.0 (03/21/84)                SREC(4)
  145.  
  146.  
  147.  
  148.      EXAMPLE
  149.           Shown below is a typical S-record format file.
  150.  
  151.                  S00600004844521B
  152.                  S1130000285F245F2212226A000424290008237C2A
  153.                  S11300100002000800082629001853812341001813
  154.                  S113002041E900084E42234300182342000824A952
  155.                  S107003000144ED492
  156.                  S5030004F8
  157.                  S9030000FC
  158.  
  159.           The file consists of one S0 record, four S1 records, one S5
  160.           record and an S9 record.
  161.  
  162.           The S0 record is comprised as follows:
  163.  
  164.              S0     S-record type S0, indicating it is a header
  165.                     record.
  166.              06     Hexadecimal 06 (decimal 6), indicating that six
  167.                     character pairs (or ASCII bytes) follow.
  168.  
  169.              00 00  Four character 2-byte address field, zeroes in
  170.                     this example.
  171.              48     ASCII H, D, and R - "HDR".
  172.  
  173.              1B     The checksum.
  174.  
  175.           The first S1 record is comprised as follows:
  176.              S1     S-record type S1, indicating it is a data record
  177.                     to be loaded at a 2-byte address.
  178.  
  179.              13     Hexadecimal 13 (decimal 19), indicating that
  180.                     nineteen character pairs, representing a 2 byte
  181.                     address, 16 bytes of binary data, and a 1 byte
  182.                     checksum, follow.
  183.              00 00  Four character 2-byte address field; hexidecimal
  184.                     address 0x0000, where the data which follows is to
  185.                     be loaded.
  186.  
  187.              28 5F 24 5F 22 12 22 6A 00 04 24 29 00 08 23 7C Sixteen
  188.                     character pairs representing the actual binary
  189.                     data.
  190.              2A     The checksum.
  191.  
  192.           The second and third S1 records each contain 0x13 (19)
  193.           character pairs and are ended with checksums of 13 and 52,
  194.           respectively.  The fourth S1 record contains 07 character
  195.           pairs and has a checksum of 92.
  196.  
  197.           The S5 record is comprised as follows:
  198.  
  199.              S5     S-record type S5, indicating it is a count record
  200.                     indicating the number of S1 records.
  201.  
  202.  
  203.      Page 3                                        (last mod. 8/15/84)
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.      SREC(4)                UNIX 5.0 (03/21/84)                SREC(4)
  211.  
  212.  
  213.  
  214.              03     Hexadecimal 03 (decimal 3), indicating that three
  215.                     character pairs follow.
  216.  
  217.              00 04  Hexadecimal 0004 (decimal 4), indicating that
  218.                     there are four data records previous to this
  219.                     record.
  220.              F8     The checksum.
  221.  
  222.           The S9 record is comprised as follows:
  223.  
  224.              S9     S-record type S9, indicating it is a termination
  225.                     record.
  226.              03     Hexadecimal 03 (decimal 3), indicating that three
  227.                     character pairs follow.
  228.  
  229.              00 00  The address field, hexadecimal 0 (decimal 0)
  230.                     indicating the starting execution address.
  231.              FC     The checksum.
  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.      Page 4                                        (last mod. 8/15/84)
  270.  
  271.  
  272. A note (or minor nit)-
  273. This is the first time that *I* have ever seen the 78-byte limit on total
  274. record length or 64-byte limit on data length. I wouldn't trust those values.
  275.  
  276. Note also that the count field can have values in the range of 0x3-0xff
  277. (2 bytes of address + 1 byte checksum = 3, a not very useful record), and
  278. that this is the count of remaining character *PAIRS*, including checksum.
  279.  
  280. Whenever I write code to convert S-Records, I always assume that a record
  281. can be as long as 514(decimal) characters in length (255 * 2 = 510, plus
  282. 4 characters for the type and count fields), plus any terminating character(s).
  283. That is, in establishing an input buffer in C, I would declare it to be
  284. an array of 515 chars, and leave room for the terminating null character.
  285.  
  286. That should cover it :-)
  287. -- 
  288. Ron Widell, Field Applications Eng.    |UUCP: {...}mcdchg!motmpl!ron
  289. Motorola Semiconductor Products, Inc.,    |Voice:(612)941-6800
  290. 9600 W. 76th St., Suite G        | I'm from Silicon Tundra,
  291. Eden Prairie, Mn. 55344 -3718        | what could I know?
  292. -- 
  293. "Ribbit!"         Benoit Archambault                    Universite de Montreal 
  294.   ` /\/@\/@\/\          archamba@ERE.UMontreal.CA       C.P. 6128, Succ. A 
  295.    _\ \ -  / /_                                         Montreal, Quebec 
  296.                                                         H3C 3J6
  297.