3

I'm developing a project using a TI Tiva Microcontroller (TM4C123GH6PM), TivaWare (was StellarisWare) and GCC 4.8.2 (-14ubuntu1+6) on Linux.

While linking I started to get these error message:

arm-none-eabi-ld: section .ARM.exidx loaded at [00000000000027d8,00000000000027df] overlaps section .data loaded at [00000000000027d7,00000000000027d8]

I've done quite some googling but nothing I found seems to help.

  1. I found this question which is on the same topic but I don't do any stacktracing: When is .ARM.exidx is used

  2. It seems this section is mainly used in debugging C++ code. But I'm not using C++ ...

  3. I've tried to dump all my object files with -h to show the sections included. The only file containing ARM.exidx is libgcc.a.

  4. The error appears with no apparent patten (at least that I could find).

For example in main.c:

while( 1 ){
    debug_getc()
    uartA_getc()
}

produces that error. while

while( 1 ){
    debug_getc();
    //uartA_getc();
}

while( 1 ){
    debug_getc();
    //uartA_getc();
}

does not. (Both functions are in their own object file but do similiar things. This error is not restricted to these two. I'v encountered It on some other places,too.)

I've tried to add

.ARM.exidx :                     
{                                
    *(.ARM.exidx*)
    *(.gnu.linkonce.armexidx.*)  
} > SRAM                         

to my linker script. Now the error message is gone but I get strange crashes.

So can someone tell me what is going on? I have the feeling that there is something fundamentally wrong but I can't figure out what it is.

** ======= REFERENCE =============== **:

linkerscript.ld:

MEMORY
{
    FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00100000
    SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00040000
}

SECTIONS
{
    .text :
    {
        _text = .;
        KEEP(*(.isr_vector))
        *(.text*)
        *(.rodata*)
        _etext = .;
    } > FLASH

    .data : AT(ADDR(.text) + SIZEOF(.text))
    {
        _data = .;
        *(vtable)
        *(.data*)
        _edata = .;
    } > SRAM

    .bss :
    {
        _bss = .;
        *(.bss*)
        *(COMMON)
        _ebss = .;
    } > SRAM

/*
    .ARM.exidx :
    {
        *(.ARM.exidx*)
        *(.gnu.linkonce.armexidx.*)
    } > SRAM
*/
}

Commands used for building: (excerpt)

arm-none-eabi-gcc -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -std=gnu99 -Wall -pedantic -DPART_TM4C123GH6PM -c -Os -DTARGET_IS_TM4C129_RA1 -I. -I../tivalib -I../TivaWare -Dgcc -o../tivalib/weather/wind.o ../tivalib/weather/wind.c

arm-none-eabi-ld -T weatherlight.ld \
            --entry ResetISR \
            --gc-sections \
            -o weatherlight.axf weatherlight.o startup_gcc.o pwmA.o pwmB.o ../tivalib/board.o ../tivalib/debug.o ../tivalib/uartA.o ../tivalib/calc.o ../tivalib/rgb.o ../tivalib/color.o ../tivalib/data/data_sin.o ../tivalib/data/data_gamma.o ../tivalib/net/rgb/gen/solid.o ../tivalib/net/rgb/filter/filter_scale_gamma.o ../tivalib/net/rgb/filter/filter_white_balance.o ../tivalib/net/rgb/filter/filter_darken.o ../tivalib/net/rgb/filter/filter_lighten.o ../tivalib/net/val/gen/slider.o ../tivalib/net/val/gen/value_sin.o ../tivalib/net/val/gen/value_noise.o ../tivalib/net/val/gen/value_weightedsin.o ../tivalib/net/val/filter/value_filter_delay.o ../tivalib/net/val/filter/value_filter_scale_down.o ../tivalib/net/val/mixer/value_mixer.o ../tivalib/net/rgb/mixer/mixer.o ../tivalib/weather/sunny.o ../tivalib/weather/rainy.o ../tivalib/weather/cloudy.o ../tivalib/weather/wind.o ../TivaWare/utils/ustdlib.o \
            ../TivaWare/driverlib/gcc/libdriver.a \
            /usr/lib/gcc/arm-none-eabi/4.8.2/../../../arm-none-eabi/lib/armv7e-m/softfp/libm.a \
            /usr/lib/gcc/arm-none-eabi/4.8.2/../../../arm-none-eabi/lib/armv7e-m/softfp/libc.a \
            /usr/lib/gcc/arm-none-eabi/4.8.2/armv7e-m/softfp/libgcc.a
Scheintod
  • 7,953
  • 9
  • 42
  • 61
  • Put them with `.text`; they are constant data afaik, if they need to be read/write, then put them with `.data`. You must initialize them, they are not like `.bss` and you need `NOLOAD` if they were. You may not need the *idx* sections if you don't use C++ exceptions or any 'C' language stack tracing stuff. However, they are not usually big so I would keep them as above. Some 'C' library routines may require these sections. – artless noise Jun 11 '15 at 14:25
  • I'm not sure if I understand you correctly. But putting '.ARM.exidx' directly in `.text` gives me an error: `arm-none-eabi-ld: .text has both ordered [`.ARM.exidx' in /...../softfp/libgcc.a(_divdi3.o)] and unordered [`.rodata.str1.1' in ../TivaWare/utils/ustdlib.o]` sections. (But at least I have an error telling me where these stuff is comming from **!!!!**) – Scheintod Jun 11 '15 at 14:44

2 Answers2

4

Have you tried to just discard the relevant output section?

/DISCARD/ :
{
    *(.ARM.exidx*)
    *(.gnu.linkonce.armexidx.*)
}

Edit:

I've looked at one of my ARM projects and I've put the sections into flash.

Try this:

.ARM.exidx :
{
    *(.ARM.exidx*)
    *(.gnu.linkonce.armexidx.*)
} >FLASH

Edit2:

Try to put a label after all sections that go into flash and put your .data section there:

SECTIONS
{
.text :
{
    _text = .;
    KEEP(*(.isr_vector))
    *(.text*)
    *(.rodata*)
    _etext = .;
} > FLASH

.ARM.exidx :
{
    *(.ARM.exidx*)
    *(.gnu.linkonce.armexidx.*)
} > FLASH

_begin_data = .;

.data : AT ( _begin_data )
{
    _data = .;
    *(vtable)
    *(.data*)
    _edata = .;
} > SRAM

.bss :
{
    _bss = .;
    *(.bss*)
    *(COMMON)
    _ebss = .;
} > SRAM

}
lkamp
  • 193
  • 1
  • 10
  • Tanks for your answer. Discarding removes the error message. Putting it in flash doesn't. Currently I'm playing with moving the .data section with this line: .data : AT(ADDR(.text) + SIZEOF(.text) + SIZEOF(.ARM.exidx)+2). But I'm not shure I know what I'm doing. And I still have to try it on hardware which I currently don't have with me. Do you know why the .ARM.exidx section is there in the first place? – Scheintod Jun 11 '15 at 13:23
  • (and I'm feeling a little uneasy with deleting something I don't know what it is for ...) – Scheintod Jun 11 '15 at 13:24
  • Try to put all .text sections at the beginning of your linker script, add a label and then put your .data section there. See my second edit. – lkamp Jun 11 '15 at 13:37
  • 1
    AFAIK .ARM.extab and .ARM.exidx are used for stack unwinding, so it's not used in regular operation, but is needed for handling C++ exceptions and when debugging your program. But I have to admit that I've never paid much attention to them, since I never had the problems that you describe. – lkamp Jun 11 '15 at 13:46
1

I added the -funwind-tables option at the COMPILE_OPTS in Makefile and now there is no error when compiled.

Scheintod
  • 7,953
  • 9
  • 42
  • 61
Ning Lian
  • 11
  • 1