This is the mail archive of the gdb@sourceware.org mailing list for the GDB 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: use LMA instead of VMA?


Hi,

> > i'd like to test my startup code in crt0.S but have some problems
> > with that as gdb uses the sections VMA instead of the LMA.
>
> Why would this confuse gdb?  If the crt0 code is *running* it should
> already be at its VMA.  In the cases where LMA and VMA differ in my
> projects, it's because I need to initialize RAM from ROM, so I don't
> need gdb to know about the data until after I've moved it to its VMA.
>
> Maybe you need to tell us more about how your code is set up?

ok, maybe this needs some more explanation.  In a project i
use my own startup code and in this one i do several things:

- set up stack and registers
- clear .bss
- copy .data from ROM to RAM

To place the content of .data to ROM i use the following
in my linker script:

  .data :
  {
    *(.data)
    *(.data.*)
    *(.gnu.linkonce.d*)
    CONSTRUCTORS
  } > ram AT > rom

When i look at the section .data, "v850e-unknown-elf-objdump -h"
tells me (only .data):

Idx Name          Size      VMA       LMA       File off  Algn
  7 .data         00000828  03ff7000  0000730c  00009000  2**2
                  CONTENTS, ALLOC, LOAD, DATA

When i generate an SREC file that i burn into the flash micro
everything is placed where i expect it, the content of .data
is placed at LMA.

So my startup code needs to copy it from LMA to VMA, where the
rest of the code expects it.

But when i try to simulate it in GDB, GDB loads the content of
.data to VMA and i _must_ _not_ copy anything from LMA to VMA,
because at LMA there is just nothing.  The correct data are
already at VMA.

To my understanding every code that places something into .data
needs to behave like that.  That's why i think there could/should
be a standard solution.


At the moment i use -DREAL_TARGET=0 or =1 per command line to the
compiler and assembler and behave differently in the startup code
and very small parts of the rest of the code (I/O over serial line).
This works quite fine.  My  project behaves ok in the simulator now,
but not in the real target.

So i'd like to also test my startup code now, but at the moment i
don't see a way for that.

But maybe i miss something, if anybody had a solution for that that
would be great.


Best regards,
Torsten.
 


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