This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


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: copy self from ROM to RAM


Hi

I'm doing the same thing in my project.

What you have to do is:

Write our own linker script. There you have to deal with LMA (load memory
address) not equal VMA (virtual memory address). How this works you can
find in documentation of gnu-ld (binutils). It's realy helpfull!
In our linkerscript you generate some symbols you can referenc to in your
application.

Write your own startupcode that is copying your code from ROM to RAM.
Therefor you can refernce your linkerscript symbols. After all call your
C main() function.

But take care, there may be another problem: If you havê somewhat like a
mix (some part of the program in ROM running form there, and some part of
the programm running from RAM) function calls may be to far for relative
calls. You have to tell the compiler that he should genearate long calls
(loading new address in a register and transfer it to pc).
Use __attribute__ to do so. Se gcc documentation for more information
about attributes!

alex


On Sat, 2 Feb 2002, Mike Dorin wrote:

>
> I have an application which runs out of RAM, and I can load it
> using GDB or a P&E Microsystems adapter.
>
> What do I have to do have some boot code copy the image from
> ROM to RAM at startup?
>
> Thanks,
> Mike
>
> _________________________________________________________________
> MSN Photos is the easiest way to share and print your photos:
> http://photos.msn.com/support/worldwide.aspx
>
>
> ------
> Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
> Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
>


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