Cross debugger and load address (want download to VMA, not LMA)

Toralf Lund toralf@procaptura.com
Fri Apr 16 12:59:00 GMT 2004


I want to debug the software for our new board via gdb or insight built 
as a cross debugger. Now, the binary will usually be loaded via flash, 
but executed mostly from RAM, so it is linked with VMA for .text and 
.data set to RAM addresses, and LMA pointing to the flash area (as 
required by the flash routine.) However, when running through the 
debugger, I want to download directly to RAM, i.e. to VMA, but the 
debugger tries to write to LMA (of course) by default. What's the 
easiest way around this? Is there any way I can get the debugger to pick 
up the VMA for each of the sections instead, and use those as download 
target address? 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? I've tried to use objcopy option 
"--change-section-lma", but it's not easy to find the right parameters as

   1. I don't know the VMA or LMA for .data in advance - just that it
      follows immediately after .text
   2. I can't calculate an offset as I don't know the .text LMA, either
      - in the flash .text is preceded by a separate section containing
      interrupt vectors and RAM init routines, but this is never copied
      to RAM (so .text VMA is the beginning of RAM, but its LMA is *not*
      the beginning of flash.)

Ideas, anyone?

(As usual, I'm posting to this list as I know of no other way to reach 
people who build apps in way similar to the one discussed - the actual 
questions may be slightly off-topic...)

 -Toralf

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com



More information about the crossgcc mailing list