Re: [arm-gnu] Specify memory region for sections.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [arm-gnu] Specify memory region for sections.



On Mon, 2009-01-05 at 14:19 -0500, Carlos O'Donell wrote:
> James wrote:
> > However, when I run make, at the linking phase I get;
> > arm-none-eabi-gcc -Wl,-T script.ld -Wl,-Map=obj/DMA_AN_Example1.elf.map
> > -o obj/DMA_AN_Example1.elf ./obj/stm32f10x_spi.o ./obj/stm32f10x_adc.o 
> > ./obj/stm32f10x_dma.o ./obj/stm32f10x_flash.o ./obj/stm32f10x_gpio.o 
> > ./obj/stm32f10x_lib.o ./obj/stm32f10x_nvic.o ./obj/stm32f10x_rcc.o 
> > ./obj/main.o ./obj/stm32f10x_it.o ./obj/stm32f10x_vector.o ./obj/cortexm3_macro.o 
> > /opt/codesourcery/Sourcery_G
> > ++_Lite/bin/../lib/gcc/arm-none-eabi/4.3.2/../../../../arm-none-eabi/bin/ld: cannot find -lgcc
> > 
> > Hmm.  Why can't ld find libgcc?
> 
> This is quite odd.
> 
> Could you please provide the output with "-v" added to the command line?

Sure.  The command line might be a little different as I've been
tinkering in the meantime, but the result is the same.

arm-none-eabi-gcc -v -mcpu=cortex-m3 -mthumb -mlittle-endian
-D_STM32F103VBT6_ -D_STM32x_ -D_STM3x_ -u _start -nostartfiles -T
script.ld -Wl,-Map=obj/DMA_AN_Example1.elf.map  -o
obj/DMA_AN_Example1.elf ./obj/stm32f10x_spi.o ./obj/stm32f10x_adc.o ./obj/stm32f10x_dma.o ./obj/stm32f10x_flash.o ./obj/stm32f10x_gpio.o ./obj/stm32f10x_lib.o ./obj/stm32f10x_nvic.o ./obj/stm32f10x_rcc.o ./obj/main.o ./obj/stm32f10x_it.o ./obj/stm32f10x_vector.o ./obj/cortexm3_macro.o 
Using built-in specs.
Target: arm-none-eabi
Configured with: /scratch/sandra/lite/src/gcc-4.2/configure
--build=i686-pc-linux-gnu --host=i686-pc-linux-gnu
--target=arm-none-eabi --enable-threads --disable-libmudflap
--disable-libssp --disable-libgomp --disable-libstdcxx-pch --with-gnu-as
--with-gnu-ld --enable-languages=c,c++ --disable-shared --with-newlib
--with-pkgversion=Sourcery G++ Lite 2008q1-126
--with-bugurl=https://support.codesourcery.com/GNUToolchain/
--disable-nls --prefix=/opt/codesourcery --with-headers=yes
--with-sysroot=/opt/codesourcery/arm-none-eabi
--with-build-sysroot=/scratch/sandra/lite/eabi/install/arm-none-eabi
--enable-poison-system-directories
--with-build-time-tools=/scratch/sandra/lite/eabi/install/arm-none-eabi/bin --with-build-time-tools=/scratch/sandra/lite/eabi/install/arm-none-eabi/bin
Thread model: single
gcc version 4.2.3 (Sourcery G++ Lite 2008q1-126)
 /opt/codesourcery/Sourcery_G
++_Lite_2008q1/bin/../libexec/gcc/arm-none-eabi/4.2.3/collect2
--sysroot=/opt/codesourcery/Sourcery_G
++_Lite_2008q1/bin/../arm-none-eabi -EL -X -o obj/DMA_AN_Example1.elf -u
_start -L/opt/codesourcery/Sourcery_G
++_Lite_2008q1/bin/../lib/gcc/arm-none-eabi/4.2.3/thumb2
-L/opt/codesourcery/Sourcery_G
++_Lite_2008q1/bin/../lib/gcc/arm-none-eabi/4.2.3/../../../../arm-none-eabi/lib/thumb2 -L/opt/codesourcery/Sourcery_G++_Lite_2008q1/bin/../arm-none-eabi/lib/thumb2 -L/opt/codesourcery/Sourcery_G++_Lite_2008q1/bin/../lib/gcc/arm-none-eabi/4.2.3 -L/opt/codesourcery/Sourcery_G++_Lite_2008q1/bin/../lib/gcc -L/opt/codesourcery/Sourcery_G++_Lite_2008q1/bin/../lib/gcc/arm-none-eabi/4.2.3/../../../../arm-none-eabi/lib -L/opt/codesourcery/Sourcery_G++_Lite_2008q1/bin/../arm-none-eabi/lib -Map=obj/DMA_AN_Example1.elf.map ./obj/stm32f10x_spi.o ./obj/stm32f10x_adc.o ./obj/stm32f10x_dma.o ./obj/stm32f10x_flash.o ./obj/stm32f10x_gpio.o ./obj/stm32f10x_lib.o ./obj/stm32f10x_nvic.o ./obj/stm32f10x_rcc.o ./obj/main.o ./obj/stm32f10x_it.o ./obj/stm32f10x_vector.o ./obj/cortexm3_macro.o --start-group -lgcc -lc --end-group -T script.ld
/opt/codesourcery/Sourcery_G
++_Lite_2008q1/bin/../lib/gcc/arm-none-eabi/4.2.3/../../../../arm-none-eabi/bin/ld: cannot find -lgcc
collect2: ld returned 1 exit status
make: *** [obj/DMA_AN_Example1.elf] Error 1

$ cat script.ld
MEMORY
{
  ram (rwx) : ORIGIN = 0x0, LENGTH = 128M
}

INCLUDE "generic.ld"

_sidata = _etext;
_sdata = __data_start;
_sbss = __bss_start;
_ebss = _bss_end__;
_estack = 0x20010000;

The generic.ld is as per 
Sourcery_G++_Lite_2008q1/arm-none-eabi/lib/generic.ld with the MEMORY
block moved to my script.ld.

> In addition to that could you provide your current environment? e.g. 
> `set > env.txt`. Some environment variables will effect the locations 
> that gcc searches for libraries.

Attached.

Please note, that using the ld scripts that ship with RIDE (copied from
a Win32 machine) seem to work fine building under Linux.  There is no
gcc command line difference, other than the linker script and that the
RIDE scripts specify the files to link rather than them being on the
command line.  I.e. cat DMA_AN_Example1.elf.ld;

SEARCH_DIR(".")
STARTUP("./crt0_STM32x.o")
INPUT("./obj/cortexm3_macro.o")
INPUT("./obj/stm32f10x_spi.o")
INPUT("./obj/stm32f10x_adc.o")
INPUT("./obj/stm32f10x_dma.o")
INPUT("./obj/stm32f10x_flash.o")
INPUT("./obj/stm32f10x_gpio.o")
INPUT("./obj/stm32f10x_lib.o")
INPUT("./obj/stm32f10x_nvic.o")
INPUT("./obj/stm32f10x_rcc.o")
INPUT("./obj/main.o")
INPUT("./obj/stm32f10x_it.o")
INPUT("./e_stdio_thumb.a")
OUTPUT("./obj/DMA_AN_Example1.elf")
INCLUDE "./STM32F103_32K_20K_FLASH.ld"

There are a couple of files here that are not present in the broken
commandline, such as crt0_STM32x.o and e_stdio_thumb.a.  I tried adding
those to no avail.

Cheers,
James.

Attachment: env.txt
Description: application/shellscript