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

Toralf Lund toralf@procaptura.com
Fri Apr 16 13:50:00 GMT 2004


Bill Gatliff wrote:

> Toralf:
>
>
> I usually just have two linker command scripts: one for flash, one for 
> RAM.  They differ only in their specifications for LMA.

Yeah, maybe that's not so bad... I generally fear such solutions, as I 
know from experience that when you maintain two files that's supposed to 
contain the same information, you'll sooner or later edit one of them 
and forget about the other. But, I can of course do something like

%.dbg.ld: %.ld
    $(RM) $@
    @echo "/* *** GENERATED, do not edit (consult $< instead) */" > $@
    sed "s/AT[[:space:]]*>.*//" < $< >> $@

in (GNU) make to avoid such issues...

- T

>
> b.g.
>
>
> Toralf Lund wrote:
>
>> 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
>>
>


-- 
Toralf Lund <toralf@procaptura.com> +47 66 85 51 22
ProCaptura AS                       +47 66 85 51 00 (switchboard)
http://www.procaptura.com/~toralf   +47 66 85 51 01 (fax)


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