makefile: Add ability to flash binary to microcontroller

This commit is contained in:
Alexander Heldt
2024-07-28 11:52:54 +02:00
parent 5b5da238d5
commit 278d3cfb9d
3 changed files with 9 additions and 0 deletions

View File

@@ -33,6 +33,9 @@ OBJ_FILES := $(patsubst $(BUILD_DIR)/%.S,$(BUILD_DIR)/%.o,$(ASM_FILES))
.PHONY: build
build: builddir preprocess compile assemble $(BUILD_DIR)/$(TARGET).elf
$(BUILD_DIR)/$(TARGET).bin: $(BUILD_DIR)/$(TARGET).elf
arm-none-eabi-objcopy -O binary $< $@
$(BUILD_DIR)/$(TARGET).elf: $(OBJ_FILES)
$(CC) $(LDFLAGS) $^ -o $@
@@ -58,6 +61,10 @@ compile: preprocess $(ASM_FILES)
.PHONY: assemble
assemble: compile $(OBJ_FILES)
.PHONY: flash
flash: $(BUILD_DIR)/$(TARGET).bin
st-flash --reset write $< 0x8000000
.PHONY: clean
clean:
rm -rf $(BUILD_DIR)