mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-06 07:53:43 +08:00
Changed the stm32 makefile to use the internal (ext) libopencm3 instead of the one in the toolchain.
This commit is contained in:
+6
-9
@@ -69,10 +69,6 @@ TOOLCHAIN_DIR=$(shell dirname `which arm-none-eabi-gcc`)
|
|||||||
GCC_LIB_DIR=$(TOOLCHAIN_DIR)/../arm-none-eabi/lib
|
GCC_LIB_DIR=$(TOOLCHAIN_DIR)/../arm-none-eabi/lib
|
||||||
endif
|
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
|
#first try to find OpenOCD in the path
|
||||||
OOCD = $(shell which openocd)
|
OOCD = $(shell which openocd)
|
||||||
#if OpenOCD could not be found in the path, try the toolchain dir
|
#if OpenOCD could not be found in the path, try the toolchain dir
|
||||||
@@ -120,7 +116,7 @@ endif
|
|||||||
#UNAME = $(shell uname -s)
|
#UNAME = $(shell uname -s)
|
||||||
MULTILIB = $(shell if $(CC) --print-multi-lib | grep thumb2 > /dev/null ; then echo "yes"; else echo "no"; fi)
|
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 += -Wl,--gc-sections
|
||||||
CFLAGS += -mcpu=$(MCU) -mthumb -ansi
|
CFLAGS += -mcpu=$(MCU) -mthumb -ansi
|
||||||
ifeq ("$(MULTILIB)","yes")
|
ifeq ("$(MULTILIB)","yes")
|
||||||
@@ -141,7 +137,7 @@ CFLAGS += -Wmissing-prototypes
|
|||||||
CFLAGS += -Wstrict-prototypes
|
CFLAGS += -Wstrict-prototypes
|
||||||
CFLAGS += -Wmissing-declarations
|
CFLAGS += -Wmissing-declarations
|
||||||
CFLAGS += -Wswitch-default
|
CFLAGS += -Wswitch-default
|
||||||
CFLAGS += $(LIBOPENCM3_DEFS)
|
CFLAGS += -DSTM32F1
|
||||||
|
|
||||||
CFLAGS += $($(TARGET).CFLAGS)
|
CFLAGS += $($(TARGET).CFLAGS)
|
||||||
|
|
||||||
@@ -151,13 +147,14 @@ AFLAGS += -mcpu=$(MCU) -mthumb
|
|||||||
endif
|
endif
|
||||||
AFLAGS += -x assembler-with-cpp -Wa,-adhlns=$(OBJDIR)/$(<:.S=.lst),--g$(DEBUG)
|
AFLAGS += -x assembler-with-cpp -Wa,-adhlns=$(OBJDIR)/$(<:.S=.lst),--g$(DEBUG)
|
||||||
|
|
||||||
|
LDFLAGS = -L../ext/libopencm3/lib/stm32/f1
|
||||||
ifeq ("$(MULTILIB)","yes")
|
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
|
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
|
endif
|
||||||
LDFLAGS += -Wl,-Map=$(OBJDIR)/$(TARGET).map,--cref,--gc-sections
|
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 = -j .isr_vector -j .text -j .data
|
||||||
CPFLAGS_BIN = -Obinary
|
CPFLAGS_BIN = -Obinary
|
||||||
|
|||||||
Reference in New Issue
Block a user