Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
299 views
in Technique[技术] by (71.8m points)

binary - using srec_cat to fill an S-Record file with a word

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...