add upload target; fix indentation

main
Clyne 2 years ago
parent d96a5f57fe
commit b8585da5c8

@ -1,7 +1,9 @@
CC := arm-none-eabi-gcc
AS := arm-none-eabi-as AS := arm-none-eabi-as
CC := arm-none-eabi-gcc
OBJCOPY := arm-none-eabi-objcopy
OUTFILE := main.out OUTFILE := main.out
HEXFILE := $(subst .out,.hex,$(OUTFILE))
MCUFLAGS := -mthumb -mcpu=cortex-m4 #-mfloat-abi=hard -mfpu=fpv4-sp-d16 MCUFLAGS := -mthumb -mcpu=cortex-m4 #-mfloat-abi=hard -mfpu=fpv4-sp-d16
AFLAGS = $(MCUFLAGS) AFLAGS = $(MCUFLAGS)
@ -16,14 +18,22 @@ CFILES += $(wildcard $(COMMON_DIR)/*.c) \
OFILES := $(patsubst %.c, %.o, $(patsubst %.s, %.o, $(CFILES))) OFILES := $(patsubst %.c, %.o, $(patsubst %.s, %.o, $(CFILES)))
.PHONY: all clean .PHONY: all upload clean
all: $(OUTFILE) all: $(OUTFILE)
upload: $(HEXFILE)
@openocd -f interface/stlink.cfg -f target/stm32l4x.cfg \
-c "program $(HEXFILE) verify reset exit"
clean: clean:
@echo " CLEAN" @echo " CLEAN"
@rm -f $(OUTFILE) $(OFILES) @rm -f $(OUTFILE) $(OFILES)
$(HEXFILE): $(OUTFILE)
@echo " OBJCOPY " $@
@$(OBJCOPY) -O ihex $< $@
$(OUTFILE): $(OFILES) $(OUTFILE): $(OFILES)
@echo " CC " $@ @echo " CC " $@
@$(CC) $(CFLAGS) $(LDFLAGS) $(OFILES) -o $@ @$(CC) $(CFLAGS) $(LDFLAGS) $(OFILES) -o $@

Loading…
Cancel
Save