how to solve this linker script error?

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

A question of your own? This thread is over 12 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

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.