The srec51 program generates three types of S-records by default: S0, S1 and S9. S1 records are used for 16-bit addresses. With the -r2 option of srec51 S2 records are used (for 24-bit addresses) and with -r3 S3 records are used (for 32-bit addresses). They have the following layout:
An srec51 generated S-record file starts with a S0 record with the following contents:
( c ) T A S K I N G , I n c . S0140000286329205441534B494E472C20496E632E72
The S0 record is a comment record and does not contain relevant information for program execution.
The length_byte represents the number of bytes in the record, not including the record type and length byte.
The checksum is calculated by first adding the binary representation of the bytes following the record type (starting with the length_byte) to just before the checksum. Then the one's complement is calculated of this sum. The least significant byte of the result is the checksum. The sum of all bytes following the record type is 0FFH.
With the -r1 option of srec51, which is the default for srec51, the actual program code and data is supplied with S1 records, with the following layout:
This record is used for 2-byte addresses.
Example:
S1130250F03EF04DF0ACE8A408A2A013EDFCDB00E6 | | | |_ checksum | | |_ code | |_ address |_ length
srec51 has an option that controls the length of the output buffer for generating S1 records.
The checksum calculation of S1 records is identical to S0.
With the -r1 option of srec51, which is the default for srec51, at the end of an S-record file, srec51 generates an S9 record, which contains the program start address. S9 is the corresponding termination record for S1 records.
Layout:
Example:
S9030000FC | | |_checksum | |_ address |_ length
The checksum calculation of S9 records is identical to S0.
With the -r2 option of srec51 the actual program code and data is supplied with S2 records, with the following layout:
This record is used for 3-byte addresses.
Example:
S213FF002000232222754E00754F04AF4FAE4E22BF | | | |_ checksum | | |_ code | |_ address |_ length
srec51 has an option that controls the length of the output buffer for generating S2 records. The default buffer length is 32 code bytes.
The checksum calculation of S2 records is identical to S0.
With the -r2 option of srec51 at the end of an S-record file, srec51 generates an S8 record, which contains the program start address. S8 is the corresponding termination record for S2 records.
Layout:
Example:
S804FF0003F9 | | |_checksum | |_ address |_ length
The checksum calculation of S8 records is identical to S0.
With the -r3 option of srec51 the actual program code and data is supplied with S3 records, with the following layout:
This record is used for 4-byte addresses.
Example:
S3070000FFFE6E6825 | | | |_ checksum | | |_ code | |_ address |_ length
srec51 has an option that controls the length of the output buffer for generating S3 records.
The checksum calculation of S3 records is identical to S0.
With the -r3 option of srec51 at the end of an S-record file, srec51 generates an S7 record, which contains the program start address. S7 is the corresponding termination record for S3 records.
Layout:
Example:
S70500006E6824 | | |_checksum | |_ address |_ length
The checksum calculation of S7 records is identical to S0.