flexible naming of output files
Brought to you by:
pmiller,
scottfinneran
Hi,
an option to name output files depending on file
content would be nice.
Something like:
srec_cat -i <infile> -op "outfile_%08x.s19" 0xfffc
or:
srec_cat -i <infile> -op "outfile_%5s.s19" 0xfff0
would allow configuration options or serial numbers
to be automatically appended to the input filename.
Again: thanks for this program!!
Frieder
PS: the command-lines shown here are crap. They
just show what is meant.
Logged In: YES
user_id=160
Is is possible to use the printf command (in back quotes)
instead? E.g.
srec_cat -i <infile> -o `printf "outfile_%08x.s19" 0xfffc`
Logged In: YES
user_id=589052
Hi Peter,
thanks for asking, and sorry no, this wouldn't quite do.
In this example I'd rather like to have the contents
of address 0xfffc used for the naming of the output
file (as opposed to the address itself).
This information might in some cases be known on the
command line (shell script for f.e. a serial number),
but there are applications where you don't:
- if you want to use a C compiler generated string:
char code at 0xff00 date_string = VERSION __DATE__;
- if srecord itself modifies Eeprom contents
(RFE #776221 and #778570 would be related, as
is checksum calculation and random filling:)
- if srecord would read some bytes it can't get again
(f.e. from a barcode reader or /dev/random, /dev/urandom
on Unix)
Regards,
Frieder
Logged In: YES
user_id=160
Originator: NO
Still don't understan this.
Why can't you just set the filenames in the script?
Why does this need to be done by srec_cat?
Even if it was to use data from the file, such as a version string,
why can't you use the output of
srec_cat <input> -crop NNN MM -offset -NNN -o - -bin
to build the value in the script, and then have the script build the filename from that?
Logged In: YES
user_id=589052
Originator: YES
> Why can't you just set the filenames in the script?
> Why does this need to be done by srec_cat?
you're right it doesn't have to be done within srec_cat.
It would have been handy though (at that time I had
problems using the same script on Win98SE and on Win2k
due to some subtlety I don't remember).
I would have wanted to append calibration data to an
executable and store the result under a filename like
firmware-v1.0-000001.hex
with 000001 being the serial number.
(Of course there are other ways to do it but a
bash shell was not an option.)
I'm really hesitant to hard code one person's use case into the tool. That's really what scripting languages are for.