[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: arm-elf-g++ linker error
From: |
Hansen |
Subject: |
Re: arm-elf-g++ linker error |
Date: |
Thu, 28 Apr 2005 10:19:44 +0200 |
> "Hansen" <bluesboys@-remove-this-hotmail.com> wrote in message
> news:d4o7pj$c4n$1@news.net.uni-c.dk...
>> Hi Group
>>
>> I've started up a C++ standard make project in Eclipse, where I would
>> like to make an applikation for the lpc2138.
>>
>> When trying to use C++ functions like <stdio.h> and printf() I get the
>> following message when linking:
>>
>> undefined reference to 'puts'
>>
>> I get the same kind of message when trying other functions as well, and
>> also
>> when trying to declare a function as virtual. Also when using assert()
>> which
>> are a C function.
>>
>> My linking command looks like this:
>>
>> -T $(LD_SCRIPT_RAM) -lstdc++
>> -Wl,-Map=".\bin\Ram\Blinky.map",-Ttext=0x40000000,-Tdata=0x40003000 \
>> --gc-sections -o .\RAM\Blinky.elf \
>> -nostartfiles -nodefaultlibs
>"Lionel B" <me@privacy.net> wrote in message
>news:427094a2$0$79463$14726298@news.sunsite.dk...
>
> It sounds as if the linker is not picking up the standard library libc. Is
> there a particular reason you are using
> he -nostartfiles and -nodefaultlibs options? These tell the linker not to
> use standard system startup files and
> standard system libraries respectively. Without -nodefaultlibs you
> shouldn't have to specify -lstdc++ either - the
> linker should automatically pick up the standard libraries. Maybe try
> passing:
>
> -T $(LD_SCRIPT_RAM) \
> -Wl,-Map=".\bin\Ram\Blinky.map",-Ttext=0x40000000,-Tdata=0x40003000 \
> --gc-sections -o .\RAM\Blinky.elf
>
> Regards,
> --
> Lionel B
I have my own startup.s since this is needed for the lpc2138. Thats why I
use the -nostartfiles.
But when removing the -nodefaultlibs I get the a line of undefined
references from libc.a. Also since my memory on the lpc2138 is rather
limited I don't want to bring unused code in my application.
I've tried using the following options:
-T $(LD_SCRIPT_RAM) -lc -lnewlib.lpc
-Wl,-Map=".\bin\Ram\Blinky.map",-Ttext=0x40000000,-Tdata=0x40003000 \
--gc-sections -o .\RAM\Blinky.elf -nostartfiles -nodefaultlibs
And it resultet in 3 undefined references to 'device table' in
libnewlib-lpc.a
I'm rather new at this, so pleace have patience with me :o)
Regards
Søren Hansen