title: stm32 arm-none-eabi-gcc link library
body: <p>Hello I need to compute logarithms on my stm32. I use arm-none-eabi-gcc. When I add <code>-L/opt/tools/Sourcery_G++_Lite/arm-none-eabi/lib/</code> in my Makefile microcontroller stop to work. Unfortunately I can't debug my program because there is no debag pins on my device and I load program to flash via bootloader. I not use any math functioins from libraries - i just add library path to Makefile.
  Here is my full makefile:</p>
  
  <pre><code>OUTPUTDIR = $(BUILDDIR)/../../output
  
  DEPDIR = $(BUILDDIR)/.dep
  PWD = $(shell pwd)
  
  COMMONFLAGS = -mcpu=cortex-m3 -mthumb -ggdb3
  CFLAGS += $(COMMONFLAGS) -Os $(INCLUDES) -I.
  CFLAGS += -std=c99 -Wall -Wextra -static -fdata-sections -ffunction-sections -fno-hosted -fno-builtin
  CFLAGS += -nostdlib -nodefaultlibs
  CFLAGS += -mapcs-frame -msoft-float
  CFLAGS += -MD -MP -MF $(DEPDIR)/$(@F).d
  LDFLAGS = $(COMMONFLAGS) -static
  LDFLAGS += -fno-exceptions -ffunction-sections -fdata-sections
  LDFLAGS += -static -Xlinker --gc-sections
  #LDFLAGS +=  -L/opt/tools/dima/Sourcery_G++_Lite/arm-none-eabi/lib/
  ASFLAGS = $(COMMONFLAGS)
  
  CFLAGS += -DUSE_STDPERIPH_DRIVER
  
  CROSS = /opt/tools/Sourcery_G++_Lite/bin/arm-none-eabi
  GCC = $(CROSS)-gcc
  AS = $(CROSS)-as
  SIZE = $(CROSS)-size
  OBJCOPY = $(CROSS)-objcopy
  OBJDUMP = $(CROSS)-objdump
  NM = $(CROSS)-nm
  
  COBJ = $(addprefix $(BUILDDIR)/, $(CSRC:.c=.c.o))
  ASMOBJ = $(addprefix $(BUILDDIR)/, $(ASMSRC:.s=.s.o))
  OBJ = $(COBJ) $(ASMOBJ)
  
  V = $(if $(VERBOSE), , @)
  
  
  all: prebuild $(BUILDDIR)/$(TARGET).elf $(LDSCRIPT)
      @$(SIZE) $(BUILDDIR)/$(TARGET).elf
      @$(OBJCOPY) -O binary $(BUILDDIR)/$(TARGET).elf $(BUILDDIR)/$(TARGET).bin
      @$(OBJCOPY) -O ihex $(BUILDDIR)/$(TARGET).elf $(BUILDDIR)/$(TARGET).hex
      @$(OBJDUMP) -h -S -z $(BUILDDIR)/$(TARGET).elf &gt; $(BUILDDIR)/$(TARGET).lss
      @$(NM) -n $(BUILDDIR)/$(TARGET).elf &gt; $(BUILDDIR)/$(TARGET).sym
      @mkdir -p $(OUTPUTDIR)
      @cp $(BUILDDIR)/$(TARGET).bin $(OUTPUTDIR)
      @echo =======================================================================
  
  
  $(BUILDDIR)/$(TARGET).elf: $(OBJ)
      @echo Linking $@
      $(GCC) $(LDFLAGS) -T $(PWD)/$(LDSCRIPT) -o $@ $(OBJ) -lm
  
  $(COBJ): $(BUILDDIR)/%.c.o : %.c
      @echo Compiling $&lt;
      @-mkdir -p $(@D)
      $(GCC) $(CFLAGS) -c $&lt; -o $@
  
  $(ASMOBJ): $(BUILDDIR)/%.s.o : %.s
      @echo Assembling $&lt;
      @-mkdir -p $(@D)
      $(V)$(AS) $(ASFLAGS) -c ./$&lt; -o $@
  
  
  -include $(shell mkdir -p $(DEPDIR) 2&gt;/dev/null) $(wildcard $(DEPDIR)/*)
  
  .PHONY: clean output
  
  clean:
      rm -rf $(BUILDDIR)
  </code></pre>
  
  <p>What i do wrong? Thanks.</p>