S-Record Format (SREC)

SREC files represent binary object code in a printable ASCII format, making them easily transportable between different systems.

Lines in an SREC begin with a prefix such as S1 (header) or S9 (footer). The pertinent prefixes for the bootloaders are S1 and S2. An S1 line describes data stored in logical memory whereas an S2 line describes data held in global memory. However, S1 and S2 lines have the same template seen here:

Type Record Length Address Data Checksum
  • The type field contains the aforementioned prefix.
  • Record length is a 1 byte (2 ASCII characters) long value that states the number of bytes contained in all proceeding fields.
  • The address field gives the start address the line should be written to.
    • In an S1 line, the address is 2 bytes long (e.g. a 16 bit address stored in local memory).
    • In an S2 line, the address is 3 bytes long (the standard 16 bits plus a 7 bit PPAGE value).
    • S3 line, the address is 4 bytes long
  • The data field contains the memory loadable data.
  • Finally, calculate the checksum by summing the record length, address, and data field; then, perform a modulo 256 and take the ones complement.
  • artikel/s-record/start.txt
  • Zuletzt geändert: Sun. 25.11.2018 10:49
  • von wikiadmin