[build] Add mendatory USE_IN_FACTORY variable to binpack rule

This variable specifies whether the binpack is used for first-time
flashing on assembly-line, or for diagnostic later on.
This commit is contained in:
Gabriel Ozouf
2021-03-15 17:11:58 +01:00
committed by Gabriel
parent 8705ddaf8a
commit 00b74430cd
2 changed files with 13 additions and 5 deletions

View File

@@ -31,15 +31,21 @@ $(BUILD_DIR)/test.external_flash.write.$(EXE): $(BUILD_DIR)/quiz/src/test_ion_ex
.PHONY: binpack
binpack:
ifndef USE_IN_FACTORY
@echo "CAUTION: You are building a binpack."
@echo "You must specify where this binpack will be used"
@echo "Please set the USE_IN_FACTORY environment variable to either 0 or 1 to proceed."
@exit -1
endif
rm -rf output/binpack
mkdir -p output/binpack
$(MAKE) clean
$(MAKE) $(BUILD_DIR)/flasher.light.bin
$(MAKE) $(BUILD_DIR)/flasher.light.bin IN_FACTORY=$(USE_IN_FACTORY)
cp $(BUILD_DIR)/flasher.light.bin output/binpack
$(MAKE) $(BUILD_DIR)/bench.flash.bin
$(MAKE) $(BUILD_DIR)/bench.ram.bin
$(MAKE) $(BUILD_DIR)/bench.flash.bin IN_FACTORY=$(USE_IN_FACTORY)
$(MAKE) $(BUILD_DIR)/bench.ram.bin IN_FACTORY=$(USE_IN_FACTORY)
cp $(BUILD_DIR)/bench.ram.bin $(BUILD_DIR)/bench.flash.bin output/binpack
$(MAKE) epsilon.official.onboarding.update.two_binaries
$(MAKE) epsilon.official.onboarding.update.two_binaries IN_FACTORY=$(USE_IN_FACTORY)
cp $(BUILD_DIR)/epsilon.official.onboarding.update.internal.bin $(BUILD_DIR)/epsilon.official.onboarding.update.external.bin output/binpack
$(MAKE) clean
cd output && for binary in flasher.light.bin bench.flash.bin bench.ram.bin epsilon.official.onboarding.update.internal.bin epsilon.official.onboarding.update.external.bin; do shasum -a 256 -b binpack/$${binary} > binpack/$${binary}.sha256;done

View File

@@ -12,7 +12,9 @@ endif
ion_src += ion/src/shared/collect_registers.cpp
ION_DEVICE_SFLAGS = -Iion/src/device/$(MODEL) -Iion/src/device/shared -DPCB_LATEST=$(PCB_LATEST)
IN_FACTORY ?= 0
ION_DEVICE_SFLAGS = -Iion/src/device/$(MODEL) -Iion/src/device/shared -DPCB_LATEST=$(PCB_LATEST) -DIN_FACTORY=$(IN_FACTORY)
$(call object_for,$(ion_device_src) $(ion_device_flasher_src) $(ion_device_bench_src)): SFLAGS += $(ION_DEVICE_SFLAGS)