Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


GDB problem with 'section' attribute var

Posted by jean-luc on December 8, 2008

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[size];

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.

GDB version 6.8.50.
GCC 4.2.2. (option -gdwarf-2)
Eclipse 3.4

I can send a zip file with all the sources if necessary... it just a simple demo program, easy to reproduce...

thanks in advance for any tip.

RE: GDB problem with 'section' attribute var

Posted by Richard on December 8, 2008
I don't think I followed all that, but it sounds like this is not directly FreeRTOS.org related in any case, more a linker script issue.

Is it possible that you don't have the RAM free for this section? Maybe the FreeRTOS.org heap is sized to take up the entire RAM? Just a guess.


RE: GDB problem with 'section' attribute var

Posted by jean-luc on December 8, 2008
Hi richard,

no it's not a FreeRTOS related problem, but I was wondering whether a FreeRTOS user had encountered the same problem, since my problems are within my FreeRTOS + lwip application.

Even if FreeRTOS or lwip takes up all the ram, if I assign a 'section' attribute to that ram segment, the linker places it near the bss segment (as described in the linker script), and normaly all is working well.

But depending on that segment size, there are different behaviors, either GDB crashes, or it cannot set the initial breakpoint on 'start', the assembler entry point.

I think that something is wrong between GCC and GDB. for instance, when I declare a ram segment with the 'section' attribute and a size larger than 577 bytes, the readelf command with -wi argument gives the following messages :

readelf: Warning: Only version 2 and 3 DWARF debug information is currently supported.
readelf: Warning: Debug info is corrupted, length is invalid (section is 4302 bytes)

with size from 1 to 577 it seems to be OK.
and sometimes when a small program segment is declared with a section attribute too , these warnings do not appear...
I'm wondering what is wrong in the .elf file ? And I don't want to get inside.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS v10.2.1 is available for immediate download. MIT licensed, includes 64-bit RISC-V, NXP Cortex-M33 demo & Nuvoton Cortex-M23 demo.

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Cadence Tensilica Cortes

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers





STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner