* objcopy.c: Add --interleave-width option to allow interleaving

of more than one byte at a time.
        (copy_width): New variable.
        (copy_options): Add --interleave-width.
        (copy_section): When interleaving copy in units of copy_width
        bytes.
        (copy_main): Parse the new option.
        * doc/binutils: Document the new option.
        * NEWS: Mention the new feature.

        * binutils-all/objcopy.exp: Add test of new --interleave-width
        option.
This commit is contained in:
Nick Clifton
2010-09-10 12:11:28 +00:00
parent fca41f0f72
commit b7dd81f7c5
6 changed files with 128 additions and 24 deletions

View File

@@ -1017,7 +1017,8 @@ objcopy [@option{-F} @var{bfdname}|@option{--target=}@var{bfdname}]
[@option{-x}|@option{--discard-all}]
[@option{-X}|@option{--discard-locals}]
[@option{-b} @var{byte}|@option{--byte=}@var{byte}]
[@option{-i} @var{interleave}|@option{--interleave=}@var{interleave}]
[@option{-i} [@var{breadth}]|@option{--interleave}[=@var{breadth}]]
[@option{--interleave-width=}@var{width}]
[@option{-j} @var{sectionname}|@option{--only-section=}@var{sectionname}]
[@option{-R} @var{sectionname}|@option{--remove-section=}@var{sectionname}]
[@option{-p}|@option{--preserve-dates}]
@@ -1239,19 +1240,42 @@ Do not copy compiler-generated local symbols.
@item -b @var{byte}
@itemx --byte=@var{byte}
Keep only every @var{byte}th byte of the input file (header data is not
affected). @var{byte} can be in the range from 0 to @var{interleave}-1,
where @var{interleave} is given by the @option{-i} or @option{--interleave}
option, or the default of 4. This option is useful for creating files
to program @sc{rom}. It is typically used with an @code{srec} output
target.
If interleaving has been enabled via the @option{--interleave} option
then start the range of bytes to keep at the @var{byte}th byte.
@var{byte} can be in the range from 0 to @var{breadth}-1, where
@var{breadth} is the value given by the @option{--interleave} option.
@item -i @var{interleave}
@itemx --interleave=@var{interleave}
Only copy one out of every @var{interleave} bytes. Select which byte to
copy with the @option{-b} or @option{--byte} option. The default is 4.
@command{objcopy} ignores this option if you do not specify either @option{-b} or
@option{--byte}.
@item -i [@var{breadth}]
@itemx --interleave[=@var{breadth}]
Only copy a range out of every @var{breadth} bytes. (Header data is
not affected). Select which byte in the range begins the copy with
the @option{--byte} option. Select the width of the range with the
@option{--interleave-width} option.
This option is useful for creating files to program @sc{rom}. It is
typically used with an @code{srec} output target. Note that
@command{objcopy} will complain if you do not specify the
@option{--byte} option as well.
The default interleave breadth is 4, so with @option{--byte} set to 0,
@command{objcopy} would copy the first byte out of every four bytes
from the input to the output.
@item --interleave-width=@var{width}
When used with the @option{--interleave} option, copy @var{width}
bytes at a time. The start of the range of bytes to be copied is set
by the @option{--byte} option, and the extent of the range is set with
the @option{--interleave} option.
The default value for this option is 1. The value of @var{width} plus
the @var{byte} value set by the @option{--byte} option must not exceed
the interleave breadth set by the @option{--interleave} option.
This option can be used to create images for two 16-bit flashes interleaved
in a 32-bit bus by passing @option{-b 0 -i 4 --interleave-width=2}
and @option{-b 2 -i 4 --interleave-width=2} to two @command{objcopy}
commands. If the input was '12345678' then the outputs would be
'1256' and '3478' respectively.
@item -p
@itemx --preserve-dates