EmbDev.net

Forum: ARM programming with GCC/GNU tools Why isn't the linker working?


Author: noether (Guest)
Posted on:

Rate this post
0 useful
not useful
Hello, i moved to arm-none-linux-gnueabi toolchain (Sourcery), and i'm 
trying
to modify an old makefile (gnuarm-4.0.2) without any success at linking.

Previously i used the ld, but now i want to delegate this work to the 
compiler.

Here it is my Makefile:


NAME = truck

# variables 
CC      = arm-none-linux-gnueabi-gcc
LD      = arm-none-linux-gnueabi-ld -v
AR      = arm-none-linux-gnueabi-ar
AS      = arm-none-linux-gnueabi-as
CP      = arm-none-linux-gnueabi-objcopy
OD    = arm-none-linux-gnueabi-objdump

# LIBM = /home/noether/workspace/ARM7//gnuarm-4.0.2/arm-elf/lib/libm.a
# LIBGCC = /home/noether/workspace/ARM7/gnuarm-4.0.2/lib/gcc/arm-elf/4.0.2/libgcc.a

CFLAGS  = -I./ -mcpu=arm7tdmi -c -fno-common -Os -g
AFLAGS  = -ahls -mapcs-32 -o crt.o
LFLAGS  = -Map main.map -Ttruck.cmd
CPFLAGS = --output-target=binary
ODFLAGS  = -x --syms

OBJECTS = crt.o  main.o timer.o misc.o tsip.o adc.o spi.o gps.o geomag.o isrsupport.o lowlevelinit.o 

all:  main.out
  @ echo "...copying"
  $(CP) $(CPFLAGS) main.out main.bin
  $(OD) $(ODFLAGS) main.out > main.dmp

clean:
  -$(RM) $(OBJECTS) crt.lst main.out main.bin main.map main.dmp



main.out: $(OBJECTS) truck.cmd 
  @ echo "..linking"
LINK--------->  $(CC) $(CFLAGS) $(OBJECTS) -o main.out $(LFLAGS) -lm -lgcc 
  


crt.o: crt.s
  @ echo ".assembling"
  $(AS) $(AFLAGS) crt.s > crt.lst

main.o: main.c
  @ echo ".compiling"
  $(CC) $(CFLAGS) main.c
  
timer.o: timer.c
  @echo ".compiling"
  $(CC) $(CFLAGS) timer.c
  
misc.o: misc.c
  @echo ".compiling"
  $(CC) $(CFLAGS) misc.c
  
tsip.o: tsip.c
  @echo ".compiling"
  $(CC) $(CFLAGS) tsip.c

adc.o: adc.c
  @echo ".compiling"
  $(CC) $(CFLAGS) adc.c

spi.o: spi.c
  @echo ".compiling"
  $(CC) $(CFLAGS) spi.c

gps.o: gps.c
  @echo ".compiling"
  $(CC) $(CFLAGS) gps.c

geomag.o: geomag.c
  @echo ".compiling"
  $(CC) $(CFLAGS) geomag.c

isrsupport.o: isrsupport.c
  @echo ".compiling"
  $(CC) $(CFLAGS) isrsupport.c
  
lowlevelinit.o: lowlevelinit.c
  @ echo ".compiling"
  $(CC) $(CFLAGS) lowlevelinit.c


And here it's the output:

noether@SpaceFish:~/workspace/ARM7/Truck$ make
..linking
arm-none-linux-gnueabi-gcc -I./ -mcpu=arm7tdmi -c -fno-common -Os -g 
crt.o  main.o timer.o misc.o tsip.o adc.o spi.o gps.o geomag.o 
isrsupport.o lowlevelinit.o  -o main.out -Map main.map -Ttruck.cmd -lm 
-lgcc
arm-none-linux-gnueabi-gcc: main.map: No such file or directory
arm-none-linux-gnueabi-gcc: unrecognized option '-Map'
make: *** [main.out] Error 1

I tried with -Map= instead -Map, and it is the same.
Any ideas? (i¡m really noob, i know it xD).

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

Rate this post
0 useful
not useful
noether wrote:

> Previously i used the ld, but now i want to delegate this work to the
> compiler.

In that case, you have to prefix linker-specific options with -Wl,
so your option must be

-Wl,-Map=main.map

The -Wl tells the compiler to not consider this option as a compiler
option but pass it on to the linker.

Author: noether (Guest)
Posted on:

Rate this post
0 useful
not useful
Thank you very much, i forgot it!

Anyway, finally i just compiled my own tool-chain this afternoon from 
sources xD, and everything is working again.

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.