-1

I have an input file in S-Record format whose unused area needs to be filled with a given word pattern [lets say 0xAABBCCDD] using srec_cat.exe.

I am trying the following syntax

srec_cat.exe <original file> -fill <fill pattern word> -within  <startaddress> <end address>  -o <outputfile> −Output_Word

This syntax is giving error. Can you help with the correct syntax.

user1771823
  • 139
  • 1
  • 13
  • 1
    How about telling us what the error message is!? – Clifford Jan 14 '17 at 20:19
  • Did you intend to fill the entire file, or just fill the holes? – Clifford Jan 14 '17 at 20:27
  • Your ` ` fields were interpreted as markup and hidden before I edited it - but they should not be there in any case if you are using a `-within` range. – Clifford Jan 14 '17 at 20:43
  • What does within means ? The entire file ? – user1771823 Jan 15 '17 at 00:21
  • There are examples at http://srecord.sourceforge.net/man/man1/srec_examples.html#FILLING%20THE%20BLANKS – Clifford Jan 15 '17 at 11:44
  • The `-within` parameter was in your original question - you tell me what it means!? From the documentation I am not entirely clear, but I assumed it was what you intended. I beleive it is a range from the lowest address to the highest address in the existing file. However it was why I asked whether you were filling holes or filling the entire file (which you chose not to answer) - that is the difference I think between `-over` and `-within`. It seems odd to fill an existing file (overwriting the existing data) when you could just create a new file filled for a specific range. – Clifford Jan 15 '17 at 11:45
  • You broke your mark-up again; I fixed it - again. Always check the preview panel before committing. You still have not told us what the error message is. – Clifford Jan 16 '17 at 19:40

1 Answers1

0

The -fill filter documentation states:

-Fill value address-range

This filter may be used to fill any gaps in the data with bytes equal to value. ...

(the highlight on bytes is mine).

This specifies that the fill value is a byte not a word.

From the srec_cat examples on filling blanks, what you need to use the -generate option with -repeat-data; something akin to this:

srec_cat <infile>
        −generator ’(’ <startaddress> <end address> −minus −within <infile> ’)’ 
                   −repeat-data 0xaa 0xbb 0xcc 0xdd 
        −o <outfile>

(line-wrapped for clarity)

Note however that you may need to change the byte order to suit the required endianness of the target. I have omitted the -Output_Word option in your original - that may or may not be needed.

I am guessing to some extent; you may need to experiment - the syntax of the srecord utilities and its documentation are somewhat arcane. Generators are described in the srec_input documentation which is not itself a utility but describes the generic input common to all srecord utilities.

Clifford
  • 88,407
  • 13
  • 85
  • 165
  • @user1771823 : No, you cannot replace 0xff with 0xffffffff; that was the point of my answer! And as I also pointed out, if you fill one hole with 4 0xff, what is the difference between that and filling it with one 0xffffffff? – Clifford Jan 15 '17 at 11:35
  • @user1771823 : If you want to fill with an arbitrary sequence on bytes, use the `-repeat-data` option. Again see in the srec_cat examples. – Clifford Jan 15 '17 at 11:51
  • @user1771823 : You need then to edit your question; it makes no sense to give and answer to a question that has not been asked. – Clifford Jan 15 '17 at 17:15
  • @user1771823 : But it still says 0xFFFFFFFF which allows a different solution than 0xAABBCCDDEE, and you continue to keep readers in the dark regarding the error message. You have specified *actual* filenames, but only used *paceholders* for the range, which is a confusing mix - it is either a real command line or a syntax guide - not both. – Clifford Jan 16 '17 at 09:15
  • This is the command I used **C:\mks\temp\Srecord>srec_cat App_Original.s37 -repeat-data 0xaa 0xbb 0xcc 0xdd - over App_Original.s37 -o output27.s37** This is the error I get **misplaced "-REPeat_Data" option Usage: srec_cat [ – user1771823 Jan 16 '17 at 14:14
  • I'm just reading the documentation and examples here! They lack clarity but it appears that that -repeat-data is *data_source* to the `generate` option, not a direct option for `srec_cat`. – Clifford Jan 16 '17 at 19:48
  • I tried again with "generate" That also is throwing some errors **C:\mks\temp\Srecord>srec_cat App_Original.s37 -generator '(' -over App_Original. s37 -minus -within App_Original.s37 ')' -repeat-data 0xaa 0xbb 0xcc 0xdd -o outfile.s37** and here is the output error message I got **srec_cat: the --generate range requires two numeric arguments** – user1771823 Jan 17 '17 at 17:08
  • @user1771823 : OK, I though the `-over` did that for you since the documentation says you can use it anywhere a range is valid (apparently not!). Just use an explicit range as in the examples. Edited. – Clifford Jan 17 '17 at 17:31
  • I think I have answered your original question; `-fill` is not the correct filter for multi-byte values. This now either deserves a new question or your question should have been just *"How do I fill holes with a multi-byte word using `srec_cat`?"* which now seems to be what we are trying to answer despite not being what you asked. – Clifford Jan 17 '17 at 17:38
  • Tried the explicit range also. Still no luck **C:\mks\temp\Srecord>srec_cat App_Original.s37 -generator '(' 0x10 0x20000 -minus -within App_Original.s37 ')' -repeat-data 0xaa 0xbb 0xcc 0xdd -o outfile.s37** The error I got is **srec_cat: the --generate range requires two numeric arguments** – user1771823 Jan 17 '17 at 21:52