summaryrefslogtreecommitdiff
path: root/fw/Makefile
diff options
context:
space:
mode:
authorjaseg <git@jaseg.net>2020-12-24 15:35:50 +0100
committerjaseg <git@jaseg.net>2020-12-24 15:35:50 +0100
commit8acfdb97b59c9414b24d2b04b07829c68b5b57dc (patch)
tree0c5d296add90b2ef56933b4f180c458ab853d17d /fw/Makefile
parent278c9c79c27276188eecc0da391e006c99704d6f (diff)
downloadminikbd-8acfdb97b59c9414b24d2b04b07829c68b5b57dc.tar.gz
minikbd-8acfdb97b59c9414b24d2b04b07829c68b5b57dc.tar.bz2
minikbd-8acfdb97b59c9414b24d2b04b07829c68b5b57dc.zip
Fix ALL the bugs
Diffstat (limited to 'fw/Makefile')
-rw-r--r--fw/Makefile13
1 files changed, 10 insertions, 3 deletions
diff --git a/fw/Makefile b/fw/Makefile
index 0a83aa2..53fc967 100644
--- a/fw/Makefile
+++ b/fw/Makefile
@@ -63,7 +63,7 @@ LDSCRIPT := STM32F072CBUx_FLASH.ld
ARCH_FLAGS := -mthumb -mcpu=cortex-m0 -mfloat-abi=soft
SYSTEM_FLAGS += -nostdlib -ffreestanding -nostartfiles
-CFLAGS := -O0 -std=gnu11
+CFLAGS := -O0 -g -std=gnu11
CFLAGS += -DUSE_HAL_DRIVER -DSTM32F072xB
CFLAGS += -DSTM32F0 -DDEBUG=$(DEBUG)
# ST weirdness
@@ -131,10 +131,10 @@ DOT ?= dot
# Rules
########################################################################################################################
-all: binsize
+all: binsize $(BUILDDIR)/$(BINARY:.elf=.bin)
.PHONY: binsize
-binsize: $(BUILDDIR)/$(BINARY) $(BUILDDIR)/$(BINARY:.elf=-symbol-sizes.pdf)
+binsize: $(BUILDDIR)/$(BINARY) $(BUILDDIR)/$(BINARY:.elf=-symbol-sizes.pdf)
@echo
@$(LD) -T$(LDSCRIPT) $(LDFLAGS) -Wl,--print-memory-usage -o /dev/null $(OBJS) $(LIBS)
@echo
@@ -159,6 +159,9 @@ build/$(BINARY:.elf=-symbol-sizes.dot): $(OBJS) FORCE
%.dot: %.elf
r2 -a arm -qc 'aa;agRd' $< 2>/dev/null >$@
+%.bin: %.elf
+ $(OBJCOPY) -O binary $^ $@
+
$(BUILDDIR)/src/%.o: src/%.s
mkdir -p $(@D)
$(CC) $(COMMON_CFLAGS) $(CFLAGS) $(INT_CFLAGS) -o $@ -c $<
@@ -179,6 +182,10 @@ $(BUILDDIR)/%.o: %.c
mkdir -p $(@D)
$(CC) $(COMMON_CFLAGS) $(CFLAGS) $(EXT_CFLAGS) -o $@ -c $<
+.PHONY: flash
+flash: $(BUILDDIR)/$(BINARY:.elf=.bin)
+ dfu-util -a 0 -s 0x08000000 -D $^
+
clean:
rm -rf $(BUILDDIR)/src
rm -rf $(BUILDDIR)/generated