From cbb4ac1178362f61f854fd13f46ee0138c5d73ba Mon Sep 17 00:00:00 2001 From: jaseg Date: Sun, 30 Aug 2020 15:27:11 +0200 Subject: make usb work with weird opencm3 hybrid --- Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index b56e124..79cd8a6 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,7 @@ # along with this program. If not, see . CUBE_PATH ?= $(wildcard ~)/resource/STM32CubeF1 +OPENCM3_PATH ?= $(wildcard ~)/resource/libopencm3 CMSIS_PATH ?= $(CUBE_PATH)/Drivers/CMSIS CMSIS_DEV_PATH ?= $(CMSIS_PATH)/Device/ST/STM32F1xx HAL_PATH ?= $(CUBE_PATH)/Drivers/STM32F1xx_HAL_Driver @@ -33,7 +34,8 @@ LDFLAGS = -nostdlib #LDFLAGS += -specs=rdimon.specs -DSEMIHOSTING LDFLAGS += -Wl,-Map=main.map #LDFLAGS += -Wl,--gc-sections -LIBS = -lm -lgcc +CFLAGS += -I$(OPENCM3_PATH)/include -L$(OPENCM3_PATH)/lib -DSTM32F1 +LIBS = -lm -lgcc -lopencm3_stm32f1 #LIBS += -lrdimon CFLAGS += -DSTM32F103xB -DHSE_VALUE=8000000 -DLSE_VALUE=32768 @@ -43,6 +45,8 @@ LDFLAGS += -Tstm32_flash.ld CFLAGS += -I$(CMSIS_DEV_PATH)/Include -I$(CMSIS_PATH)/Include -I$(HAL_PATH)/Inc -Iconfig -Wno-unused -I../common LIBS += -L$(CMSIS_PATH)/Lib/GCC -larm_cortexM3l_math +SOURCES = cdcacm.c main.c color.c + ################################################### .PHONY: program clean @@ -60,7 +64,7 @@ cmsis_exports.c: $(CMSIS_DEV_PATH)/Include/stm32f103xb.h $(CMSIS_PATH)/Include/c $(CC) -c $(CFLAGS) -o $@ $^ # $(CC) -E $(CFLAGS) -o $(@:.o=.pp) $^ -sources.tar.xz: main.c color.c Makefile +sources.tar.xz: $(SOURCES) Makefile tar -caf $@ $^ # don't ask... @@ -70,7 +74,7 @@ sources.tar.xz.zip: sources.tar.xz sources.c: sources.tar.xz.zip xxd -i $< | head -n -1 | sed 's/=/__attribute__((section(".source_tarball"))) =/' > $@ -main.elf: main.c color.c startup_stm32f103xb.s system_stm32f1xx.c $(HAL_PATH)/Src/stm32f1xx_ll_utils.c base.c cmsis_exports.c +main.elf: $(SOURCES) startup_stm32f103xb.s system_stm32f1xx.c $(HAL_PATH)/Src/stm32f1xx_ll_utils.c base.c cmsis_exports.c $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(OBJCOPY) -O ihex $@ $(@:.elf=.hex) $(OBJCOPY) -O binary $@ $(@:.elf=.bin) -- cgit