makefile: Add ability to flash binary to microcontroller
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
.direnv/
|
.direnv/
|
||||||
.ccls-cache/
|
.ccls-cache/
|
||||||
|
build/*.bin
|
||||||
|
|||||||
7
Makefile
7
Makefile
@@ -33,6 +33,9 @@ OBJ_FILES := $(patsubst $(BUILD_DIR)/%.S,$(BUILD_DIR)/%.o,$(ASM_FILES))
|
|||||||
.PHONY: build
|
.PHONY: build
|
||||||
build: builddir preprocess compile assemble $(BUILD_DIR)/$(TARGET).elf
|
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)
|
$(BUILD_DIR)/$(TARGET).elf: $(OBJ_FILES)
|
||||||
$(CC) $(LDFLAGS) $^ -o $@
|
$(CC) $(LDFLAGS) $^ -o $@
|
||||||
|
|
||||||
@@ -58,6 +61,10 @@ compile: preprocess $(ASM_FILES)
|
|||||||
.PHONY: assemble
|
.PHONY: assemble
|
||||||
assemble: compile $(OBJ_FILES)
|
assemble: compile $(OBJ_FILES)
|
||||||
|
|
||||||
|
.PHONY: flash
|
||||||
|
flash: $(BUILD_DIR)/$(TARGET).bin
|
||||||
|
st-flash --reset write $< 0x8000000
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(BUILD_DIR)
|
rm -rf $(BUILD_DIR)
|
||||||
|
|||||||
Reference in New Issue
Block a user