This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: still problems linking plain data into an application (arm-elf)

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

  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 new_object.o -o resectioned_object.o

and the linker script looks like:

	.new_section_name : { *(.data) }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]