1srec_input(1) General Commands Manual srec_input(1)
2
3
4
6 srec_input - input file specifications
7
9 srec_* filename [ format ]
10
12 This manual page describes the input file specifications for the
13 srec_cat(1), srec_cmp(1) and srec_info(1) commands.
14
15 Input files may be qualified in a number of ways: you may specify their
16 format and you may specify filters to apply to them. An input file
17 specification looks like this:
18 filename [ format ][ -ignore‐checksums ][ filter ... ]
19
20 The filename may be specified as a file name, or the special name “-”
21 which is understood to mean the standard input.
22
23 Grouping with Parentheses
24 There are some cases where operator precedence of the filters can be
25 ambiguous. Input specifications may also be enclosed by ( parentheses
26 ) to make grouping explicit. Remember that the parentheses must be
27 separate words, i.e. surrounded by spaces, and they will need to be
28 quoted to get them past the shell's interpretation of parentheses.
29
30 Those Option Names Sure Are Long
31 All options may be abbreviated; the abbreviation is documented as the
32 upper case letters, all lower case letters and underscores (_) are
33 optional. You must use consecutive sequences of optional letters.
34
35 All options are case insensitive, you may type them in upper case or
36 lower case or a combination of both, case is not important.
37
38 For example: the arguments “-help”, “-HEL” and “-h” are all interpreted
39 to mean the -Help option. The argument “-hlp” will not be understood,
40 because consecutive optional characters were not supplied.
41
42 Options and other command line arguments may be mixed arbitrarily on
43 the command line.
44
45 The GNU long option names are understood. Since all option names for
46 srec_input are long, this means ignoring the extra leading “-”. The
47 “--option=value” convention is also understood.
48
49 File Formats
50 The format is specified by the argument after the file name. The for‐
51 mat defaults to Motorola S‐Record if not specified. The format speci‐
52 fiers are:
53
54 -Absolute_Object_Module_Format
55 This option says to use the Intel Absolute Object Module Format
56 (AOMF) to read the file. (See srec_aomf(5) for a description
57 of this file format.)
58
59 -Ascii_Hex
60 This option says to use the Ascii‐Hex format to read the file.
61 See srec_ascii_hex(5) for a description of this file format.
62
63 -Atmel_Generic
64 This option says to use the Atmel Generic format to read the
65 file. See srec_atmel_genetic(5) for a description of this file
66 format.
67
68 -Binary This option says the file is a raw binary file, and should be
69 read literally. (This option may also be written -Raw.) See
70 srec_binary(5) for more information.
71
72 -B‐Record
73 This option says to use the Freescale MC68EZ328 Dragonball
74 bootstrap b‐record format to read the file. See
75 srec_brecord(5) for a description of this file format.
76
77 -COsmac This option says to use the RCA Cosmac Elf format to read the
78 file. See srec_cosmac(5) for a description of this file for‐
79 mat.
80
81 -Dec_Binary
82 This option says to use the DEC Binary (XXDP) format to read
83 the file. See srec_dec_binary(5) for a description of this
84 file format.
85
86 -Elektor_Monitor52
87 This option says to use the EMON52 format to read the file.
88 See srec_emon52(5) for a description of this file format.
89
90 -FAIrchild
91 This option says to use the Fairchild Fairbug format to read
92 the file. See srec_fairchild(5) for a description of this file
93 format.
94
95 -Fast_Load
96 This option says to use the LSI Logic Fast Load format to read
97 the file. See srec_fastload(5) for a description of this file
98 format.
99
100 -Formatted_Binary
101 This option says to use the Formatted Binary format to read the
102 file. See srec_formatted_binary(5) for a description of this
103 file format.
104
105 -Four_Packed_Code
106 This option says to use the FPC format to read the file. See
107 srec_fpc(5) for a description of this file format.
108
109 -Guess This option may be used to ask the command to guess the input
110 format. This is slower than specifying an explicit format, as
111 it may open and scan and close the file a number of times.
112
113 -HEX_Dump
114 This option says to try to read a hexadecimal dump file, more
115 or less in the style output by the same option. This is not an
116 exact reverse mapping, because if there are ASCII equivalents
117 on the right hand side, these may be confused for data bytes.
118 Also, it doesn't understand white space representing holes in
119 the data in the line.
120
121 -IDT This option says to the the IDT/sim binary format to read the
122 file. See srec_idt(5) for a description of this file format.
123
124 -Intel This option says to use the Intel hex format to read the file.
125 See srec_intel(5) for a description of this file format.
126
127 -INtel_HeX_16
128 This option says to use the Intel hex 16 (INHX16) format to
129 read the file. See srec_intel16(5) for a description of this
130 file format.
131
132 -LOGIsim
133 This format is read and written by the open source Logisim pro‐
134 gram. See srec_logisim(5) for more informatuion.
135
136 -Memory_Initialization_File
137 This option says to use the Memory Initialization File (MIF)
138 format by Altera to read the file. See srec_mif (5) for a
139 description of this file format.
140
141 -Mips_Flash_Big_Endian
142
143 -Mips_Flash_Little_Endian
144 These options say to use the MIPS Flash file format to read the
145 file. See srec_mips_flash (5) for a description of this file
146 format.
147
148 -MOS_Technologies
149 This option says to use the Mos Technologies format to read the
150 file. See srec_mos_tech(5) for a description of this file for‐
151 mat.
152
153 -Motorola [ width ]
154 This option says to use the Motorola S‐Record format to read
155 the file. (May be written -S‐Record as well.) See
156 srec_motorola(5) for a description of this file format.
157
158 The optional width argument describes the number of bytes which
159 form each address multiple. For normal uses the default of one
160 (1) byte is appropriate. Some systems with 16‐bit or 32‐bit
161 targets mutilate the addresses in the file; this option will
162 correct for that. Unlike most other parameters, this one can‐
163 not be guessed.
164
165 -MsBin This option says to use the Windows CE Binary Image Data Format
166 to read the file. See srec_msbin(5) for a description of this
167 file format.
168
169 -Needham_Hexadecimal
170 This option says to use the Needham Electronics ASCII file for‐
171 mat to read the file. See srec_needham(5) for a description of
172 this file format.
173
174 -Ohio_Scientific
175 This option says to use the Ohio Scientific format. See
176 srec_os65v(5) for a description of this file format.
177
178 -PPB This option says to use the Stag Prom Programmer binary format.
179 See srec_ppb(5) for a description of this file format.
180
181 -PPX This option says to use the Stag Prom Programmer hexadecimal
182 format. See srec_ppx(5) for a description of this file format.
183
184 -SIGnetics
185 This option says to use the Signetics format. See
186 srec_spasm(5) for a description of this file format.
187
188 -SPAsm This is a synonym for the -SPAsm_Big_Endian option.
189
190 -SPAsm_Big_Endian
191 This option says to use the SPASM assembler output format (com‐
192 monly used by PIC programmers). See srec_spasm(5) for a
193 description of this file format.
194
195 -SPAsm_Little_Endian
196 This option says to use the SPASM assembler output format, but
197 with the data the other way around.
198
199 -STewie This option says to use the Stewie binary format to read the
200 file. See srec_stewie(5) for a description of this file for‐
201 mat.
202
203 -Tektronix
204 This option says to use the Tektronix hex format to read the
205 file. See srec_tektronix(5) for a description of this file
206 format.
207
208 -Tektronix_Extended
209 This option says to use the Tektronix extended hex format to
210 read the file. See srec_tektronix_extended(5) for a descrip‐
211 tion of this file format.
212
213 -Texas_Instruments_Tagged
214 This option says to use the Texas Instruments Tagged format to
215 read the file. See srec_ti_tagged(5) for a description of this
216 file format.
217
218 -Texas_Instruments_Tagged_16
219 This option says to use the Texas Instruments SDSMAC 320 format
220 to read the file. See srec_ti_tagged_16(5) for a description
221 of this file format.
222
223 -Texas_Instruments_TeXT
224 This option says to use the Texas Instruments TXT (MSP430) for‐
225 mat to read the file. See srec_ti_txt(5) for a description of
226 this file format.
227
228 -TRS80 This option says to use the Radio Shack TRS‐80 object file for‐
229 mat to read the file. See srec_trs80(5) for a description of
230 this file format.
231
232 -VMem This option says to use the Verilog VMEM format to read the
233 file. See srec_vmem(5) for a description of this file format.
234
235 -WILson This option says to use the wilson format to read the file.
236 See srec_wilson(5) for a description of this file format.
237
238 Ignore Checksums
239 The -IGnore‐Checksums option may be used to disable checksum validation
240 of input files, for those formats which have checksums at all. Note
241 that the checksum values are still read in and parsed (so it is still
242 an error if they are missing) but their values are not checked. Used
243 after an input file name, the option affects that file alone; used any‐
244 where else on the command line, it applies to all following files.
245
246 -redundant‐bytes=value
247 Use this option to permit a file to contain redundant values
248 for some memory locations. The default is for this condition
249 to be a warning.
250
251 ignore
252 No warning or error is issued whena redundant settings are
253 detected.
254
255 warning
256 A warning is issued when a redundant settings are observed,
257 the warning includes the problematic address.
258
259 error
260 A fatal error is issued when a redundant settings are
261 observed, the fatal error message includes the problematic
262 address and byte value.
263
264 -contradictory‐bytes=value
265 Use this option to permit a file to contain contradictory val‐
266 ues for some memory locations. The last value in the input(s)
267 will be used. The default is for this condition to be a fatal
268 error.
269
270 ignore
271 No warning or error is issued when contradictory setting is
272 detected.
273
274 warning
275 A warning is issued when a vontradictory settings are
276 observed, the warning includes the problematic address, and
277 values.
278
279 error
280 A fatal error is issued when contradictory settings are
281 observed, the fatal error message includes the problematic
282 address and byte values.
283
284 Generators
285 It is also possible to generate data, rather than read it from a file.
286 You may use a generator anywhere you could use a file. An input gener‐
287 ator specification looks like this:
288
289 -GENerate address‐range -data‐source
290
291 The -data‐source may be one of the following:
292
293 -CONSTant byte‐value
294 This generator manufactures data with the given byte value of
295 the the given address range. It is an error if the byte‐value
296 is not in the range 0..255.
297
298 For example, to fill memory addresses 100..199 with newlines
299 (0x0A), you could use a command like
300
301 srec_cat -generate 100 200 -constant 10 -o newlines.srec
302
303 This can, of course, be combined with data from files.
304
305 -REPeat_Data byte‐value...
306 This generator manufactures data with the given byte values
307 repeating over the the given address range. It is an error if
308 any of the the byte‐values are not in the range 0..255.
309
310 For example, to create a data region with 0xDE in the even
311 bytes and 0xAD in the odd bytes, use a generator like this:
312
313 srec_cat -generate 0x1000 0x2000 -repeat‐data 0xDE 0xAD
314
315 The repeat boundaries are aligned with the base of the address
316 range, modulo the number of bytes.
317
318 -REPeat_String text
319 This generator is almost identical to -repeat‐data except that
320 the data to be repeated is the text of the given string.
321
322 For example, to fill the holes in an EPROM image eprom.srec
323 with the text “Copyright (C) 1812 Tchaikovsky”, combine a gen‐
324 erator and an -exclude filter, such as the command
325
326 If you need to inject binary data into the string (e.g. a ter‐
327 minating NUL character), use the URL encoding that uses % fol‐
328 lowed by two hexadeimal characters. For example a backspace
329 would be encoded as “%08”.
330
331 srec_cat eprom.srec \
332 -generate 0 0x100000 \
333 -repeat‐string 'Copyright (C) 1812 Tchaikovsky. ' \
334 -exclude -within eprom.srec \
335 -o eprom.filled.srec
336
337 The thing to note is that we have two data sources: the
338 eprom.srec file, and generated data over an address range which
339 covers first megabyte of memory but excluding areas covered by
340 the eprom.srec data.
341
342 -CONSTant_Little_Endian value width
343 This generator manufactures data with the given numeric value,
344 of a given byte width, in little‐endian byte order. It is an
345 error if the given value does not fit into the given byte
346 width. It will repeat over and over within the address range
347 range.
348
349 For example, to insert a subversion commit number into 4 bytes
350 at 0x0008..0x000B you would use a command like
351
352 srec_cat -generate 8 12 -constant‐l‐e $VERSION 4 \
353 -o version.srec
354
355 This generator is a convenience wrapper around the -REPeat_Data
356 generator. It can, of course, be combined with data from
357 files.
358
359 -CONSTant_Big_Endian value width
360 As above, but using big‐endian byte ordering.
361
362 Anything else will result in an error.
363
364 Input Filters
365 You may specify zero or more filters to be applied. Filters are
366 applied in the order the user specifies.
367
368 -Adler_16_Big_Endian address
369 This filter may be used to insert an “Adler” 16‐bit checksum of
370 the data into the data. Two bytes, big‐endian order, are
371 inserted at the address given. Holes in the input data are
372 ignored. Bytes are processed in ascending address order (not
373 in the order they appear in the input).
374
375 Note: If you have holes in your data, you will get a different
376 Adler checksum than if there were no holes. This is important
377 because the in‐memory EPROM image will not have holes. You
378 almost always want to use the -fill filter before any of the
379 Adler checksum filters. You will receive a warning if the data
380 presented for Adler checksum has holes.
381
382 You should also be aware that the lower and upper bounds of
383 your data may not be the same as the lower and upper bounds of
384 your EPROM. This is another reason to use the -fill filter,
385 because it will establish the data across the full EPROM
386 address range.
387
388 http://en.wikipedia.org/wiki/Adler‐32
389
390 -Adler_16_Little_Endian address
391 This filter may be used to insert an Adler 16‐bit checksum of
392 the data into the data. Two bytes, in little‐endian order, are
393 inserted at the address given. Holes in the input data are
394 ignored. Bytes are processed in ascending address order (not
395 in the order they appear in the input).
396
397 Note: If you have holes in your data, you will get a different
398 Adler checksum than if there were no holes. This is important
399 because the in‐memory EPROM image will not have holes. You
400 almost always want to use the -fill filter before any of the
401 Adler filters. You will receive a warning if the data pre‐
402 sented for Adler checksum has holes.
403
404 You should also be aware that the lower and upper bounds of
405 your data may not be the same as the lower and upper bounds of
406 your EPROM. This is another reason to use the -fill filter,
407 because it will establish the data across the full EPROM
408 address range.
409
410 http://en.wikipedia.org/wiki/Adler‐32
411
412 -Adler_32_Big_Endian address
413 This filter may be used to insert a Adler 32‐bit checksum of
414 the data into the data. Four bytes, big‐endian order, are
415 inserted at the address given. Holes in the input data are
416 ignored. Bytes are processed in ascending address order (not
417 in the order they appear in the input).
418
419 Note: If you have holes in your data, you will get a different
420 Adler checksum than if there were no holes. This is important
421 because the in‐memory EPROM image will not have holes. You
422 almost always want to use the -fill filter before any of the
423 Adler checksum filters. You will receive a warning if the data
424 presented for Adler checksum has holes.
425
426 You should also be aware that the lower and upper bounds of
427 your data may not be the same as the lower and upper bounds of
428 your EPROM. This is another reason to use the -fill filter,
429 because it will establish the data across the full EPROM
430 address range.
431
432 http://en.wikipedia.org/wiki/Adler‐32
433
434 -Adler_32_Little_Endian address
435 This filter may be used to insert a Adler 32‐bit checksum of
436 the data into the data. Four bytes, in little‐endian order,
437 are inserted at the address given. Holes in the input data are
438 ignored. Bytes are processed in ascending address order (not
439 in the order they appear in the input).
440
441 Note: If you have holes in your data, you will get a different
442 Adler checksum than if there were no holes. This is important
443 because the in‐memory EPROM image will not have holes. You
444 almost always want to use the -fill filter before any of the
445 Adler checksum filters. You will receive a warning if the data
446 presented for Adler checksum has holes.
447
448 You should also be aware that the lower and upper bounds of
449 your data may not be the same as the lower and upper bounds of
450 your EPROM. This is another reason to use the -fill filter,
451 because it will establish the data across the full EPROM
452 address range.
453
454 http://en.wikipedia.org/wiki/Adler‐32
455
456 -AND value
457 This filter may be used to bit‐wise AND a value to every data
458 byte. This is useful if you need to clear bits. Only existing
459 data is altered, no holes are filled.
460
461 -Bit_Reverse [ width ]
462 This filter may be used to reverse the order of the bits in
463 each data byte. By specifying a width (in bytes) it is possi‐
464 ble to reverse the order multi‐byte values; this is implemented
465 using the byte‐swap filter.
466
467 -Byte_Swap [ width ]
468 This filter may be used to swap pairs of odd and even bytes.
469 By specifying a width (in bytes) it is possible to reverse the
470 order of 4 and 8 bytes, the default is 2 bytes. (Widths in
471 excess of 8 are assumed to be number of bits.) It is not pos‐
472 sible to swap non‐power‐of‐two addresses. To change the align‐
473 ment, use the offset filter before and after.
474
475 -Checksum_BitNot_Big_Endian address [ nbytes [ width ]]
476 This filter may be used to insert the one's complement checksum
477 of the data into the data, most significant byte first. The
478 data is literally summed; if there are duplicate bytes, this
479 will produce an incorrect result, if there are holes, it will
480 be as if they were filled with zeros. If the data already con‐
481 tains bytes at the checksum location, you need to use an
482 exclude filter, or this will generate errors. You need to
483 apply and crop or fill filters before this filter. The value
484 will be written with the most significant byte first. The num‐
485 ber of bytes of resulting checksum defaults to 4. The width
486 (the width in bytes of the values being summed) defaults to 1.
487
488 -Checksum_BitNot_Little_Endian address [ nbytes [ width ]]
489 This filter may be used to insert the one's complement (bitnot)
490 checksum of the data into the data, least significant byte
491 first. Otherwise similar to the above.
492
493 -Checksum_Negative_Big_Endian address [ nbytes [ width ]]
494 This filter may be used to insert the two's complement (nega‐
495 tive) checksum of the data into the data. Otherwise similar to
496 the above.
497
498 -Checksum_Negative_Little_Endian address [ nbytes [ width ]]
499 This filter may be used to insert the two's complement (nega‐
500 tive) checksum of the data into the data. Otherwise similar to
501 the above.
502
503 -Checksum_Positive_Big_Endian address [ nbytes [ width ]]
504 This filter may be used to insert the simple checksum of the
505 data into the data. Otherwise similar to the above.
506
507 -Checksum_Positive_Little_Endian address [ nbytes [ width ]]
508 This filter may be used to insert the simple checksum of the
509 data into the data. Otherwise similar to the above.
510
511 -CRC16_Big_Endian address [ modifier... ]
512 This filter may be used to insert an industry standard 16‐bit
513 CRC checksum of the data into the data. Two bytes, big‐endian
514 order, are inserted at the address given. Holes in the input
515 data are ignored. Bytes are processed in ascending address
516 order (not in the order they appear in the input).
517
518 The following additional modifiers are understood:
519
520 number Set the polynomial to be used to the given number.
521
522 -POLYnomial name
523 This option may be used to set the CRC polynomial to be
524 used, by name. The known names include:
525
526 ibm 0x8005
527 ansi 0x8005
528 ccitt 0x1021
529 t10‐dif 0x8bb7
530 dnp 0x3d65
531 dect 0x0589
532
533 See http://en.wikipedia.org/wiki/Cyclic_redun‐
534 dancy_check for a table of names and values.
535
536 -Most_To_Least
537 The CRC calculation is performed with the most signifi‐
538 cant bit in each byte processed first, and then pro‐
539 ceeding towards the least significant bit. This is the
540 default.
541
542 -Least_To_Most
543 The CRC calculation is performed with the least signif‐
544 icant bit in each byte processed first, and then pro‐
545 ceeding towards the most significant bit.
546
547 -CCITT The CCITT calculation is performed. The initial seed
548 is 0xFFFF. This is the default.
549
550 -XMODEM The alternate XMODEM calculation is performed. The
551 initial seed is 0x0000.
552
553 -BROKEN A common‐but‐broken calculation is performed (see note
554 2 below). The initial seed is 0x84CF.
555
556 -AUGment
557 The CRC is augmented by sixteen zero bits at the end of
558 the calculation. This is the default.
559
560 -No‐AUGment
561 The CRC is not augmented at the end of the calculation.
562 This is less standard conforming, but some implementa‐
563 tions do this.
564
565 Note: If you have holes in your data, you will get a different
566 CRC than if there were no holes. This is important because the
567 in‐memory EPROM image will not have holes. You almost always
568 want to use the -fill filter before any of the CRC filters.
569 You will receive a warning if the data presented for CRC has
570 holes.
571
572 You should also be aware that the lower and upper bounds of
573 your data may not be the same as the lower and upper bounds of
574 your EPROM. This is another reason to use the -fill filter,
575 because it will establish the data across the full EPROM
576 address range.
577
578 Note 2: there are a great many CRC16 implementations out there,
579 see http://www.joegeluso.com/software/articles/ccitt.htm (now
580 gone, reproduced at http://srecord.sourceforge.net‐
581 /crc16-ccitt.html) and “A painless guide to CRC error detection
582 algorithms” http://www.repairfaq.org/filipg/LINK/F_crc_v3.html
583 for more information. If all else fails, SRecord is open
584 source software: read the SRecord source code. The CRC16
585 source code (found in the srecord/crc16.cc file of the distri‐
586 bution tarball) has a great many explanatory comments.
587
588 Please try all twelve combinations of the above options before
589 reporting a bug in the CRC16 calculation.
590
591 -CRC16_Little_Endian address [ modifier... ]
592 The same as the -CRC16_Big_Endian filter, except in little‐
593 endian byte order.
594
595 -CRC32_Big_Endian address [ modifier... ]
596 This filter may be used to insert an industry standard 32‐bit
597 CRC checksum of the data into the data. Four bytes, big‐endian
598 order, are inserted at the address given. Holes in the input
599 data are ignored. Bytes are processed in ascending address
600 order (not in the order they appear in the input). See also
601 the note about holes, above.
602
603 The following additional modifiers are understood:
604
605 -CCITT The CCITT calculation is performed. The initial seed
606 is all one bits. This is the default.
607
608 -XMODEM An alternate XMODEM‐style calculation is performed.
609 The initial seed is all zero bits.
610
611 -CRC32_Little_Endian address
612 The same as the -CRC32_Big_Endian filter, except in little‐
613 endian byte order.
614
615 -Crop address‐range
616 This filter may be used to isolate a section of data, and dis‐
617 card the rest.
618
619 -Exclude address‐range
620 This filter may be used to exclude a section of data, and keep
621 the rest. The is the logical complement of the -Crop filter.
622
623 -Exclusive_Length_Big_Endian address [ nbytes [ width ]]
624 The same as the -Length_Big_Endian filter, except that the
625 result does not include the length itself.
626
627 -Exclusive_Length_Little_Endian address [ nbytes [ width ]]
628 The same as the -Length_Little_Endian filter, except that the
629 result does not include the length itself.
630
631 -Exclusive_MAXimum_Big_Endian address [ nbytes ]
632 The same as the -MAXimum_Big_Endian filter, except that the
633 result does not include the maximum itself.
634
635 -Exclusive_MAXimum_Little_Endian address [ nbytes ]
636 The same as the -MAXimum_Little_Endian filter, except that the
637 result does not include the maximum itself.
638
639 -Exclusive_MINimum_Big_Endian address [ nbytes ]
640 The same as the -MINimum_Big_Endian filter, except that the
641 result does not include the minimum itself.
642
643 -Exclusive_MINimum_Little_Endian address [ nbytes ]
644 The same as the -MINimum_Little_Endian filter, except that the
645 result does not include the minimum itself.
646
647 -eXclusive‐OR value
648 This filter may be used to bit‐wise XOR a value to every data
649 byte. This is useful if you need to invert bits. Only exist‐
650 ing data is altered, no holes are filled.
651
652 -Fill value address‐range
653 This filter may be used to fill any gaps in the data with bytes
654 equal to value. The fill will only occur in the address range
655 given.
656
657 -Fletcher_16_Big_Endian address [ sum1 sum2 [ answer ]]
658 This filter may be used to insert an Fletcher 16‐bit checksum
659 of the data into the data. Two bytes, big‐endian order, are
660 inserted at the address given. Holes in the input data are
661 ignored. Bytes are processed in ascending address order (not
662 in the order they appear in the input).
663
664 Note: If you have holes in your data, you will get a different
665 Fletcher checksum than if there were no holes. This is impor‐
666 tant because the in‐memory EPROM image will not have holes.
667 You almost always want to use the -fill filter before any of
668 the Fletcher checksum filters. You will receive a warning if
669 the data presented for Fletcher checksum has holes.
670
671 You should also be aware that the lower and upper bounds of
672 your data may not be the same as the lower and upper bounds of
673 your EPROM. This is another reason to use the -fill filter,
674 because it will establish the data across the full EPROM
675 address range.
676
677 http://en.wikipedia.org/wiki/Fletcher%27s_checksum
678
679 It is possible to select seed values for sum1 and sum2 in the
680 algorithm, by adding seed values on the command line. They
681 each default to 0xFF if not explicitly stated. The default
682 values (0) means that an empty EPROM (all 0x00 or all 0xFF)
683 will sum to zero; by changing the seeds, an empty EPROM will
684 always fail.
685
686 The third optional argument is the desired sum, when the check‐
687 sum itself is summed. A common value is 0x0000, placed in the
688 last two bytes of an EPROM, so that the Fletcher 16 checksum of
689 the EPROM is exactly 0x0000. No manipulation of the final
690 value is performed if this value if not specified.
691
692 -Fletcher_16_Little_Endian address
693 This filter may be used to insert an Fletcher 16‐bit checksum
694 of the data into the data. Two bytes, in little‐endian order,
695 are inserted at the address given. Holes in the input data are
696 ignored. Bytes are processed in ascending address order (not
697 in the order they appear in the input).
698
699 Note: If you have holes in your data, you will get a different
700 Fletcher checksum than if there were no holes. This is impor‐
701 tant because the in‐memory EPROM image will not have holes.
702 You almost always want to use the -fill filter before any of
703 the Fletcher filters. You will receive a warning if the data
704 presented for Fletcher checksum has holes.
705
706 You should also be aware that the lower and upper bounds of
707 your data may not be the same as the lower and upper bounds of
708 your EPROM. This is another reason to use the -fill filter,
709 because it will establish the data across the full EPROM
710 address range.
711
712 http://en.wikipedia.org/wiki/Fletcher%27s_checksum
713
714 -Fletcher_32_Big_Endian address
715 This filter may be used to insert a Fletcher 32‐bit checksum of
716 the data into the data. Four bytes, big‐endian order, are
717 inserted at the address given. Holes in the input data are
718 ignored. Bytes are processed in ascending address order (not
719 in the order they appear in the input).
720
721 Note: If you have holes in your data, you will get a different
722 Fletcher checksum than if there were no holes. This is impor‐
723 tant because the in‐memory EPROM image will not have holes.
724 You almost always want to use the -fill filter before any of
725 the Fletcher checksum filters. You will receive a warning if
726 the data presented for Fletcher checksum has holes.
727
728 You should also be aware that the lower and upper bounds of
729 your data may not be the same as the lower and upper bounds of
730 your EPROM. This is another reason to use the -fill filter,
731 because it will establish the data across the full EPROM
732 address range.
733
734 http://en.wikipedia.org/wiki/Fletcher%27s_checksum
735
736 -Fletcher_32_Little_Endian address
737 This filter may be used to insert a Fletcher 32‐bit checksum of
738 the data into the data. Four bytes, in little‐endian order,
739 are inserted at the address given. Holes in the input data are
740 ignored. Bytes are processed in ascending address order (not
741 in the order they appear in the input).
742
743 Note: If you have holes in your data, you will get a different
744 Fletcher checksum than if there were no holes. This is impor‐
745 tant because the in‐memory EPROM image will not have holes.
746 You almost always want to use the -fill filter before any of
747 the Fletcher checksum filters. You will receive a warning if
748 the data presented for Fletcher checksum has holes.
749
750 You should also be aware that the lower and upper bounds of
751 your data may not be the same as the lower and upper bounds of
752 your EPROM. This is another reason to use the -fill filter,
753 because it will establish the data across the full EPROM
754 address range.
755
756 http://en.wikipedia.org/wiki/Fletcher%27s_checksum
757
758 -Length_Big_Endian address [ nbytes [ width ]]
759 This filter may be used to insert the length of the data (high
760 water minus low water) into the data. This includes the length
761 itself. If the data already contains bytes at the length loca‐
762 tion, you need to use an exclude filter, or this will generate
763 errors. The value will be written with the most significant
764 byte first. The number of bytes defaults to 4. The width
765 defaults to 1, and is divided into the actual length, thus you
766 can insert the width in units of words (2) or longs (4).
767
768 -Length_Little_Endian address [ nbytes [ width ]]
769 The same as the -Length_Big_Endian filter, except the value
770 will be written with the least significant byte first.
771
772 -MAXimum_Big_Endian address [ nbytes ]
773 This filter may be used to insert the maximum address of the
774 data (high water
775 + 1) into the data. This includes the maximum itself. If the
776 data already contains bytes at the given address, you need to
777 use an exclude filter, or this will generate errors. The value
778 will be written with the most significant byte first. The num‐
779 ber of bytes defaults to 4.
780
781 -MAXimum_Little_Endian address [ nbytes ]
782 The same as the -MAXimum_Big_Endian filter, except the value
783 will be written with the least significant byte first.
784
785 -Message_Digest_5 address
786 This filter may be used to insert a 16 byte MD5 hash into the
787 data, at the address given.
788
789 -MINimum_Big_Endian address [ nbytes ]
790 This filter may be used to insert the minimum address of the
791 data (low water) into the data. This includes the minimum
792 itself. If the data already contains bytes at the given
793 address, you need to use an exclude filter, or this will gener‐
794 ate errors. The value will be written with the most signifi‐
795 cant byte first. The number of bytes defaults to 4.
796
797 -MINimum_Little_Endian address [ nbytes ]
798 The same as the -MINimum_Big_Endian filter, except the value
799 will be written with the least significant byte first.
800
801 -NOT This filter may be used to bit‐wise NOT the value of every data
802 byte. This is useful if you need to invert the data. Only
803 existing data is altered, no holes are filled.
804
805 -OFfset nbytes
806 This filter may be used to offset the addresses by the given
807 number of bytes. No data is lost, the addresses will wrap
808 around in 32 bits, if necessary. You may use negative numbers
809 for the offset, if you wish to move data lower in memory.
810
811 Please note: the execution start address is a different concept
812 than the first address in memory of your data. If you want to
813 change where your monitor will start executing, use the -execu‐
814 tion‐start‐address option (srec_cat(1) only).
815
816 -OR value
817 This filter may be used to bit‐wise OR a value to every data
818 byte. This is useful if you need to set bits. Only existing
819 data is altered, no holes are filled.
820
821 -Random_Fill address‐range
822 This filter may be used to fill any gaps in the data with ran‐
823 dom bytes. The fill will only occur in the address range
824 given.
825
826 -Ripe_Message_Digest_160 address
827 This filter may be used to insert an RMD160 hash into the data.
828
829 -Secure_Hash_Algorithm_1 address
830 This filter may be used to insert a 20 byte SHA1 hash into the
831 data, at the address given.
832
833 -Secure_Hash_Algorithm_224 address
834 This filter may be used to insert a 28 byte SHA224 hash into
835 the data, at the address given. See Change Notice 1 for FIPS
836 180‐2 for the specification.
837
838 -Secure_Hash_Algorithm_256 address
839 This filter may be used to insert a 32 byte SHA256 hash into
840 the data, at the address given. See FIPS 180‐2 for the speci‐
841 fication.
842
843 -Secure_Hash_Algorithm_384 address
844 This filter may be used to insert a 48 byte SHA384 hash into
845 the data, at the address given. See FIPS 180‐2 for the speci‐
846 fication.
847
848 -Secure_Hash_Algorithm_512 address
849 This filter may be used to insert a 64 byte SHA512 hash into
850 the data, at the address given. See FIPS 180‐2 for the speci‐
851 fication.
852
853 -SPlit multiple [ offset [ width ] ]
854 This filter may be used to split the input into a subset of the
855 data, and compress the address range so as to leave no gaps.
856 This useful for wide data buses and memory striping. The mul‐
857 tiple is the bytes multiple to split over, the offset is the
858 byte offset into this range (defaults to 0), the width is the
859 number of bytes to extract (defaults to 1) within the multiple.
860 In order to leave no gaps, the output addresses are (width /
861 multiple) times the input addresses.
862
863 -STM32 address
864 This is a synonym for the -STM32_Little_Endian filter.
865
866 -STM32_Little_Endian address
867
868 -STM32_Big_Endian address
869 These filters many be use to generate the CRC used by the hard‐
870 ware CRC unit on the STM32 series of ARM MPUs. The algorithm
871 used by the STM32 hardware unit is just a CRC32 with a differ‐
872 ent polynomial and word‐fed instead of byte‐fed.
873
874 The address is where to place the 4‐byte STM32 CRC.
875
876 The CRC used is documented in “RM0041, STM32F100xx reference
877 manual”, page 46, chapter “CRC Calculation Unit”, which can be
878 found at
879 http://www.st.com/internet/mcu/product/216844.jsp
880
881 -TIGer address
882 This filter may be used to insert a 24 byte TIGER/192 hash into
883 the data at the address given.
884
885 -UnFill value [ min‐run‐length ]
886 This filter may be used to create gaps in the data with bytes
887 equal to value. You can think of it as reversing the effects
888 of the -Fill filter. The gaps will only be created if the are
889 at least min‐run‐length bytes in a row (defaults to 1).
890
891 -Un_SPlit multiple [ offset [ width ] ]
892 This filter may be used to reverse the effects of the split
893 filter. The arguments are identical. Note that the address
894 range is expanded (multiple / width) times, leaving holes
895 between the stripes.
896
897 -WHIrlpool address
898 This filter may be used to insert a 64 byte WHIRLPOOL hash into
899 the data, at the address given.
900
901 Address Ranges
902 There are eight ways to specify an address range:
903
904 minimum maximum
905 If you specify two number on the command line (decimal, octal
906 and hexadecimal are understood, using the C conventions) this
907 is an explicit address range. The minimum is inclusive, the
908 maximum is exclusive (one more than the last address). If the
909 maximum is given as zero then the range extends to the end of
910 the address space.
911
912 -Within input‐specification
913 This says to use the specified input file as a mask. The range
914 includes all the places the specified input has data, and holes
915 where it has holes. The input specification need not be just a
916 file name, it may be anything any other input specification can
917 be.
918
919 See also the -over option for a discussion on operator prece‐
920 dence.
921
922 -OVER input‐specification
923 This says to use the specified input file as a mask. The range
924 extends from the minimum to the maximum address used by the
925 input, without any holes, even if the input has holes. The
926 input specification need not be just a file name, it may be
927 anything any other input specification can be.
928
929 You may need to enclose input‐specification in parentheses to
930 make sure it can't misinterpret which arguments go with which
931 input specification. This is particularly important when a
932 filter is to follow. For example
933 filename -fill 0 -over filename2 -swap‐bytes
934 groups as
935 filename -fill 0 -over '(' filename2 -swap‐bytes ')'
936 when what you actually wanted was
937 '(' filename -fill 0 -over filename2 ')' -swap‐bytes
938 The command line expression parsing tends to be “greedy” (or
939 right associative) rather than conservative (or left associa‐
940 tive).
941
942 address‐range -RAnge‐PADding number
943 It is also possible to pad ranges to be whole aligned multiples
944 of the given number. For example
945 input‐file -fill 0xFF -within input‐file -range‐pad 512
946 will fill the input‐file so that it consists of whole 512‐byte
947 blocks, aligned on 512 byte boundaries. Any large holes in the
948 data will also be multiples of 512 bytes, though they may have
949 been shrunk as blocks before and after are padded.
950
951 This operator has the same precedence as the explicit union
952 operator.
953
954 address‐range -INTERsect address‐range
955 You can intersect two address ranges to produce a smaller
956 address range. The intersection operator has higher precedence
957 than the implicit union operator (evaluated left to right).
958
959 address‐range -UNIon address‐range
960 You can union two address ranges to produce a larger address
961 range. The union operator has lower precedence than the inter‐
962 section operator (evaluated left to right).
963
964 address‐range -DIFference address‐range
965 You can difference two address ranges to produce a smaller
966 address range. The result is the left hand range with all of
967 the right hand range removed. The difference operator has the
968 same precedence as the implicit union operator (evaluated left
969 to right).
970
971 address‐range address‐range
972 In addition, all of these methods may be used, and used more
973 than once, and the results will be combined (implicit union
974 operator, same precedence as explicit union operator).
975
976 Calculated Values
977 Most of the places above where a number is expected, you may supply one
978 of the following:
979
980 - value
981 The value of this expression is the negative of the expression
982 argument. Note the space between the minus sign and its argu‐
983 ment: this space is mandatory.
984 srec_cat in.srec -offset − -minimum‐addr in.srec -o
985 out.srec
986 This example shows how to move data to the base of memory.
987
988 ( value )
989 You may use parentheses for grouping. When using parentheses,
990 they must each be a separate command line argument, they can't
991 be within the text of the preceding or following option, and
992 you will need to quote them to get them past the shell, such as
993 '(' and ')'.
994
995 -MINimum‐Address input‐specification
996 This inserts the minimum address of the specified input file.
997 The input specification need not be just a file name, it may be
998 anything any other input specification can be.
999
1000 See also the -over option for a discussion on operator prece‐
1001 dence.
1002
1003 -MAXimum‐Address input‐specification
1004 This inserts the maximum address of the specified input file,
1005 plus one. The input specification need not be just a file
1006 name, it may be anything any other input specification can be.
1007
1008 See also the -over option for a discussion on operator prece‐
1009 dence.
1010
1011 -Length input‐specification
1012 This inserts the length of the address range in the specified
1013 input file, ignoring any holes. The input specification need
1014 not be just a file name, it may be anything any other input
1015 specification can be.
1016
1017 See also the -over option for a discussion on operator prece‐
1018 dence.
1019
1020 For example, the -OVER input‐specification option can be thought of as
1021 short‐hand for '(' -min file -max file ')', except that it is much eas‐
1022 ier to type, and also more efficient.
1023
1024 In addition, calculated values may optionally be rounded in one of
1025 three ways:
1026
1027 value -Round_Down number
1028 The value is rounded down to the the largest integer smaller
1029 than or equal to a whole multiple of the number.
1030
1031 value -Round_Nearest number
1032 The value is rounded to the the nearest whole multiple of the
1033 number.
1034
1035 value -Round_Up number
1036 The value is rounded up to the the smallest integer larger than
1037 or equal to a whole multiple of the number.
1038
1039 When using parentheses, they must each be a separate command line argu‐
1040 ment, they can't be within the text of the preceding or following
1041 option, and you will need to quote them to get them past the shell, as
1042 '(' and ')'.
1043
1045 srec_input version 1.64
1046 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
1047 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Peter Miller
1048
1049 The srec_input program comes with ABSOLUTELY NO WARRANTY; for details
1050 use the 'srec_input -VERSion License' command. This is free software
1051 and you are welcome to redistribute it under certain conditions; for
1052 details use the 'srec_input -VERSion License' command.
1053
1055 Scott Finneran E‐Mail: scottfinneran@yahoo.com.au
1056 Peter Miller E‐Mail: pmiller@opensource.org.au
1057
1058
1059
1060Reference Manual SRecord srec_input(1)