This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: still problems linking plain data into an application (arm-elf)
- To: "Andreas Bürgel" <Andreas dot Buergel at web dot de>
- Subject: Re: still problems linking plain data into an application (arm-elf)
- From: Nick Clifton <nickc at cambridge dot redhat dot com>
- Date: 29 May 2001 09:54:48 +0100
- Cc: binutils at sources dot redhat dot com
- References: <200105281634.f4SGYk801698@mailgate3.cinetic.de>
Hi Andreas,
> I want to link a plain data file - hex format or binary - into my
> application. Currently I'm using a linker script with an
> input-command "INPUT (<DATAFILE>)". Unfortunately the only format
> the linker pretends to recognize ist "Intel Hex", using other
> formats I get a " File format not recognized"-error.
Another way to solve this problem is to use objcopy to convert the
data file into an ELF format file and then just link it in. For
example:
objcopy -I binary -O elf32-little-arm data_file new_object.o
You may get an error message "Warning: Output file cannot represent
architecture UNKNOWN!" in which case add a -B option like this:
objcopy -I binary -O elf32-little-arm -B arm data_file new_object.o
This will create an object file with the data in a .data section. If
this is unsuitable you can then use the linker and a small little
script to rename the section to something else, as in:
ld -T convert.ls new_object.o -o resectioned_object.o
and the linker script looks like:
SECTIONS
{
.new_section_name : { *(.data) }
}
Cheers
Nick