EmbDev.net

Forum: ARM programming with GCC/GNU tools STR9 ld-file anomalies


von Dan M. (gorlash)


Rate this post
0 useful
not useful
Okay, I've gone back to building with gcc calling ld, vs calling ld
directly.
I'm using Yagarto 20080408.

If I have this in SECTIONS:
/**********************************************/
    /* the program code is stored in the .text section, which goes to
Flash */
    .text :
    {
       . = ALIGN(4);

        *(.text)                   /* remaining code */
        *(.text.*)                 /* remaining code */
        *(.rodata)                 /* read-only data (constants) */
        *(.rodata*)
        *(.glue_7)
        *(.glue_7t)

       . = ALIGN(4);
       _etext = .;
       /* This is used by the startup in order to initialize the .data
secion */
    } >FLASH

    /* .data section which is used for initialized data */
    /* This is used by the startup in order to initialize the .data
secion */
    _sidata = .;
    .data : AT (_sidata)
    {
       . = ALIGN(4);
        /* This is used by the startup in order to initialize the .data
secion */
        _sdata = . ;

        *(.data)
        *(.data.*)

       . = ALIGN(4);
       /* This is used by the startup in order to initialize the .data
secion */
       _edata = . ;
    } >DATA
/**********************************************/
My build fails:
c:/yagarto/bin/arm-elf-gcc -Todu-gnuarm.ld -Wall -I. -Iinclude
-gdwarf-2 -MD -DGNUARM -mcpu=arm9e -std=c99 -mlittle-endian -Os -g
-Wl,-Map=odu.map,--cref,--no-warn-mismatch,-static startup/91x_initga.o
main.o 91x_it.o feprom.o atmel_flash_memory.o Internal_flash_memory.o
source/91x_adc.o source/91x_caps.o source/91x_gpio.o source/91x_lib.o
source/91x_rtc.o source/91x_uart.o source/91x_vic.o source/91x_wdg.o
source/91x_fmi.o source/91x_scu.o source/91x_emi.o source/91x_dma.o  -o
odu.elf
c:/yagarto/bin/../lib/gcc/arm-elf/4.2.2/../../../../arm-elf/bin/ld.exe:
section .data [0002cf48 -> 0002db77] overlaps section .init [0002cf48 ->
0002cf67]
c:/yagarto/bin/../lib/gcc/arm-elf/4.2.2/../../../../arm-elf/bin/ld.exe:
section .fini [0002cf68 -> 0002cf83] overlaps section .data [0002cf48 ->
0002db77]
collect2: ld returned 1 exit status
make: *** [odu.elf] Error 1

/**********************************************/
However, if I change it to
   .data : /* collect all initialized .data sections that go into RAM
*/
It builds successfully!!
So what's the difference??  Does omitting the "AT (location)" statement
actually put the data somewhere else??  I don't understand why that
would be the case.  What is actually being done with the data in each
case, and how do the two statements differ??

von Spencer O. (ntfreak)


Attached files:

Rate this post
0 useful
not useful
Dan Miller wrote:
> Okay, I've gone back to building with gcc calling ld, vs calling ld
> directly.
> I'm using Yagarto 20080408.
>

Not sure what is causing your problem.
Find attached one of my linker scripts, works with arm-elf and arm-eabi
compilers.

Cheers
Spen

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.