EmbDev.net

Forum: ARM programming with GCC/GNU tools help undefined reference to `cos'


Author: magnetron (Guest)
Posted on:

Rate this post
0 useful
not useful
hello forum
I got "undefined reference to `cos' error" for ARM Cortex M4

where to change below Eclipse makefile ?
thank you
#-------------------------------------------------------------------------------
#    Rules
#-------------------------------------------------------------------------------

# Flags
CFLAGS = -Wall -fno-common -c -g -mcpu=cortex-m3 -mthumb
CFLAGS += -g $(OPTIMIZATION) $(INCLUDES) -DTRACE_LEVEL=$(TRACE_LEVEL)
ASFLAGS = -g -mapcs-32
LDFLAGS = -mcpu=cortex-m3 -mthumb -g -v -nostartfiles
OBJCOPYFLAGS = -O binary
OBJDUMPFLAGS = -x --syms -S

all: $(BIN) $(OBJ) $(OUTPUT).out

$(BIN) $(OBJ):
  mkdir $@

$(OUTPUT).out: $(C_OBJECTS) $(ASM_OBJECTS) $(LINKER_SCRIPT)
  @ echo "..linking"
  $(LD) $(LDFLAGS) -T$(LINKER_SCRIPT) -o $(OUTPUT).out $(C_OBJECTS) $(ASM_OBJECTS) libgcc.a
  $(OBJCOPY) $(OBJCOPYFLAGS) $(OUTPUT).out $(OUTPUT).bin
#   $(OBJDUMP) $(OBJDUMPFLAGS) $(OUTPUT).out > $(OUTPUT).lss
  @ echo "...completed."

Author: Mac (Guest)
Posted on:

Rate this post
0 useful
not useful
LDFLAGS needs -lm

Author: magnetron (Guest)
Posted on:

Rate this post
0 useful
not useful
LDFLAGS = -mcpu=cortex-m3 -mthumb -g -v -nostartfiles -lm

I tried above line, no success - still same error
I also cleaned the project and recompiled , still same error

Author: Johann L. (gjlayde)
Posted on:

Rate this post
0 useful
not useful
Specify -lm after your objects!

Author: magnetron (Guest)
Posted on:

Rate this post
0 useful
not useful
thank you Johann L <-> it worked

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.