I have the following script for srec_cat. My goal is to insert two constants into known locations in a .srec file:

srcfile.srec # carve a hole for and insert crc byte count -exclude 0x43c8 0x43cc -generate 0x43c8 0x43cc -constant-l-e 0x8e2c 4 # carve a hole for and insert crc expected value -exclude 0x43cc 0x43d0 -generate 0x43cc 0x43d0 -constant-l-e 0x194fa71a 4 # output into new file -o dstfile.srec 

If I comment out either half, the script works without error. But with both present, I get the message:

srec_cat: generate repeat data: multiple 0x000043CC values (previous = 0x00, this one = 0x1A) 

I could write out an intermediate file and process it to insert the second constant, but that seems rather heavy handed. Save me from such a hack! :)

1 Answer

I think you need brackets as mentioned in man srec_examples:

Filtering After Joining
There are times when you want to join two sets of data together, and then apply a filter to the joined result. To do this you use parentheses.

srec_cat \ '(' \ infile -exclude 0xFFF0 0x10000 \ -generate 0xFFF0 0xFFF8 -repeat‐string 'Bananas ' \ ')' \ -b‐e‐length 0xFFF8 4 \ -b‐e‐checksum‐neg 0xFFFC 4 4 \ -o outfile 

The above example command catenates an input file (with the generated data area excluded) with a constant string. This catenated input is then filtered to add a 4‐byte length, and a 4‐byte checksum.

In your case:

srec_cat '(' srcfile.srec -exclude 0x43c8 0x43cc -generate 0x43c8 0x43cc -l-e-constant 0x8e2c 4 ')' -exclude 0x43cc 0x43d0 -generate 0x43cc 0x43d0 -l-e-constant 0x194fa71a 4 -o dstfile.srec 
0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.