37 lines
952 B
Makefile
37 lines
952 B
Makefile
OOCD ?= openocd
|
|
OOCD_INTERFACE ?= stlink-v2
|
|
OOCD_TARGET ?= stm32f4x
|
|
BMP_PORT ?= /dev/ttyBmpGdb
|
|
|
|
COMFLAGS=-g -Og -pedantic -Wall
|
|
|
|
BOOTLOADER ?= no
|
|
|
|
ifeq ($(BOOTLOADER),yes)
|
|
LIBNAME = opencm3_stm32f4
|
|
FP_FLAGS ?= -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
|
ARCH_FLAGS = -mthumb -mcpu=cortex-m4 $(FP_FLAGS)
|
|
DEVDEFS = -DSTM32F4 -DSTM32F4CCM -DSTM32F405RG -D_ROM=1008K -D_RAM=128K -D_CCM=64K -D_CCM_OFF=0x10000000 -D_ROM_OFF=0x08004000 -D_RAM_OFF=0x20000000 -DBOOTLOADER
|
|
LDSCRIPT = linker.ld
|
|
else
|
|
DEVICE = STM32F405RG
|
|
endif
|
|
CFLAGS=$(COMFLAGS) $(DEVDEFS) -std=c99 -D_POSIX_C_SOURCE=200809L
|
|
CXXFLAGS=$(COMFLAGS) -std=c++17
|
|
|
|
|
|
OBJS = usb.o adc.o ringbuffer.o uart.o buttons.o printf.o encoder.o
|
|
BINARY ?= main
|
|
|
|
printf.o: CFLAGS:=$(CFLAGS) -Wno-parentheses -Wno-char-subscripts -Wno-sign-compare -Wno-implicit-fallthrough
|
|
|
|
include ../rules.mk
|
|
|
|
uf2: main.uf2
|
|
|
|
main.uf2: main.bin
|
|
uf2conv.py -c -b 0x4000 -o $@ $<
|
|
|
|
|
|
.PHONY: uf2
|