This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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: malloc() never returns


Hi,

> It appears your static av_ array has been cleared.  Perhaps you have
> gone too far when clearing the .bss.  Track the static av_ array and see
> where it ends up after linking as well as what is in it.  That array
> should be initialized and non-zero by the time you get to main.  I don't
> have any experience with the v850 platform to give you any other direct
> suggestions.

thanks for your hint, it looks like you're right.

The array ___malloc_av_ is located in .data at 0x3ffe40c.
Or more precisely this is its VMA.

In my linker script i use the common way to place data into
ROM:

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

When i verify it with v850e-unknown-elf-objdump -h | grep .data
 7 .data         00000828  03ffe000  000071a8  00009000  2**2

Also, in hw2.srec at the expected offset of 0x040c (address of
___malloc_av_ - VMA(.data)) i see the expected data (at LMA(.data)
+ 0x40c):
S315000075A800000000FFFFFFFF0000020000000000CF
S315000075B8000000000CE4FF030CE4FF0314E4FF03DF
S315000075C814E4FF031CE4FF031CE4FF0324E4FF03A5
...


So all fits fine, except:
When i load the ELF file in "insight", i see the array ___malloc_av_
filled correctly, but after .data gets copied its all filled with 0x00.

So is it possible that GDB loads the sections in the ELF file to the
VMA and not to the LMA?


It looks to me like this, but this means that no program that uses
"> RAM AT > ROM" can run correctly in GDB, right?


Is there a standard solution to this standard problem?


Or do i misunderstand something here?


Best regards,
Torsten.


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