Fix link flags to specify cpu instead of (wrong) arch.

-march=armv7 is NOT right for cortex-m3, and results in unexpected
arm code being linked in when using multilib toolchains
This commit is contained in:
Karl Palsson 2012-06-19 19:45:45 +00:00 committed by Piotr Esden-Tempski
parent 450c3e00a1
commit 6574baa767

View File

@ -28,13 +28,14 @@ GDB = $(PREFIX)-gdb
# Uncomment this line if you want to use the installed (not local) library.
#TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX)
TOOLCHAIN_DIR = ../../../../..
ARCH_FLAGS = -mthumb -mcpu=cortex-m3 -msoft-float
CFLAGS += -Os -g -Wall -Wextra -I$(TOOLCHAIN_DIR)/include \
-fno-common -mcpu=cortex-m3 -mthumb -msoft-float -MD -DSTM32F1
-fno-common $(ARCH_FLAGS) -MD -DSTM32F1
LDSCRIPT ?= $(BINARY).ld
LDFLAGS += -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group \
-L$(TOOLCHAIN_DIR)/lib -L$(TOOLCHAIN_DIR)/lib/stm32/f1 \
-T$(LDSCRIPT) -nostartfiles -Wl,--gc-sections \
-mthumb -march=armv7 -mfix-cortex-m3-ldrd -msoft-float
$(ARCH_FLAGS) -mfix-cortex-m3-ldrd
OBJS += $(BINARY).o
OOCD ?= openocd