1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

Motorola S-Record Format

Discussion in 'Embedded' started by =?UTF-8?B?SsO8cmdlbg==?= Veith, Feb 6, 2006.

  1. After changing old project software, I experienced problems while reading
    the S-record file for flash programming. The previously used tool was a
    very old DOS program no more available today. Fortunately, I now have a
    self written tool in use what allows to examine the reason.

    The suspicious section is at the file end, where the 16 bit start vector is
    at last address of 64 k space (0xffff). The linker control file has a INIT
    statement and linker with old DOS Programmer puts the adress of label
    behind the INIT statement automatically at address 0xffff. Therefore the
    last line of S-record looks like:

    S9 03 1003 E9

    S9 indicates last line of S-Record
    03 indicates 3 data bytes in line
    1003 is the start vector adress (what will be stored at location 0xffff)
    E9 is the checksum

    My flasher complains, becouse destination adress 0xffff is missing and he
    does not know about the correct destination for the start vector in memory.
    If I use own segment instead of INIT instruction, the start vector appears
    in the line before last s-record line with correct adress and everything is
    fine. The last line then looks like S0 03 FFFF FE what will be rejected by
    my flasher. What is the meaning of S9 ? Is this incompability a bug of my
    programmer or a bug of the linker or simply undocumented feature ?
     
    =?UTF-8?B?SsO8cmdlbg==?= Veith, Feb 6, 2006
    #1
    1. Advertising

  2. Hi Jürgen,

    Jürgen Veith wrote:
    [ lots of assumptions about Motorola-S-Format]

    I have never seen an S9 record used for something else than
    for the "end record".
    It seems your programming tool does not know where to put the
    start vector.
    Why don't you put something like

    org 0xfffe
    db start_vec

    into your source code (assuming assembler)?
    Then there will be a S1 record with a start address
    of FFFE and the start vector in it.

    HTH
    Wolfgang

    --
    From-address is Spam trap
    Use: wolfgang (dot) mahringer (at) sbg (dot) at
     
    Wolfgang Mahringer, Feb 6, 2006
    #2
    1. Advertising

  3. ok solved - the problem was not the S9 but the S0 line.
    The S0 line contains some unknown things like Compiler Version, comments and
    the module name. That line was longer than the maximum 32 bytes of my
    buffer and therefore the program stopped with error message. I increased
    max line length to 64 and everything is fine now.

    Nevertheless, it would be nice, if anybody knows what secret codes the
    diffrent compilers store inside the S0 line. Probably I am going to display
    this infos in my flasher window while flashing.
     
    =?UTF-8?B?SsO8cmdlbg==?= Veith, Feb 6, 2006
    #3
  4. "Jürgen Veith" <> wrote in message
    news:43e783b1$0$350$-online.net...
    > ok solved - the problem was not the S9 but the S0 line.
    > The S0 line contains some unknown things like Compiler Version, comments

    and
    > the module name. That line was longer than the maximum 32 bytes of my
    > buffer and therefore the program stopped with error message. I increased
    > max line length to 64 and everything is fine now.
    >
    > Nevertheless, it would be nice, if anybody knows what secret codes the
    > diffrent compilers store inside the S0 line. Probably I am going to

    display
    > this infos in my flasher window while flashing.


    Ok, crash course in self-help:

    1. Open your internet browser
    2. enter www.google.com in the address bar.
    3. type "motorola s record" on the Google page
    4. click on the first link google found for you (16.600 hits found)
    5. start reading

    Meindert
     
    Meindert Sprang, Feb 6, 2006
    #4
  5. =?UTF-8?B?SsO8cmdlbg==?= Veith

    rickman Guest

    Meindert Sprang wrote:
    > "Jürgen Veith" <> wrote in message
    > news:43e783b1$0$350$-online.net...
    > > ok solved - the problem was not the S9 but the S0 line.
    > > The S0 line contains some unknown things like Compiler Version, comments

    > and
    > > the module name. That line was longer than the maximum 32 bytes of my
    > > buffer and therefore the program stopped with error message. I increased
    > > max line length to 64 and everything is fine now.
    > >
    > > Nevertheless, it would be nice, if anybody knows what secret codes the
    > > diffrent compilers store inside the S0 line. Probably I am going to

    > display
    > > this infos in my flasher window while flashing.

    >
    > Ok, crash course in self-help:
    >
    > 1. Open your internet browser
    > 2. enter www.google.com in the address bar.
    > 3. type "motorola s record" on the Google page
    > 4. click on the first link google found for you (16.600 hits found)
    > 5. start reading


    Crash course in providing useful advice...

    if it ain't useful, keep it to yourself!

    I have been through this process and there are lots of *poor*
    references on s-records. I had to read a bunch of them to put together
    a complete (and hopefully accurate) description of s-records. Even
    then I was not sure it would work for all situations as there seems to
    be a lot of variability in how s-records are used.

    You don't need to be rude. That only makes you look stupid.
     
    rickman, Feb 6, 2006
    #5
  6. "rickman" <> wrote in message
    news:...
    Meindert Sprang wrote:
    >> Ok, crash course in self-help:
    >>
    >> 1. Open your internet browser
    >> 2. enter www.google.com in the address bar.
    >> 3. type "motorola s record" on the Google page
    >> 4. click on the first link google found for you (16.600 hits found)
    >> 5. start reading


    > Crash course in providing useful advice...
    >
    > if it ain't useful, keep it to yourself!


    Believe me, if I advise to search on google, I have *always* checked first
    if the search phrase returned any useful info. And the first link does give
    a fairly complete description of the format.

    > I have been through this process and there are lots of *poor*
    > references on s-records. I had to read a bunch of them to put together
    > a complete (and hopefully accurate) description of s-records. Even
    > then I was not sure it would work for all situations as there seems to
    > be a lot of variability in how s-records are used.


    > You don't need to be rude. That only makes you look stupid.


    Wasn't meant to be rude. I thougth I was pointing out the obvious....

    Meindert
     
    Meindert Sprang, Feb 6, 2006
    #6
  7. =?UTF-8?B?SsO8cmdlbg==?= Veith

    rickman Guest

    Meindert Sprang wrote:
    > "rickman" <> wrote in message
    > > if it ain't useful, keep it to yourself!

    >
    > Believe me, if I advise to search on google, I have *always* checked first
    > if the search phrase returned any useful info. And the first link does give
    > a fairly complete description of the format.
    >
    > > I have been through this process and there are lots of *poor*
    > > references on s-records. I had to read a bunch of them to put together
    > > a complete (and hopefully accurate) description of s-records. Even
    > > then I was not sure it would work for all situations as there seems to
    > > be a lot of variability in how s-records are used.

    >
    > > You don't need to be rude. That only makes you look stupid.

    >
    > Wasn't meant to be rude. I thougth I was pointing out the obvious....


    It was not obvious or even accurate. The answer to the OP's question
    was not on the first link or likely any of the links. He was asking
    what the tools put into the S0 record. If you read the link it says
    that the S0 record contains among other things...

    description is char[0-36] and is a text comment

    The OP was asking what the tools put into this comment field. That is
    outside of the S record spec other than the 36 char max length.

    So do you have any information that is *useful* to the OP?
     
    rickman, Feb 6, 2006
    #7
  8. "rickman" <> writes:
    > Meindert Sprang wrote:
    > > "rickman" <> wrote


    > > > if it ain't useful, keep it to yourself!

    > >
    > > Believe me, if I advise to search on google, I have *always* checked first
    > > if the search phrase returned any useful info. And the first link does give
    > > a fairly complete description of the format.
    > >
    > > > I have been through this process and there are lots of *poor*
    > > > references on s-records. I had to read a bunch of them to put together
    > > > a complete (and hopefully accurate) description of s-records. Even
    > > > then I was not sure it would work for all situations as there seems to
    > > > be a lot of variability in how s-records are used.

    > >
    > > > You don't need to be rude. That only makes you look stupid.

    > >
    > > Wasn't meant to be rude. I thougth I was pointing out the obvious....

    >
    > It was not obvious or even accurate. The answer to the OP's question
    > was not on the first link or likely any of the links. He was asking
    > what the tools put into the S0 record. If you read the link it says
    > that the S0 record contains among other things...
    >
    > description is char[0-36] and is a text comment


    Where did you find a supposed 36-character limit specified?

    The format allows up to 99 characters and S-recs date back
    to (late) punchcard days, so being prepared for up to 80
    characters would be wise.

    > The OP was asking what the tools put into this comment field. That is
    > outside of the S record spec other than the 36 char max length.
    >
    > So do you have any information that is *useful* to the OP?
     
    Everett M. Greene, Feb 7, 2006
    #8
  9. =?UTF-8?B?SsO8cmdlbg==?= Veith

    rickman Guest

    Everett M. Greene wrote:
    > "rickman" <> writes:
    > > It was not obvious or even accurate. The answer to the OP's question
    > > was not on the first link or likely any of the links. He was asking
    > > what the tools put into the S0 record. If you read the link it says
    > > that the S0 record contains among other things...
    > >
    > > description is char[0-36] and is a text comment

    >
    > Where did you find a supposed 36-character limit specified?


    http://www.amelek.gda.pl/avr/uisp/srecord.htm

    go to the description for the S0 record type...

    S0 Record. The type of record is 'S0' (0x5330). The address field is
    unused and will be filled with zeros (0x0000). The header information
    within the data field is divided into the following subfields.

    mname is char[20] and is the module name.
    ver is char[2] and is the version number.
    rev is char[2] and is the revision number.
    description is char[0-36] and is a text comment.

    36 is for just the text comment, but this may be the ascii which is
    represented by two char in the Srecord for a total of 72 char. But
    that was my point. There is a lot of info on the Srecord format, but
    much of it is incomplete and/or misleading. I don't think much of
    being rude or even just negative in the forums. This was an example
    that was completely unjustified.


    > The format allows up to 99 characters and S-recs date back
    > to (late) punchcard days, so being prepared for up to 80
    > characters would be wise.


    Do you have a reference that describes this? I have never found a
    complete, definitive description of Srecords.
     
    rickman, Feb 7, 2006
    #9
  10. there are a few things:

    1) some linkers put the start vector into the S9 line without explicit
    instruction to do so

    2) some flash programmers read the S9 line and flash the vector to the CPU
    specific destination address without explicit instruction to do so

    3) some programmers (like I did in my old project) use the 1+2 features and
    do not now about. I am not going to implement that feature in my flasher
    becouse it seems better to force programmers for explicit link of own
    vector section with reset and other vectors

    4) even if the project is assembly without any HLL library, customers can
    possibly find out the tools used in the project by analyzing the S0 line.
     
    =?UTF-8?B?SsO8cmdlbg==?= Veith, Feb 8, 2006
    #10
  11. "rickman" <> writes:
    > Everett M. Greene wrote:
    > > "rickman" <> writes:
    > > > It was not obvious or even accurate. The answer to the OP's question
    > > > was not on the first link or likely any of the links. He was asking
    > > > what the tools put into the S0 record. If you read the link it says
    > > > that the S0 record contains among other things...
    > > >
    > > > description is char[0-36] and is a text comment

    > >
    > > Where did you find a supposed 36-character limit specified?

    >
    > http://www.amelek.gda.pl/avr/uisp/srecord.htm
    >
    > go to the description for the S0 record type...
    >
    > S0 Record. The type of record is 'S0' (0x5330). The address field is
    > unused and will be filled with zeros (0x0000). The header information
    > within the data field is divided into the following subfields.
    >
    > mname is char[20] and is the module name.
    > ver is char[2] and is the version number.
    > rev is char[2] and is the revision number.
    > description is char[0-36] and is a text comment.
    >
    > 36 is for just the text comment, but this may be the ascii which is
    > represented by two char in the Srecord for a total of 72 char. But
    > that was my point. There is a lot of info on the Srecord format, but
    > much of it is incomplete and/or misleading. I don't think much of
    > being rude or even just negative in the forums. This was an example
    > that was completely unjustified.


    The preceding sounds as if it's someone's specific S0 format
    and not a general description.

    > > The format allows up to 99 characters and S-recs date back
    > > to (late) punchcard days, so being prepared for up to 80
    > > characters would be wise.

    >
    > Do you have a reference that describes this? I have never found a
    > complete, definitive description of Srecords.


    Complete I've found -- definitive is questionable. It
    would be Motorola's place to be definitive and I've
    never found anything from them.
     
    Everett M. Greene, Feb 8, 2006
    #11
  12. =?UTF-8?B?SsO8cmdlbg==?= Veith

    Mel Wilson Guest

    Everett M. Greene wrote:
    > "rickman" <> writes:
    >>Do you have a reference that describes this? I have never found a
    >>complete, definitive description of Srecords.

    >
    >
    > Complete I've found -- definitive is questionable. It
    > would be Motorola's place to be definitive and I've
    > never found anything from them.


    I've got 6 pages from a Motorola Evaluation Module User's Manual. But
    you've already found complete...

    Mel.
     
    Mel Wilson, Feb 8, 2006
    #12
  13. =?UTF-8?B?SsO8cmdlbg==?= Veith

    rickman Guest

    Mel Wilson wrote:
    > Everett M. Greene wrote:
    > > "rickman" <> writes:
    > >>Do you have a reference that describes this? I have never found a
    > >>complete, definitive description of Srecords.

    > >
    > >
    > > Complete I've found -- definitive is questionable. It
    > > would be Motorola's place to be definitive and I've
    > > never found anything from them.

    >
    > I've got 6 pages from a Motorola Evaluation Module User's Manual. But
    > you've already found complete...


    I would love to see those 6 pages. :)
     
    rickman, Feb 9, 2006
    #13
  14. =?UTF-8?B?SsO8cmdlbg==?= Veith

    Mel Wilson Guest

    rickman wrote:
    > Mel Wilson wrote:
    >>I've got 6 pages from a Motorola Evaluation Module User's Manual. But
    >>you've already found complete...

    >
    >
    > I would love to see those 6 pages. :)
    >

    Turns out it's actually 4. The manual had one sheet of paper twice.
    I've scanned them, but haven't got them to my web space yet. I'll
    announce here when it's done.

    Mel.
     
    Mel Wilson, Feb 9, 2006
    #14
  15. Mel Wilson <> writes:
    > rickman wrote:
    > > Mel Wilson wrote:
    > >>I've got 6 pages from a Motorola Evaluation Module User's Manual. But
    > >>you've already found complete...

    > >
    > > I would love to see those 6 pages. :)
    > >

    > Turns out it's actually 4. The manual had one sheet of paper twice.
    > I've scanned them, but haven't got them to my web space yet. I'll
    > announce here when it's done.


    I'll save you the trouble of scanning. The following is
    specially imported from Italy:

    > From: (Davide Rizzo)
    > Newsgroups: comp.sys.m68k
    > Subject: Re: Motorola S1 format
    > Date: Mon, 17 Feb 1997 14:39:18 GMT
    > Organization: Italia Online


    All the following is from the freeware as32 motorola assembler manual

    APPENDIX E
    S-RECORD INFORMATION


    E.1 INTRODUCTION

    The S-record output format encodes program and data object modules
    into a printable (ASCII) format. This allows viewing of the object
    file with standard tools and allows display of the module while
    transferring from one computer to the next or during loads between a
    host and target. The S-record format also includes information for
    use in error checking to insure the integrity of data transfers.


    E.2 S-RECORD CONTENT

    S-Records are character strings made of several fields which identify
    the record type, record length, memory address, code/data, and
    checksum. Each byte of binary data is encoded as a 2-character
    hexadecimal number: the first character representing the high-order
    4 bits, and the second the low-order 4 bits of the byte.

    The 5 fields which comprise an S-record are:

    TYPE RECORD LENGTH ADDRESS CODE/DATA CHECKSUM

    The fields are defined as follows:

    FIELD CHARACTERS CONTENTS
    ----- ---------- --------
    Type 2 S-record type - S0 through S9

    Record 2 The count of the character pairs in the
    length record, excluding the type and record
    length.

    Address 4, 6, The 2-, 3-, or 4-byte address at which
    or 8 the data field is to be loaded into
    memory.

    Code/data 0-2n From 0 to n bytes of executable code,
    memory loadable data, or descriptive
    information.

    Checksum 2 The least significant byte of the one's
    complement of the sum of the values
    represented by the pairs of characters
    making up the record length, address,
    and the code/data fields.

    Each record may be terminated with a CR/LF/NULL.


    E.3 S-RECORD TYPES

    Several types of s-records have been defined to accommodate various
    encoding, transportation, and decoding needs. The MC68332 Freeware
    assembler uses the following types:

    S0 A record containing the filename encoded in ASCII hex
    characters. This is a dummy header file which is not used by
    Motorola evaluation systems.

    S1 A record containing code/data and the 2-byte
    address at which the code/data is to reside.

    S2 A record containing code/data and the 3-byte address at which
    the code/data is to reside

    S3 A record containing code/data and the 4-byte address at which
    the code/data is to reside

    S7 A termination record for a block of S3 records. The address
    field may optionally contain the 4-byte address of the
    instruction to which control is to be passed. If not
    specified, the first entry point specification encountered in
    the object module input will be used. There is no code/data
    field.

    S8 A termination record for a block of S2 records. The address
    field may optionally contain the 3-byte address of the
    instruction to which control is to be passed. If not
    specified, the first entry point specification encountered in
    the object module input will be used. There is no code/data
    field.

    S9 A termination record for a block of S1 records. The address
    field may optionally contain the 2-byte address of the
    instruction to which control is to be passed. If not
    specified, the first entry point specifica
    tion encountered in the object module input will be used.
    There is no code/data field.

    E.4 S-RECORD EXAMPLE

    The following is a typical S-record module:

    S1130000285F245F2212226A000424290008237C2A
    S11300100002000800082629001853812341001813
    S113002041E900084E42234300182342000824A952
    S107003000144ED492
    S9030000FC

    The module consists of four code/data records and an S9 termination
    record.

    The first S1 code/data record is explained as follows:
    S1 S-record type S1, indicating a code/data record to be
    loaded/verified at a 2-byte address.

    13 Hex 13 (decimal 19), indicating 19 character pairs,
    representing 19 bytes of binary data, follow.

    00 Four-character 2-byte address field: hex address 0000,
    indicates location where the following data is to be loaded.

    The next 16 character pairs are the ASCII bytes of the actual
    program code/data.

    2A Checksum of the first S1 record. The checksum is the
    complemented sum of byte value of all fields following the S1
    field.

    The second and third S1 code/data records each also contain $13
    character pairs and are ended with checksums. The fourth S1 code/data
    record contains 7 character pairs. S2 and S3 records are similiar
    except that the address field is 3 bytes and 4 bytes long,
    respectively.

    The S9 termination record is explained as follows:

    S9 S-record type S9, indicating a termination record.

    03 Hex 03, indicating three character pairs (3 bytes) to
    follow.

    00 Four character 2-byte address field, zeroes.
    00

    FC The two character, one-byte checksum field.

    The S6 and S7 termination records are similiar except for the larger
    address fields as noted earlier.
     
    Everett M. Greene, Feb 9, 2006
    #15
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Trilobyte
    Replies:
    1
    Views:
    351
    erratic
    Jul 18, 2003
  2. ~~~AAA~~~

    TV Wonder Pro record format

    ~~~AAA~~~, Jan 1, 2006, in forum: ATI
    Replies:
    2
    Views:
    213
    T Shadow
    Jan 2, 2006
  3. tree
    Replies:
    9
    Views:
    410
  4. Dirk Puslich
    Replies:
    3
    Views:
    460
    Elroy the Seedy Impaler
    Aug 26, 2003
  5. Berry
    Replies:
    1
    Views:
    288
    Captain Midnight
    Jun 11, 2007
Loading...

Share This Page