EmbDev.net

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


Author: Hemanth Venkatappa (Company: Student) (hemanth)
Posted on:

Rate this post
0 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
Author: Jörg Wunsch (dl8dtl) (Moderator)
Posted on:

Rate this post
0 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.

Author: G. L. (sprintersb)
Posted on:

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

Author: Hemanth Venkatappa (Company: Student) (hemanth)
Posted on:

Rate this post
0 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

Author: Jörg Wunsch (dl8dtl) (Moderator)
Posted on:

Rate this post
0 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.

Author: Hemanth Venkatappa (Company: Student) (hemanth)
Posted on:

Rate this post
0 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.

Author: Jörg Wunsch (dl8dtl) (Moderator)
Posted on:

Rate this post
0 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

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.