SREC (file format)
Encyclopedia
The Motorola
Motorola
Motorola, Inc. was an American multinational telecommunications company based in Schaumburg, Illinois, which was eventually divided into two independent public companies, Motorola Mobility and Motorola Solutions on January 4, 2011, after losing $4.3 billion from 2007 to 2009...

 S-record
format is an ASCII
ASCII
The American Standard Code for Information Interchange is a character-encoding scheme based on the ordering of the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text...

 hexadecimal ("hex") text encoding for binary data. It is also known as the SREC or S19 format. Each record contains a checksum
Checksum
A checksum or hash sum is a fixed-size datum computed from an arbitrary block of digital data for the purpose of detecting accidental errors that may have been introduced during its transmission or storage. The integrity of the data can be checked at any later time by recomputing the checksum and...

 to detect data that has been corrupted during transmission. The first record (S0) may include arbitrary comments such as a program name or version number. The last (termination) record (S7, S8, or S9) may include a starting address.

The S-record format was created in the 1970s for the Motorola 6800
Motorola 6800
The 6800 was an 8-bit microprocessor designed and first manufactured by Motorola in 1974. The MC6800 microprocessor was part of the M6800 Microcomputer System that also included serial and parallel interface ICs, RAM, ROM and other support chips...

 processor. Software development tools
Programming tool
A programming tool or software development tool is a program or application that software developers use to create, debug, maintain, or otherwise support other programs and applications...

 for that and other embedded processors would make executable code and data in the S-record format. PROM programmers would then read the S-record format and "burn" the data into the PROMs or EPROMs used in the embedded system.

There are other ASCII encoding with a similar purpose. BPNF, BHLF, and B10F were early binary formats, but they are neither compact nor flexible. Hexadecimal formats are more compact because they represent 4 bits rather than 1 bit per character. Many, such as S-record, are more flexible because they include address information so they can specify just a portion of a PROM. Intel HEX
Intel HEX
Intel HEX is a file format for conveying binary information for applications like programming microcontrollers, EPROMs, and other kinds of chips. It is one of the oldest file formats available for this purpose, having been in use since the 1970s...

 format was often used with Intel processors. Tek Hex is another hex format that can include a symbol table for debugging.

Format

An SREC format file consists of a series of ASCII records. All hexadecimal
Hexadecimal
In mathematics and computer science, hexadecimal is a positional numeral system with a radix, or base, of 16. It uses sixteen distinct symbols, most often the symbols 0–9 to represent values zero to nine, and A, B, C, D, E, F to represent values ten to fifteen...

 (hex) numbers are Big Endian. The records have the following structure:
  1. Start code, one character, an S.
  2. Record type, one digit, 0 to 9, defining the type of the data field.
  3. Byte count, two hex digits, indicating the number of bytes (hex digit pairs) that follow in the rest of the record (in the address, data and checksum fields).
  4. Address, four, six, or eight hex digits as determined by the record type for the memory location of the first data byte. The address bytes are arranged in big endian
    Endianness
    In computing, the term endian or endianness refers to the ordering of individually addressable sub-components within the representation of a larger data item as stored in external memory . Each sub-component in the representation has a unique degree of significance, like the place value of digits...

     format.
  5. Data, a sequence of 2n hex digits, for n bytes of the data.
  6. Checksum, two hex digits - the least significant byte of ones' complement of the sum of the values represented by the two hex digit pairs for the byte count, address and data fields. For example:


S1137AF0 0A0A0D0000000000000000000000000061

13+7A+F0 +0A+0A+0D+00+00+00+00+00+00+00+00+00+00+00+00+00 = 19E , then take the least significant byte and then take the ones' complement of that byte (9E) which equals 0x61

There are eight record types, listed below:
Record Description Address Bytes Data Sequence
S0 Block header 2 Yes
S1 Data sequence 2 Yes
S2 Data sequence 3 Yes
S3 Data sequence 4 Yes
S5 Record count 2 No
S7 End of block 4 No
S8 End of block 3 No
S9 End of block 2 No

S0

The S0 record data sequence contains vendor specific data rather than program data. String with file name and possibly version info.

S1, S2, S3

Data sequence, depending on size of address needed. A 16-bit/64K system uses S1, 24-bit address uses S2 and full 32-bit uses S3.

S5

Count of S1, S2 and S3 records previously appearing in the file or transmission. The record count is stored in the 2-byte address field. There is no data associated with this record type.

S7, S8, S9

The address field of the S7, S8, or S9 records may contain a starting address for the program.

Example

S00F000068656C6C6F202020202000003C
S11F00007C0802A6900100049421FFF07C6C1B787C8C23783C6000003863000026
S11F001C4BFFFFE5398000007D83637880010014382100107C0803A64E800020E9
S111003848656C6C6F20776F726C642E0A0042
S5030003F9
S9030000FC

See also

  • Intel HEX
    Intel HEX
    Intel HEX is a file format for conveying binary information for applications like programming microcontrollers, EPROMs, and other kinds of chips. It is one of the oldest file formats available for this purpose, having been in use since the 1970s...

     file format
  • GNU Binutils objdump and objcopy programs can produce and display S-records.

External links

  • SRecord is a collection of tools for manipulating SREC format files.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK