home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / m68k / 1617 < prev    next >
Encoding:
Text File  |  1993-01-21  |  10.7 KB  |  309 lines

  1. Newsgroups: comp.sys.m68k
  2. Path: sparky!uunet!keinstr!chaplin
  3. From: chaplin@keinstr.uucp (Roger Chaplin)
  4. Subject: Re: S-Record types
  5. Message-ID: <1993Jan21.133943.2372@keinstr.uucp>
  6. Organization: Keithley Instruments, Cleveland, Ohio
  7. X-Newsreader: TIN [version 1.1 PL8]
  8. References: <969@quirm.terminus.ericsson.se>
  9. Date: Thu, 21 Jan 1993 13:39:43 GMT
  10. Lines: 297
  11.  
  12. Steve Langstaff (srl@terminus.ericsson.se) wrote:
  13. : This may not be the correct newsgroup for this question, if so then sorry.
  14.  
  15. : Could anyone fill out the following table of Motorola S-Record types:
  16.  
  17. Here is something I found on one newgroup or another (maybe this one B-)
  18. a while back, posted by someone at Motorola (credit at the end).
  19.  
  20. ----------------------------- begin included text -----------------------------
  21.      SREC(4)                UNIX 5.0 (03/21/84)                SREC(4)
  22.  
  23.  
  24.  
  25.      NAME
  26.           srec - S-record file and record format
  27.  
  28.      DESCRIPTION
  29.           An S-record file consists of a sequence of specially
  30.           formatted ASCII character strings.  An S-record will be less
  31.           than or equal to 78 bytes in length.
  32.  
  33.           The order of S-records within a file is of no significance
  34.           and no particular order may be assumed.
  35.  
  36.           The general format of an S-record follows:
  37.  
  38.           +-------------------//------------------//-----------------------+
  39.           | type | count | address  |            data           | checksum |
  40.           +-------------------//------------------//-----------------------+
  41.  
  42.  
  43.  
  44.           type      A char[2] field.  These characters describe the
  45.                     type of record (S0, S1, S2, S3, S5, S7, S8, or
  46.                     S9).
  47.           count     A char[2] field.  These characters when paired and
  48.                     interpreted as a hexadecimal value, display the
  49.                     count of remaining character pairs in the record.
  50.  
  51.           address   A char[4,6, or 8] field.  These characters grouped
  52.                     and interpreted as a hexadecimal value, display
  53.                     the address at which the data field is to be
  54.                     loaded into memory.  The length of the field
  55.                     depends on the number of bytes necessary to hold
  56.                     the address.  A 2-byte address uses 4 characters,
  57.                     a 3-byte address uses 6 characters, and a 4-byte
  58.                     address uses 8 characters.
  59.           data      A char [0-64] field.  These characters when paired
  60.                     and interpreted as hexadecimal values represent
  61.                     the memory loadable data or descriptive
  62.                     information.
  63.  
  64.           checksum  A char[2] field.  These characters when paired and
  65.                     interpreted as a hexadecimal value display the
  66.                     least significant byte of the ones complement of
  67.                     the sum of the byte values represented by the
  68.                     pairs of characters making up the count, the
  69.                     address, and the data fields.
  70.  
  71.           Each record is terminated with a line feed.  If any
  72.           additional or different record terminator(s) or delay
  73.           characters are needed during transmission to the target
  74.           system it is the responsibility of the transmitting program
  75.           to provide them.
  76.           S0 Record  The type of record is 'S0' (0x5330).  The address
  77.  
  78.  
  79.  
  80.      Page 1                                        (last mod. 8/15/84)
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.      SREC(4)                UNIX 5.0 (03/21/84)                SREC(4)
  88.  
  89.  
  90.  
  91.                      field is unused and will be filled with zeros
  92.                      (0x0000).  The header information within the data
  93.                      field is divided into the following subfields.
  94.  
  95.                                   mname      is char[20] and is the
  96.                                              module name.
  97.                                   ver        is char[2] and is the
  98.                                              version number.
  99.  
  100.                                   rev        is char[2] and is the
  101.                                              revision number.
  102.                                   description is char[0-36] and is a
  103.                                              text comment.
  104.  
  105.                      Each of the subfields is composed of ASCII bytes
  106.                      whose associated characters, when paired,
  107.                      represent one byte hexadecimal values in the case
  108.                      of the version and revision numbers, or represent
  109.                      the hexadecimal values of the ASCII characters
  110.                      comprising the module name and description.
  111.  
  112.           S1 Record  The type of record field is 'S1' (0x5331).  The
  113.                      address field is intrepreted as a 2-byte address.
  114.                      The data field is composed of memory loadable
  115.                      data.
  116.           S2 Record  The type of record field is 'S2' (0x5332).  The
  117.                      address field is intrepreted as a 3-byte address.
  118.                      The data field is composed of memory loadable
  119.                      data.
  120.  
  121.           S3 Record  The type of record field is 'S3' (0x5333).  The
  122.                      address field is intrepreted as a 4-byte address.
  123.                      The data field is composed of memory loadable
  124.                      data.
  125.           S5 Record  The type of record field is 'S5' (0x5335).  The
  126.                      address field is intrepreted as a 2-byte value
  127.                      and contains the count of S1, S2, and S3 records
  128.                      previously transmitted.  There is no data field.
  129.  
  130.           S7 Record  The type of record field is 'S7' (0x5337).  The
  131.                      address field contains the starting execution
  132.                      address and is intrepreted as  4-byte address.
  133.                      There is no data field.
  134.           S8 Record  The type of record field is 'S8' (0x5338).  The
  135.                      address field contains the starting execution
  136.                      address and is intrepreted as  3-byte address.
  137.                      There is no data field.
  138.  
  139.           S9 Record  The type of record field is 'S9' (0x5339).  The
  140.                      address field contains the starting execution
  141.                      address and is intrepreted as  2-byte address.
  142.                      There is no data field.
  143.  
  144.  
  145.  
  146.      Page 2                                        (last mod. 8/15/84)
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.      SREC(4)                UNIX 5.0 (03/21/84)                SREC(4)
  154.  
  155.  
  156.  
  157.      EXAMPLE
  158.           Shown below is a typical S-record format file.
  159.  
  160.                  S00600004844521B
  161.                  S1130000285F245F2212226A000424290008237C2A
  162.                  S11300100002000800082629001853812341001813
  163.                  S113002041E900084E42234300182342000824A952
  164.                  S107003000144ED492
  165.                  S5030004F8
  166.                  S9030000FC
  167.  
  168.           The file consists of one S0 record, four S1 records, one S5
  169.           record and an S9 record.
  170.  
  171.           The S0 record is comprised as follows:
  172.  
  173.              S0     S-record type S0, indicating it is a header
  174.                     record.
  175.              06     Hexadecimal 06 (decimal 6), indicating that six
  176.                     character pairs (or ASCII bytes) follow.
  177.  
  178.              00 00  Four character 2-byte address field, zeroes in
  179.                     this example.
  180.              48     ASCII H, D, and R - "HDR".
  181.  
  182.              1B     The checksum.
  183.  
  184.           The first S1 record is comprised as follows:
  185.              S1     S-record type S1, indicating it is a data record
  186.                     to be loaded at a 2-byte address.
  187.  
  188.              13     Hexadecimal 13 (decimal 19), indicating that
  189.                     nineteen character pairs, representing a 2 byte
  190.                     address, 16 bytes of binary data, and a 1 byte
  191.                     checksum, follow.
  192.              00 00  Four character 2-byte address field; hexidecimal
  193.                     address 0x0000, where the data which follows is to
  194.                     be loaded.
  195.  
  196.              28 5F 24 5F 22 12 22 6A 00 04 24 29 00 08 23 7C Sixteen
  197.                     character pairs representing the actual binary
  198.                     data.
  199.              2A     The checksum.
  200.  
  201.           The second and third S1 records each contain 0x13 (19)
  202.           character pairs and are ended with checksums of 13 and 52,
  203.           respectively.  The fourth S1 record contains 07 character
  204.           pairs and has a checksum of 92.
  205.  
  206.           The S5 record is comprised as follows:
  207.  
  208.              S5     S-record type S5, indicating it is a count record
  209.                     indicating the number of S1 records.
  210.  
  211.  
  212.      Page 3                                        (last mod. 8/15/84)
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.      SREC(4)                UNIX 5.0 (03/21/84)                SREC(4)
  220.  
  221.  
  222.  
  223.              03     Hexadecimal 03 (decimal 3), indicating that three
  224.                     character pairs follow.
  225.  
  226.              00 04  Hexadecimal 0004 (decimal 4), indicating that
  227.                     there are four data records previous to this
  228.                     record.
  229.              F8     The checksum.
  230.  
  231.           The S9 record is comprised as follows:
  232.  
  233.              S9     S-record type S9, indicating it is a termination
  234.                     record.
  235.              03     Hexadecimal 03 (decimal 3), indicating that three
  236.                     character pairs follow.
  237.  
  238.              00 00  The address field, hexadecimal 0 (decimal 0)
  239.                     indicating the starting execution address.
  240.              FC     The checksum.
  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.      Page 4                                        (last mod. 8/15/84)
  279.  
  280.  
  281. A note (or minor nit)-
  282. This is the first time that *I* have ever seen the 78-byte limit on total
  283. record length or 64-byte limit on data length. I wouldn't trust those values.
  284.  
  285. Note also that the count field can have values in the range of 0x3-0xff
  286. (2 bytes of address + 1 byte checksum = 3, a not very useful record), and
  287. that this is the count of remaining character *PAIRS*, including checksum.
  288.  
  289. Whenever I write code to convert S-Records, I always assume that a record
  290. can be as long as 514(decimal) characters in length (255 * 2 = 510, plus
  291. 4 characters for the type and count fields), plus any terminating character(s).
  292. That is, in establishing an input buffer in C, I would declare it to be
  293. an array of 515 chars, and leave room for the terminating null character.
  294.  
  295. That should cover it :-)
  296.  
  297. The above was keyed in by and a tip of the hat to:
  298.  
  299. Ron Widell, Field Applications Eng.     |UUCP: {...}mcdchg!motmpl!ron
  300. Motorola Semiconductor Products, Inc.
  301. ------------------------------ end included text ------------------------------
  302.  
  303.  
  304. -- 
  305. Roger Chaplin / chaplin@keinstr.uucp / CI$: 76307,3506
  306. "For the lines are long and the fighting is strong and they're breakin'
  307. down the distance between right and wrong."
  308.                         - Bob Dylan, "Ring Them Bells"
  309.