From 31ae3fe683d9ccab3aa4fc1cc93b2ee67d84d454 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Mon, 20 Aug 2018 17:39:56 +1000 Subject: [PATCH] make: Use order-only prereq to check python dependencies --- components/app_update/Makefile.projbuild | 3 +-- components/bootloader/Makefile.projbuild | 15 +++++---------- components/esptool_py/Makefile.projbuild | 12 ++++-------- components/partition_table/Makefile.projbuild | 9 +++------ make/project.mk | 4 +--- 5 files changed, 14 insertions(+), 29 deletions(-) diff --git a/components/app_update/Makefile.projbuild b/components/app_update/Makefile.projbuild index 5045d19e4f..a21e047b8b 100644 --- a/components/app_update/Makefile.projbuild +++ b/components/app_update/Makefile.projbuild @@ -49,8 +49,7 @@ $(BLANK_OTA_DATA_FILE): partition_table_get_info blank_ota_data: $(BLANK_OTA_DATA_FILE) -erase_ota: partition_table_get_info - $(CHECK_PYTHON_DEPENDENCIES_CMD) +erase_ota: partition_table_get_info check_python_dependencies @echo $(if $(OTA_DATA_OFFSET), "Erase ota_data [addr=$(OTA_DATA_OFFSET) size=$(OTA_DATA_SIZE)] ...", $(error "ERROR: Partition table does not have ota_data partition.")) $(ESPTOOLPY_SERIAL) erase_region $(OTA_DATA_OFFSET) $(OTA_DATA_SIZE) diff --git a/components/bootloader/Makefile.projbuild b/components/bootloader/Makefile.projbuild index d6c7a27960..0ca615d327 100644 --- a/components/bootloader/Makefile.projbuild +++ b/components/bootloader/Makefile.projbuild @@ -49,16 +49,14 @@ ifndef CONFIG_SECURE_BOOT_ENABLED # If secure boot disabled, bootloader flashing is integrated # with 'make flash' and no warnings are printed. -bootloader: $(BOOTLOADER_BIN) - $(CHECK_PYTHON_DEPENDENCIES_CMD) +bootloader: $(BOOTLOADER_BIN) check_python_dependencies @echo $(SEPARATOR) @echo "Bootloader built. Default flash command is:" @echo "$(ESPTOOLPY_WRITE_FLASH) $(BOOTLOADER_OFFSET) $^" ESPTOOL_ALL_FLASH_ARGS += $(BOOTLOADER_OFFSET) $(BOOTLOADER_BIN) -bootloader-flash: $(BOOTLOADER_BIN) $(call prereq_if_explicit,erase_flash) - $(CHECK_PYTHON_DEPENDENCIES_CMD) +bootloader-flash: $(BOOTLOADER_BIN) $(call prereq_if_explicit,erase_flash) check_python_dependencies $(ESPTOOLPY_WRITE_FLASH) 0x1000 $^ else ifdef CONFIG_SECURE_BOOTLOADER_ONE_TIME_FLASH @@ -69,8 +67,7 @@ else ifdef CONFIG_SECURE_BOOTLOADER_ONE_TIME_FLASH # The flashing command is deliberately printed without an auto-reset # step, so the device doesn't immediately reset to flash itself. -bootloader: $(BOOTLOADER_BIN) - $(CHECK_PYTHON_DEPENDENCIES_CMD) +bootloader: $(BOOTLOADER_BIN) check_python_dependencies @echo $(SEPARATOR) @echo "Bootloader built. One-time flash command is:" @echo "$(subst hard_reset,no_reset,$(ESPTOOLPY_WRITE_FLASH)) $(BOOTLOADER_OFFSET) $(BOOTLOADER_BIN)" @@ -85,8 +82,7 @@ BOOTLOADER_DIGEST_BIN := $(BOOTLOADER_BUILD_DIR)/bootloader-reflash-digest.bin SECURE_BOOTLOADER_KEY := $(BOOTLOADER_BUILD_DIR)/secure-bootloader-key.bin ifdef CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES -$(SECURE_BOOTLOADER_KEY): $(SECURE_BOOT_SIGNING_KEY) - $(CHECK_PYTHON_DEPENDENCIES_CMD) +$(SECURE_BOOTLOADER_KEY): $(SECURE_BOOT_SIGNING_KEY) | check_python_dependencies $(ESPSECUREPY) digest_private_key -k $< $@ else $(SECURE_BOOTLOADER_KEY): @@ -109,8 +105,7 @@ bootloader: $(BOOTLOADER_DIGEST_BIN) @echo "* After first boot, only re-flashes of this kind (with same key) will be accepted." @echo "* Not recommended to re-use the same secure boot keyfile on multiple production devices." -$(BOOTLOADER_DIGEST_BIN): $(BOOTLOADER_BIN) $(SECURE_BOOTLOADER_KEY) - $(CHECK_PYTHON_DEPENDENCIES_CMD) +$(BOOTLOADER_DIGEST_BIN): $(BOOTLOADER_BIN) $(SECURE_BOOTLOADER_KEY) | check_python_dependencies @echo "DIGEST $(notdir $@)" $(ESPSECUREPY) digest_secure_bootloader -k $(SECURE_BOOTLOADER_KEY) -o $@ $< diff --git a/components/esptool_py/Makefile.projbuild b/components/esptool_py/Makefile.projbuild index 8d37f4e2b4..5e082a2e9b 100644 --- a/components/esptool_py/Makefile.projbuild +++ b/components/esptool_py/Makefile.projbuild @@ -55,20 +55,17 @@ endif # non-secure boot (or bootloader), both these files are the same APP_BIN_UNSIGNED ?= $(APP_BIN) -$(APP_BIN_UNSIGNED): $(APP_ELF) $(ESPTOOLPY_SRC) - $(CHECK_PYTHON_DEPENDENCIES_CMD) +$(APP_BIN_UNSIGNED): $(APP_ELF) $(ESPTOOLPY_SRC) | check_python_dependencies $(ESPTOOLPY) elf2image $(ESPTOOL_FLASH_OPTIONS) $(ESPTOOL_ELF2IMAGE_OPTIONS) -o $@ $< -flash: all_binaries $(ESPTOOLPY_SRC) $(call prereq_if_explicit,erase_flash) partition_table_get_info - $(CHECK_PYTHON_DEPENDENCIES_CMD) +flash: all_binaries $(ESPTOOLPY_SRC) $(call prereq_if_explicit,erase_flash) partition_table_get_info check_python_dependencies @echo "Flashing binaries to serial port $(ESPPORT) (app at offset $(APP_OFFSET))..." ifdef CONFIG_SECURE_BOOT_ENABLED @echo "(Secure boot enabled, so bootloader not flashed automatically. See 'make bootloader' output)" endif $(ESPTOOLPY_WRITE_FLASH) $(ESPTOOL_ALL_FLASH_ARGS) -app-flash: $(APP_BIN) $(ESPTOOLPY_SRC) $(call prereq_if_explicit,erase_flash) partition_table_get_info - $(CHECK_PYTHON_DEPENDENCIES_CMD) +app-flash: $(APP_BIN) $(ESPTOOLPY_SRC) $(call prereq_if_explicit,erase_flash) partition_table_get_info check_python_dependencies @echo "Flashing app to serial port $(ESPPORT), offset $(APP_OFFSET)..." $(ESPTOOLPY_WRITE_FLASH) $(APP_OFFSET) $(APP_BIN) @@ -76,8 +73,7 @@ app-flash: $(APP_BIN) $(ESPTOOLPY_SRC) $(call prereq_if_explicit,erase_flash) pa # at the project level as long as qualified path COMPONENT_SUBMODULES += $(COMPONENT_PATH)/esptool -erase_flash: - $(CHECK_PYTHON_DEPENDENCIES_CMD) +erase_flash: check_python_dependencies @echo "Erasing entire flash..." $(ESPTOOLPY_SERIAL) erase_flash diff --git a/components/partition_table/Makefile.projbuild b/components/partition_table/Makefile.projbuild index 7bbf3f4897..5d04636b1a 100644 --- a/components/partition_table/Makefile.projbuild +++ b/components/partition_table/Makefile.projbuild @@ -56,8 +56,7 @@ else PARTITION_TABLE_BIN_UNSIGNED := $(PARTITION_TABLE_BIN) endif -$(PARTITION_TABLE_BIN_UNSIGNED): $(PARTITION_TABLE_CSV_PATH) $(SDKCONFIG_MAKEFILE) - $(CHECK_PYTHON_DEPENDENCIES_CMD) +$(PARTITION_TABLE_BIN_UNSIGNED): $(PARTITION_TABLE_CSV_PATH) $(SDKCONFIG_MAKEFILE) | check_python_dependencies @echo "Building partitions from $(PARTITION_TABLE_CSV_PATH)..." $(GEN_ESP32PART) $< $@ @@ -77,8 +76,7 @@ export OTA_DATA_SIZE PARTITION_TABLE_FLASH_CMD = $(ESPTOOLPY_SERIAL) write_flash $(PARTITION_TABLE_OFFSET) $(PARTITION_TABLE_BIN) ESPTOOL_ALL_FLASH_ARGS += $(PARTITION_TABLE_OFFSET) $(PARTITION_TABLE_BIN) -partition_table: $(PARTITION_TABLE_BIN) partition_table_get_info - $(CHECK_PYTHON_DEPENDENCIES_CMD) +partition_table: $(PARTITION_TABLE_BIN) partition_table_get_info check_python_dependencies @echo "Partition table binary generated. Contents:" @echo $(SEPARATOR) $(GEN_ESP32PART) $< @@ -86,8 +84,7 @@ partition_table: $(PARTITION_TABLE_BIN) partition_table_get_info @echo "Partition flashing command:" @echo "$(PARTITION_TABLE_FLASH_CMD)" -partition_table-flash: $(PARTITION_TABLE_BIN) - $(CHECK_PYTHON_DEPENDENCIES_CMD) +partition_table-flash: $(PARTITION_TABLE_BIN) check_python_dependencies @echo "Flashing partition table..." $(PARTITION_TABLE_FLASH_CMD) diff --git a/make/project.mk b/make/project.mk index 305fb3bd5e..f4c743e09e 100644 --- a/make/project.mk +++ b/make/project.mk @@ -422,13 +422,11 @@ else @echo $(ESPTOOLPY_WRITE_FLASH) $(APP_OFFSET) $(APP_BIN) endif -CHECK_PYTHON_DEPENDENCIES_CMD := $(PYTHON) $(IDF_PATH)/tools/check_python_dependencies.py - .PHONY: check_python_dependencies # Notify users when some of the required python packages are not installed check_python_dependencies: - $(CHECK_PYTHON_DEPENDENCIES_CMD) + $(PYTHON) $(IDF_PATH)/tools/check_python_dependencies.py all_binaries: $(APP_BIN)