This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Byte-swapping S-record output in objcopy?
- From: Ian Lance Taylor <ian at wasabisystems dot com>
- To: "Zack Weinberg" <zack at codesourcery dot com>
- Cc: binutils <binutils at sources dot redhat dot com>
- Date: 22 Jan 2004 03:40:00 -0500
- Subject: Re: Byte-swapping S-record output in objcopy?
- References: <87wu7kjs7v.fsf@egil.codesourcery.com>
"Zack Weinberg" <zack@codesourcery.com> writes:
> One of CodeSourcery's customers has asked us for ideas about how to
> handle a fairly peculiar situation, to wit: There are ARM embedded
> systems where the initial boot (from ROM) is in big-endian mode, but
> after everything comes up the operating system runs in little-endian
> mode. To handle this properly, the ROM image needs to be generated
> little-endian and then byte-swapped before the ROM is burnt.
It seems to me that you would need to compile/assemble the ROM in
big-endian mode, and the rest in little-endian mode. Is simple byte
swapping enough? Maybe it is if the ROM is all assembly code.
> The image is compiled to ELF, the ROM burner takes S-records, so one
> obvious approach is to add a byte-swapping mode to objcopy -O srec. I
> was wondering, first, whether there is already a way to do something
> like that, and second, if there isn't, whether a patch to add such a
> feature would be accepted.
I don't think there is a feature like that now. It would be pretty
simple to write a program to byte-swap S-records. You could almost do
it in sed. But I suppose another objcopy argument would be OK too.
Ian