tbm-mcu/scripts/Makefile.stm32f0

43 lines
1 KiB
Text
Raw Normal View History

PREFIX ?= arm-none-eabi
LDSCRIPT = support/stm32f0-discovery.ld
CFLAGS += -fno-common --function-sections -fdata-sections
LDFLAGS += -static -nostartfiles
LDFLAGS += -Wl,--gc-sections
LDFLAGS += -T ${LDSCRIPT}
LIBS += -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group
# Set up libopencm3.
OPENCM3_DIR ?= libopencm3
OPENCM3_LIBNAME = opencm3_stm32f0
CFLAGS += -I$(OPENCM3_DIR)/include
CFLAGS += -DSTM32F0 -msoft-float -mthumb -mcpu=cortex-m0
LDFLAGS += -L$(OPENCM3_DIR)/lib
LIBS += -l$(OPENCM3_LIBNAME)
STLINK_PORT ?= :4242
2017-03-11 00:55:54 +00:00
obj-y += source/core/spi.o
2017-03-11 12:56:46 +00:00
obj-y += source/drivers/spi_flash.o
2017-03-11 00:55:54 +00:00
obj-y += source/drivers/stm32f0_spi.o
2017-03-11 13:07:12 +00:00
obj-y += source/drivers/usart_console.o
2017-03-11 00:55:54 +00:00
$(OPENCM3_DIR)/lib/lib$(OPENCM3_LIBNAME).a:
@if [ ! -e libopencm3/.git ]; then \
git submodule init; \
git submodule update; \
fi
@$(MAKE) -C $(OPENCM3_DIR)
$(BUILD)/tbm: $(OPENCM3_DIR)/lib/lib$(OPENCM3_LIBNAME).a
run: $(BUILD)/tbm
@echo "GDB $<"
@$(GDB) --batch \
-ex 'target extended-remote $(STLINK_PORT)' \
-x flash.scr \
$<
.PHONY: run