GDB problem with 'section' attribute variable

Hi,

I need, for a simple application, in which I want to run a portion of code out of RAM at startup, to use a ram segment which is not yet used at that time.

For that purpose, I give a variable which will be used later in the firmware as heap (FreeRTOS with lwip) the ‘section’ attribute :

attribute ((section (“.ramheap”))) char ramheap;

However, as soon as size is arround 64, GDB does not work properly any more.

‘No source available for "start() "’

(start is the first instruction of boot.s, the entry point in assembler module, and startup breakpoint)

If I set size to 4, it works !

If I set the startup breakpoint at ‘main’, it works too.

However, if I add a program section that overlays on ramheap section (‘ram >flash’ in link script) , GDB does not show the source lines of that code, while it does if the program section is located at an address other than ramheap or bss (can be after bss or between ramheap and bss) (this is a second problem).

In another larger application, I’ve go the message

Dwarf Error: wrong version in compilation unit header (is 0, should be 2) [in module xxxx.elf]

and sometimes, with only an 8 byte variable with the attribute ‘section’ is enough to make GDB crash.

tools:

GDB version 6.8.50.

GCC 4.2.2. (option -gdwarf-2)

OpenOCD-r717

Eclipse 3.4

cpu: at91sam7x512

It looks like a bug in GDB …

I’ve tried another Eclipse project, the only fact of adding a ram section of at least 64 bytes makes GDB not find the breakpoint address…

thanks in advance for any tip.

JL

Hi,

Try to change the order of the sections in Linker Script file. Move the debugging sections to head of Linker Script file.

Felix