EmbDev.net

Forum: ARM programming with GCC/GNU tools how to solve this linker script error?


von Hemanth V. (Company: Student) (hemanth)


Rate this post
useful
not useful
I created a linker script file as memory.ld –

MEMORY
{
        MYMEMORY(rw)   : ORIGIN = 0x0041c620 ,  LENGTH = 30
}

.myvars (NOLOAD) :
{
  *(.myvarloc)

} > MYMEMORY


In my c program :
__attribute__((section(".myvarloc")))
   uint8 measurements[30];

I am using eclipse IDE on linux rtos. I added –T memory.ld in project – 
properties -- linker – libraries – miscellaneous in eclipse I am 
creating this because : I want a fixed memory address for the variable 
measurements of size 30 starting from 0x0041c620 .

My question : Is it right way of doing this ?? If I do like above : I am 
getting error as – Linker input file unused and linking not done.

: Moved by Moderator
von Jörg W. (dl8dtl) (Moderator)


Rate this post
useful
not useful
Hemanth Venkatappa wrote:

> Linker input file unused and linking not done.

Well, if you are not linking at all, why a linker script?

I guess there won't be much help without knowing the exact 
commandline(s)
you are using.

von G. L. (sprintersb)


Rate this post
useful
not useful
Presumably, the command line comes with -c -Werror :-)

von Hemanth V. (Company: Student) (hemanth)


Rate this post
useful
not useful
I added
project –- properties -- C/C++ Build -- Settings -- GCC C linker –- 
miscellaneous : -T memory.ld

project –- properties -- C/C++ Build -- Settings -- GCC C compiler –- 
Miscellaneous : -c -fmessage-length=0 -std=gnu99

project –- properties -- C/C++ Build -- Settings -- GCC C linker : gcc 
-Wall -lrt -pthread -ld

von Jörg W. (dl8dtl) (Moderator)


Rate this post
useful
not useful
Again, please post your commandlines.  Don't expect others to use the
same IDE as you are using.

Somehow, Eclipse will certainly be able to tell you which commands it is
invoking.

von Hemanth V. (Company: Student) (hemanth)


Rate this post
useful
not useful
**** Build of configuration Debug for project FEBRUARY ****

make all
Building target: FEBRUARY
Invoking: GCC C Linker
gcc -Wall -lrt -pthread -ld -T -L 
/home/user/workspace/FEBRUARY/Debug./memory.ld -o "FEBRUARY" 
./src/LocatedVars.o ./src/MAIN.o ./src/xcp.o ./src/xcp_auto_conf.o 
./src/xcp_callbacks.o ./src/xcp_cmd.o ./src/xcp_cmdcalpage.o 
./src/xcp_cmdchecksum.o ./src/xcp_cmdconnect.o ./src/xcp_cmddaq.o 
./src/xcp_cmddownload.o ./src/xcp_cmddyndaq.o ./src/xcp_cmdflash.o 
./src/xcp_cmdseednkey.o ./src/xcp_cmdupload.o ./src/xcp_daq.o 
./src/xcp_event.o ./src/xcp_stim.o ./src/xcp_target.o ./src/xcpip.o 
./src/xcpip_auto_conf.o ./src/xcpip_getrxbuf.o ./src/xcpip_gettxbuf.o 
./src/xcpip_init.o ./src/xcpip_peekrxbuf.o ./src/xcpip_resume.o 
./src/xcpip_rxcallback.o ./src/xcpip_rxnext.o ./src/xcpip_txcallback.o 
./src/xcpip_txnext.o
gcc: error: /home/user/workspace/FEBRUARY/Debug./memory.ld: No such file 
or directory
make: *** [FEBRUARY] Error 1

**** Build Finished ****

I am using the IDE and just build it by pressing the ctrl + b.

von Jörg W. (dl8dtl) (Moderator)


Rate this post
useful
not useful
Hemanth Venkatappa wrote:

> -L /home/user/workspace/FEBRUARY/Debug./memory.ld

You are trying to specify the linker script as a linker pathname
(where it is going to search for libraries).  No idea how you can
convince your Eclipse plugin to not insert the -L, you have to read
the plugin documentation.

Also, I guess your memory.ld is actually located at
/home/user/workspace/FEBRUARY/memory.ld rather than in the build
directory.  You probably must prefix it with "../" .  But that won't
help you as long as Eclipse expects your linker script to be a library.

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.