mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[build] Use rule_for/rule_label when needed
This commit is contained in:
@@ -3,23 +3,25 @@ include build/targets.device.$(MODEL).mak
|
||||
executables += flasher.light flasher.verbose bench.ram bench.flash
|
||||
extensions += .dfu .hex .bin
|
||||
|
||||
$(BUILD_DIR)/%.dfu: $(BUILD_DIR)/%.$(EXE)
|
||||
@echo "DFUSE $@"
|
||||
$(Q) $(PYTHON) build/device/elf2dfu.py $< $@
|
||||
$(eval $(call rule_for, \
|
||||
DFUSE, %.dfu, %.$$(EXE), \
|
||||
$$(PYTHON) build/device/elf2dfu.py $$< $$@ \
|
||||
))
|
||||
|
||||
$(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.$(EXE)
|
||||
@echo "OBJCOPY $@"
|
||||
$(Q) $(OBJCOPY) -O ihex $< $@
|
||||
$(eval $(call rule_for, \
|
||||
OBJCOPY, %.hex, %.$$(EXE), \
|
||||
$$(OBJCOPY) -O ihex $$< $$@ \
|
||||
))
|
||||
|
||||
$(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.$(EXE)
|
||||
@echo "OBJCOPY $@"
|
||||
$(Q) $(OBJCOPY) -O binary $< $@
|
||||
# We pad the device binary files because there was a bug in an older version of
|
||||
# the dfu code, and it did not upload properly a binary of length non-multiple
|
||||
# of 32 bits.
|
||||
#TODO: We over-pad here, pad with the the needed amount of bytes only.
|
||||
@echo "Padding $@"
|
||||
$(Q) printf "\xFF\xFF\xFF\xFF" >> $@
|
||||
$(eval $(call rule_for, \
|
||||
OBJCOPY, %.bin, %.$$(EXE), \
|
||||
$$(OBJCOPY) -O ihex $$< $$@ && printf "\xFF\xFF\xFF\xFF" >> $$@, \
|
||||
with_local_version \
|
||||
))
|
||||
|
||||
.PHONY: %_size
|
||||
%_size: $(BUILD_DIR)/%.$(EXE)
|
||||
|
||||
@@ -79,8 +79,8 @@ $(BUILD_DIR)/ion/src/device/shared/usb/dfu.elf: $(call object_for,$(usb_src) $(d
|
||||
# For our purpose, dfu.o can go in rodata section and we rename the start and
|
||||
# end of binary symbols: _dfu_bootloader_flash_[start/end]
|
||||
$(BUILD_DIR)/ion/src/device/shared/usb/dfu.o: $(BUILD_DIR)/ion/src/device/shared/usb/dfu.bin
|
||||
@echo "OBJCOPY $@"
|
||||
$(call rule_label,OBJCOPY)
|
||||
$(Q) cd $(dir $<) ; $(OBJCOPY) -I binary -O elf32-littlearm -B arm --rename-section .data=.rodata.dfu_bootloader --redefine-sym _binary_dfu_bin_start=_dfu_bootloader_flash_start --redefine-sym _binary_dfu_bin_end=_dfu_bootloader_flash_end $(notdir $<) $(notdir $@)
|
||||
|
||||
ion_device_dfu_relocated_src += ion/src/device/shared/usb/dfu.cpp
|
||||
ion_device_dfu_relocated_src += ion/src/device/shared/usb/dfu_relocated.cpp
|
||||
ion_device_dfu_relocated_src += ion/src/device/shared/usb/dfu_relocated.cpp
|
||||
|
||||
Reference in New Issue
Block a user