From 8acfdb97b59c9414b24d2b04b07829c68b5b57dc Mon Sep 17 00:00:00 2001 From: jaseg Date: Thu, 24 Dec 2020 15:35:50 +0100 Subject: Fix ALL the bugs --- fw/Makefile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'fw/Makefile') 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 -- cgit