summaryrefslogtreecommitdiff
path: root/fw/Makefile
diff options
context:
space:
mode:
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