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: Cross debugger and load address (want download to VMA, not LMA)


On Mon, Apr 19, 2004 at 09:58:39AM -0500, Bill Gatliff wrote:

> >>toralf>> If not, is there any way to produce a version of the binary
> >>	 with LMA = VMA for .text and .data, besides relinking with a
> >>	 separate linker script?
> >>   
> >>
> >
> >You can use objcopy to change both the LMA and VMA of sections.
> >
> 
> Does that work for code that isn't position-independent, though?

I expect not.

> (I haven't tried this in a while)

Changing the LMA will change the location where the section's
contents get loaded.  Changing the VMA probably won't do
anything useful for the context in which the question was asked.

> For example, one can envision an extreme case where they use objcopy on 
> an S-Record file to move the LMA, and the first branch instruction in 
> the program goes back to the old address...

Exactly.

But it does work fine for puttting the contents of the .data
section into ROM so they can be loaded into RAM by startup
code.  Likewise you can use it to load .text into ROM so that
it can later be copied into RAM at the VMA expected by the
linker.

-- 
Grant Edwards
grante@visi.com

------
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]