Merge pull request #2 from dhylands/fix-makefile
Fix up Makefile dependencies
This commit is contained in:
commit
56cf514627
|
@ -198,37 +198,51 @@ OBJ += $(BUILD)/pins_gen.o
|
||||||
$(BUILD)/$(FATFS_DIR)/ff.o: COPT += -Os
|
$(BUILD)/$(FATFS_DIR)/ff.o: COPT += -Os
|
||||||
$(filter $(PY_BUILD)/../extmod/vfs_fat_%.o, $(PY_O)): COPT += -Os
|
$(filter $(PY_BUILD)/../extmod/vfs_fat_%.o, $(PY_O)): COPT += -Os
|
||||||
|
|
||||||
.phony: all flash sd
|
.phony: all flash sd binary hex
|
||||||
|
|
||||||
all: $(BUILD)/firmware.elf binary hex
|
all: binary hex
|
||||||
|
|
||||||
|
OUTPUT_FILENAME = firmware
|
||||||
|
|
||||||
|
## Create binary .bin file from the .out file
|
||||||
|
binary: $(BUILD)/$(OUTPUT_FILENAME).bin
|
||||||
|
|
||||||
|
$(BUILD)/$(OUTPUT_FILENAME).bin: $(BUILD)/$(OUTPUT_FILENAME).elf
|
||||||
|
$(OBJCOPY) -O binary $< $@
|
||||||
|
|
||||||
|
## Create binary .hex file from the .out file
|
||||||
|
hex: $(BUILD)/$(OUTPUT_FILENAME).hex
|
||||||
|
|
||||||
|
$(BUILD)/$(OUTPUT_FILENAME).hex: $(BUILD)/$(OUTPUT_FILENAME).elf
|
||||||
|
$(OBJCOPY) -O ihex $< $@
|
||||||
|
|
||||||
FLASHER ?=
|
FLASHER ?=
|
||||||
|
|
||||||
ifeq ($(FLASHER),)
|
ifeq ($(FLASHER),)
|
||||||
|
|
||||||
flash: $(BUILD)/firmware.elf
|
flash: $(BUILD)/$(OUTPUT_FILENAME).hex
|
||||||
nrfjprog --program $(BUILD)/firmware.hex --sectorerase -f $(MCU_VARIANT)
|
nrfjprog --program $< --sectorerase -f $(MCU_VARIANT)
|
||||||
nrfjprog --reset -f $(MCU_VARIANT)
|
nrfjprog --reset -f $(MCU_VARIANT)
|
||||||
|
|
||||||
sd:
|
sd: $(BUILD)/$(OUTPUT_FILENAME).hex
|
||||||
nrfjprog --eraseall -f $(MCU_VARIANT)
|
nrfjprog --eraseall -f $(MCU_VARIANT)
|
||||||
nrfjprog --program $(SOFTDEV_HEX) -f $(MCU_VARIANT)
|
nrfjprog --program $(SOFTDEV_HEX) -f $(MCU_VARIANT)
|
||||||
nrfjprog --program $(BUILD)/firmware.hex --sectorerase -f $(MCU_VARIANT)
|
nrfjprog --program $< --sectorerase -f $(MCU_VARIANT)
|
||||||
nrfjprog --reset -f $(MCU_VARIANT)
|
nrfjprog --reset -f $(MCU_VARIANT)
|
||||||
|
|
||||||
else ifeq ($(FLASHER), pyocd)
|
else ifeq ($(FLASHER), pyocd)
|
||||||
|
|
||||||
flash: $(BUILD)/firmware.elf
|
flash: $(BUILD)/$(OUTPUT_FILENAME).hex
|
||||||
pyocd-flashtool -t $(MCU_VARIANT) $(BUILD)/firmware.hex
|
pyocd-flashtool -t $(MCU_VARIANT) $<
|
||||||
|
|
||||||
sd:
|
sd: $(BUILD)/$(OUTPUT_FILENAME).hex
|
||||||
pyocd-flashtool -t $(MCU_VARIANT) --chip_erase
|
pyocd-flashtool -t $(MCU_VARIANT) --chip_erase
|
||||||
pyocd-flashtool -t $(MCU_VARIANT) $(SOFTDEV_HEX)
|
pyocd-flashtool -t $(MCU_VARIANT) $(SOFTDEV_HEX)
|
||||||
pyocd-flashtool -t $(MCU_VARIANT) $(BUILD)/firmware.hex
|
pyocd-flashtool -t $(MCU_VARIANT) $<
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(BUILD)/firmware.elf: $(OBJ)
|
$(BUILD)/$(OUTPUT_FILENAME).elf: $(OBJ)
|
||||||
$(ECHO) "LINK $@"
|
$(ECHO) "LINK $@"
|
||||||
$(Q)$(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
|
$(Q)$(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
|
||||||
$(Q)$(SIZE) $@
|
$(Q)$(SIZE) $@
|
||||||
|
@ -280,4 +294,4 @@ CFLAGS += -DMICROPY_MODULE_FROZEN_MPY
|
||||||
endif
|
endif
|
||||||
|
|
||||||
include ../py/mkrules.mk
|
include ../py/mkrules.mk
|
||||||
include mkrules.mk
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
OUTPUT_FILENAME = firmware
|
|
||||||
|
|
||||||
## Create binary .bin file from the .out file
|
|
||||||
binary:
|
|
||||||
$(OBJCOPY) -O binary $(BUILD)/$(OUTPUT_FILENAME).elf $(BUILD)/$(OUTPUT_FILENAME).bin
|
|
||||||
|
|
||||||
## Create binary .hex file from the .out file
|
|
||||||
hex:
|
|
||||||
$(OBJCOPY) -O ihex $(BUILD)/$(OUTPUT_FILENAME).elf $(BUILD)/$(OUTPUT_FILENAME).hex
|
|
||||||
|
|
Loading…
Reference in New Issue