ARM linking problem

OP (Company: Bangla) #2387457
Rate this post
• ▲ useful
▼ not useful
Hi,
I am using a M3 cpu (STM32103) and a gcc toolchain selfmade. Everything 
work fine if I compile my code for using the internal Flash (for the 
code) and the internal RAM (for the data). For reason of place I have to 
use the external RAM. So, I have modified my linker script accordingly. 
Now the linker report a problem.

With this script the linker works

_stEPROM   = 0x00000000;
_stRAM     = 0x20000000;

MEMORY {
  prgm_code (rx)  : ORIGIN = 0x00000000, LENGTH = 512K
  prgm_data  (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
}

SECTIONS {
  .text _stEPROM : {
    _stVECTORS = ABSOLUTE(.);
    KEEP(*(.isr_vector))
    _enVECTORS = ABSOLUTE(.);
    _stTEXT = ABSOLUTE(.);
      *(.text .text.*)
    _enTEXT = ABSOLUTE(.);
    _stRODATA = ABSOLUTE(.);
      *(.rodata .rodata.*)
      . = ALIGN(4);
    _enRODATA = ABSOLUTE(.);
  } > prgm_code

  .data _stRAM :  AT (_enRODATA) {
    _stDATA = ABSOLUTE(.);
      *(.data .data.*)
      . = ALIGN(4);
    *(vtable)
    *(.data*)
    _enDATA = ABSOLUTE(.);
  } > prgm_data

    . = ALIGN(4);
    .eh_frame : {
        KEEP (*(.eh_frame))
    } > prgm_data

    . = ALIGN(4);
  .ARM.extab : {
    *(.ARM.extab*)
  } > prgm_data

    . = ALIGN(4);
  __exidx_start = ABSOLUTE(.);
  .ARM.exidx : {
    *(.ARM.exidx*)
  } > prgm_data
  __exidx_end = ABSOLUTE(.);

  .bss (NOLOAD) : {
    _stBSS = ABSOLUTE(.);
      *(.bss .bss.*)
      . = ALIGN(4);
    *(COMMON)
      . = ALIGN(4);
    _enBSS = ABSOLUTE(.);
    _end = ABSOLUTE(.);
    end = ABSOLUTE(.);
    _heap = ABSOLUTE(.);
    . += 0x800;
    _main_stack = ABSOLUTE(.);
  } > prgm_data
}

With this modification the linker fails

_stEPROM   = 0x00000000;
_stRAM     = 0x60000000;

MEMORY {
  prgm_code (rx)  : ORIGIN = 0x00000000, LENGTH = 512K
  prgm_data  (rwx) : ORIGIN = 0x60000000, LENGTH = 8M
}

The linker reports me this error:

/Users/Shared/cross/gcc-4.6.1/arm/lib/gcc/arm-none-eabi/4.6.1/thumb/v7m/ 
libgcc.a(unwind-arm.o):(.ARM.exidx+0x38):  relocation truncated to fit: 
R_ARM_PREL31 against `.text'
/Users/Shared/cross/gcc-4.6.1/arm/lib/gcc/arm-none-eabi/4.6.1/thumb/v7m/ 
libgcc.a(unwind-arm.o):(.ARM.exidx+0x40):  additional relocation 
overflows omitted from the output

I have tried to use the compilation flag -mlong-calls but t doesn't 
work.
Any opinion or idea to workaround this problem?
Regards
  Bangla
OP (Company: Bangla) #2388828
Rate this post
• ▲ useful
▼ not useful
I have rebuild all my toolchain with the switch 
--enable-newlib-io-long-long disabled during the newlib creation. Now it 
works. It is difficult to understand what is happening. Anyway, this is 
only a partial solution because I need to print long long integers.

Any comment or suggestions?
Regards
  Bangla

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.