S record

from Wikipedia, the free encyclopedia

The Motorola S-Record format is an ASCII -based data format for encoding binary files . It is also known as the SREC or S19 format. It is mainly used to store the program code of microcontrollers in embedded systems . It was in the 1970s by the manufacturer Motorola for its 6800 - microprocessor developed.

A similar, albeit slightly different, format is the Intel HEX format. a. is used for Intel processors.

The ASCII coding allows the file to be edited or opened with a text editor . Since it contains checksums , damaged data records can be detected during transmission.

format

An S-Record file consists of a series of ASCII data sets. All hexadecimal numbers are big endian ; H. the most significant byte is saved first, i.e. at the lower address. The data records have the following structure:

  1. Start code , one character: S
  2. Record type , a digit, 0 through 9 , defines the type of record
  3. Byte count (the number of bytes), two hexadecimal digits, 0 to F , contains the number of bytes (i.e. two hexadecimal digits each) that follow in the remaining data set (address, data and checksum).
  4. Address , four, six or eight hexadecimal digits (depending on the data record type) that define the memory address of the subsequent data.
  5. Data field , a sequence of 2 n hexadecimal digits, i.e. n data bytes
  6. Checksum (checksum), two hexadecimal digits - the one's complement of the low-order byte of the sum of byte count, address (byte-wise) and the data (also byte-wise)

There were some programs that limited the number of characters in an S record to 56 printable characters for reasons of compatibility with teletypewriters . A UNIX man page writes of a limit of 78 printable characters. Since Motorola has not defined a limit, a program should also be able to handle a byte count of 255, i.e. 514 printable plus terminating characters.

There are eight record types listed below:

Record description Address bytes Data field
S0 Block header (block header) 2 Yes
S1 Data series 2 Yes
S2 Data series 3 Yes
S3 Data series 4th Yes
S5 Record count (record number) 2 No
S7 End of block (block end) 4th No
S8 End of block (block end) 3 No
S9 End of block (block end) 2 No
  • The S0 header does not contain any program data, but manufacturer-specific data. The data field is structured as follows:
    • Module name (20 characters)
    • Version (2 characters)
    • Revision (2 characters)
    • Description (0-36 characters)
  • In the S5 data record, the number of the above S1, S2 and S3 data records is stored in the two-byte address field. This data record does not contain a data field.
  • The address fields of S7 , S8 , or S9 can contain the start address of the program.

example

S00F000068656C6C6F212020202000003B
S11F00007C0802A6900100049421FFF07C6C1B787C8C23783C6000003863000026
S11F001C4BFFFFE5398000007D83637880010014382100107C0803A64E800020E9
S111003848656C6C6F20776F726C642E0A0042
S5030003F9
S9030000FC
  • Start code
  • Record type
  • Byte count
  • address
  • Data
  • Checksum (checksum)
  • The checksum for the first sample data is calculated as follows: .

    Related file formats

    The Intel HEX format (also known as Intel HEX for short ) is very similar . Other formats for this area of ​​application are e.g. B. the simple binary code or the Jedec format.

    swell

    1. srec - Linux man page
    2. a b MC68000 Family Programmer's Reference Manual (PDF; 2.4 MB) Appendix C
    3. Archived copy ( memento of the original from June 19, 2015 in the Internet Archive ) Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice. @1@ 2Template: Webachiv / IABot / www.ee.nmt.edu
    4. http://www.macgui.com/usenet/?author=Ron+Widell&id=1600&group=45

    Web links