Menu

#20 output to srecord: dec/hex confusion

v1.0 (example)
closed
None
5
2014-04-15
2013-02-04
vici13
No

Hi,

First, thanks and congratulations for the great SW.

Second, business: I tried the software for the first time, and attempted some conversions. I tried to output to s3 (Motorola) format, with certain record parameters (size of address, size of data).

Attempting to set length to 0x19 (all info in .s3 is hex-encoded) I noticed the following (using the -obs option):
1. record length is set to 1-less that what I provide in the -obs option (decimal based);
2. while the record length should be in hex, the parameter of -obs is treated in decimal. I provide ""-output out.s3 -motorola -address-length=4 -obs=20 " and the output begins with "S319000..."

The data bytes are indeed 20 (decimal), however, the field "19" (to be read "0x19") is actually 25.

If this was not true, the maximum length of the dat ain one line could not be 255, but only 99.

I hope I do not start a flame, and that this helps.

Vici13

Discussion

  • Scott Finneran

    Scott Finneran - 2014-04-14
    • status: open --> closed
    • assigned_to: Scott Finneran
    • Group: --> v1.0 (example)
     
  • Scott Finneran

    Scott Finneran - 2014-04-15

    (Hmmm... Curse you sourceforge ticketting system! It seems to have swallowed my message so I'll try rewriting the response.)

    Firstly, thanks for the feedback. You certainly won't start flame wars with questions like this.

    Secondly, the bevhaviour you've observed is correct but probably not what you were expecting. Keep in mind that all numeric arguments to SRecord can be decimal by default or hex in 'C' format (ie 0x prefix)

    I'll illustrustrate with an example:

    srec_cat .bashrc -binary -o out.s3 -motorola -address-length=4 -obs=20
    The obs (output block size) arg specifies 20dec bytes of payload data per record.

    S3 (Record Type)
    19 (Record Length
    00000000 (Address)
    23207E2F2E6261736872633A20657865637574 (20 bytes of payload)
    6508 (Checksum)

    The payload does indeed contain 20 bytes of payload data.

    Thanks again.

    Scott