how to solve this linker script error?

OP (Company: Student) #3520563
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.
OP (Company: Student) #3521030
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
OP (Company: Student) #3521049
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.
Moderator #3521279
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.

Reply

Please log in before posting.

or

Log in with Google account

Registration is free and takes only a minute.

Register now