Changed the stm32 makefile to use the internal (ext) libopencm3 instead of the one in the toolchain.

This commit is contained in:
Piotr Esden-Tempski
2012-02-11 18:55:05 -08:00
parent d7d9ee60b7
commit a239f8414f
+6 -9
View File
@@ -69,10 +69,6 @@ TOOLCHAIN_DIR=$(shell dirname `which arm-none-eabi-gcc`)
GCC_LIB_DIR=$(TOOLCHAIN_DIR)/../arm-none-eabi/lib
endif
# Detect if we are using the new libopencm3 or the old libopenstm32
LIBOPENCM3_LIB=$(shell if [ -e "$(GCC_LIB_DIR)/libopencm3_stm32f1.a" ]; then echo "opencm3_stm32f1"; else echo "opencm3_stm32"; fi)
LIBOPENCM3_DEFS=$(shell if [ -e "$(GCC_LIB_DIR)/libopencm3_stm32f1.a" ]; then echo "-DSTM32F1"; fi)
#first try to find OpenOCD in the path
OOCD = $(shell which openocd)
#if OpenOCD could not be found in the path, try the toolchain dir
@@ -120,7 +116,7 @@ endif
#UNAME = $(shell uname -s)
MULTILIB = $(shell if $(CC) --print-multi-lib | grep thumb2 > /dev/null ; then echo "yes"; else echo "no"; fi)
CFLAGS = -I. -I./$(ARCH) $(INCLUDES) -D__thumb2__ -Wall -msoft-float -O$(OPT)
CFLAGS = -I. -I./$(ARCH) -I../ext/libopencm3/include $(INCLUDES) -D__thumb2__ -Wall -msoft-float -O$(OPT)
CFLAGS += -Wl,--gc-sections
CFLAGS += -mcpu=$(MCU) -mthumb -ansi
ifeq ("$(MULTILIB)","yes")
@@ -141,7 +137,7 @@ CFLAGS += -Wmissing-prototypes
CFLAGS += -Wstrict-prototypes
CFLAGS += -Wmissing-declarations
CFLAGS += -Wswitch-default
CFLAGS += $(LIBOPENCM3_DEFS)
CFLAGS += -DSTM32F1
CFLAGS += $($(TARGET).CFLAGS)
@@ -151,13 +147,14 @@ AFLAGS += -mcpu=$(MCU) -mthumb
endif
AFLAGS += -x assembler-with-cpp -Wa,-adhlns=$(OBJDIR)/$(<:.S=.lst),--g$(DEBUG)
LDFLAGS = -L../ext/libopencm3/lib/stm32/f1
ifeq ("$(MULTILIB)","yes")
LDFLAGS = -T$(LDSCRIPT) -nostartfiles -O$(OPT) -mthumb -march=armv7 -mfix-cortex-m3-ldrd -msoft-float
LDFLAGS += -T$(LDSCRIPT) -nostartfiles -O$(OPT) -mthumb -march=armv7 -mfix-cortex-m3-ldrd -msoft-float
else
LDFLAGS = -D__thumb2__ -T$(LDSCRIPT) -nostartfiles -L$(GCC_LIB_DIR) -O$(OPT)
LDFLAGS += -D__thumb2__ -T$(LDSCRIPT) -nostartfiles -L$(GCC_LIB_DIR) -O$(OPT)
endif
LDFLAGS += -Wl,-Map=$(OBJDIR)/$(TARGET).map,--cref,--gc-sections
LDLIBS += -lc -lm -lgcc -lcmsis -lstm32 -l$(LIBOPENCM3_LIB)
LDLIBS += -lc -lm -lgcc -lcmsis -lstm32 -lopencm3_stm32f1
CPFLAGS = -j .isr_vector -j .text -j .data
CPFLAGS_BIN = -Obinary