This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Load a file into memory
Jesper Skov wrote:
>
> On Wed, 2002-02-20 at 05:16, Cristiano Ligieri Pereira wrote:
> >
> > Hi all,
> >
> > I have an application which needs to read some data previously written
> > into RAM memory. For example, lets say I have an image decompression
> > application but I can't read the image file from anywher on the fly. I
> > have to read it from some specific memory position and them process it.
> >
> > Can I load a data file (image, for instance) into my RAM memory using gdb
> > and them load and run the ecos application, which will in turn read the
> > file from memory and decode it?
>
> Create an ELF file from the binary data:
>
> echo > foo.c
> arm-elf-gcc -c -o foo.o foo.c
> arm-elf-objcopy --remove-section=.text foo.o
> arm-elf-objcopy --add-section=.text=thebinfile foo.o
> arm-elf-objcopy --set-section-flags=.text=alloc,load,code,contents,readonly foo.o
>
> then use objcopy with --change-address to change the data's location.
>
> Finally, load it with GDB (file + load commands), load the app (file +
> load), and start the application.
>
> Jesper
>
> --
> Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
> and search the list archive: http://sources.redhat.com/ml/ecos-discuss
You can also use arm-elf-ld as an alternative
arm-elf-ld -nostdlib -static -Tdata 0x25000 -b binary myfile.bin -o myfile.elf
That creates a static exec. elf that contains myfile.bin at requested address,
note there is a warning since "ld" set a default fake entry point.
Hope this may help.
--
Eric DONNAT
Silicomp Research Institute
2 avenue de Vignate, 38610 Gieres, France.
Phone +33 476 63 48 85 Fax +33 476 51 05 32
http://www.ri.silicomp.com
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss