makefile: Add ability to flash binary to microcontroller
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
.direnv/
|
||||
.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
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user