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

Loading…
Cancel
Save