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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Load a file into memory

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:
and search the list archive:

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