This is the mail archive of the
mailing list for the eCos project.
Re: Load a file into memory
- From: Jesper Skov <jskov at redhat dot com>
- To: Cristiano Ligieri Pereira <cpereira at ics dot uci dot edu>
- Cc: eCos Discuss <ecos-discuss at sources dot redhat dot com>
- Date: 20 Feb 2002 09:15:35 +0100
- Subject: Re: [ECOS] Load a file into memory
- References: <Pine.SOL.email@example.com>
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.
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss