still problems linking plain data into an application (arm-elf)
Nick Clifton
nickc@cambridge.redhat.com
Tue May 29 00:56:00 GMT 2001
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
More information about the Binutils
mailing list