xtensa/esp32: Refactor makefiles for compliance to Function Call Syntax
According to Make documentation: - "Commas and unmatched parentheses or braces cannot appear in the text of an argument as written"; - "Leading spaces cannot appear in the text of the first argument as written". Although in the current state it was not resulting in parsing issues, it is better to fix it. Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
This commit is contained in:
parent
6c3223289f
commit
d22a2aa7a0
@ -31,6 +31,11 @@ BOOTLOADER_CONFIG = $(CHIPDIR)/bootloader.conf
|
|||||||
$(BOOTLOADER_SRCDIR):
|
$(BOOTLOADER_SRCDIR):
|
||||||
$(Q) git clone $(BOOTLOADER_URL) $(BOOTLOADER_SRCDIR) -b $(BOOTLOADER_VERSION)
|
$(Q) git clone $(BOOTLOADER_URL) $(BOOTLOADER_SRCDIR) -b $(BOOTLOADER_VERSION)
|
||||||
|
|
||||||
|
# Helpers for creating the configuration file
|
||||||
|
|
||||||
|
cfg_en = echo "$(1)=$(if $(CONFIG_ESP32_APP_FORMAT_MCUBOOT),1,y)";
|
||||||
|
cfg_val = echo "$(1)=$(2)";
|
||||||
|
|
||||||
# Commands for colored and formatted output
|
# Commands for colored and formatted output
|
||||||
|
|
||||||
RED = \033[1;31m
|
RED = \033[1;31m
|
||||||
@ -50,74 +55,44 @@ ifeq ($(CONFIG_ESP32_SECURE_BOOT),y)
|
|||||||
endif
|
endif
|
||||||
$(Q) echo "Creating Bootloader configuration"
|
$(Q) echo "Creating Bootloader configuration"
|
||||||
$(Q) { \
|
$(Q) { \
|
||||||
$(if $(CONFIG_ESP32_FLASH_2M), echo "CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y";) \
|
$(if $(CONFIG_ESP32_FLASH_2M),$(call cfg_en,CONFIG_ESPTOOLPY_FLASHSIZE_2MB)) \
|
||||||
$(if $(CONFIG_ESP32_FLASH_4M), echo "CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y";) \
|
$(if $(CONFIG_ESP32_FLASH_4M),$(call cfg_en,CONFIG_ESPTOOLPY_FLASHSIZE_4MB)) \
|
||||||
$(if $(CONFIG_ESP32_FLASH_8M), echo "CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y";) \
|
$(if $(CONFIG_ESP32_FLASH_8M),$(call cfg_en,CONFIG_ESPTOOLPY_FLASHSIZE_8MB)) \
|
||||||
$(if $(CONFIG_ESP32_FLASH_16M), echo "CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y";) \
|
$(if $(CONFIG_ESP32_FLASH_16M),$(call cfg_en,CONFIG_ESPTOOLPY_FLASHSIZE_16MB)) \
|
||||||
$(if $(CONFIG_ESP32_FLASH_MODE_DIO), echo "CONFIG_ESPTOOLPY_FLASHMODE_DIO=y";) \
|
$(if $(CONFIG_ESP32_FLASH_MODE_DIO),$(call cfg_en,CONFIG_ESPTOOLPY_FLASHMODE_DIO)) \
|
||||||
$(if $(CONFIG_ESP32_FLASH_MODE_DOUT), echo "CONFIG_ESPTOOLPY_FLASHMODE_DOUT=y";) \
|
$(if $(CONFIG_ESP32_FLASH_MODE_DOUT),$(call cfg_en,CONFIG_ESPTOOLPY_FLASHMODE_DOUT)) \
|
||||||
$(if $(CONFIG_ESP32_FLASH_MODE_QIO), echo "CONFIG_ESPTOOLPY_FLASHMODE_QIO=y";) \
|
$(if $(CONFIG_ESP32_FLASH_MODE_QIO),$(call cfg_en,CONFIG_ESPTOOLPY_FLASHMODE_QIO)) \
|
||||||
$(if $(CONFIG_ESP32_FLASH_MODE_QOUT), echo "CONFIG_ESPTOOLPY_FLASHMODE_QOUT=y";) \
|
$(if $(CONFIG_ESP32_FLASH_MODE_QOUT),$(call cfg_en,CONFIG_ESPTOOLPY_FLASHMODE_QOUT)) \
|
||||||
$(if $(CONFIG_ESP32_FLASH_FREQ_80M), echo "CONFIG_ESPTOOLPY_FLASHFREQ_80M=y";) \
|
$(if $(CONFIG_ESP32_FLASH_FREQ_80M),$(call cfg_en,CONFIG_ESPTOOLPY_FLASHFREQ_80M)) \
|
||||||
$(if $(CONFIG_ESP32_FLASH_FREQ_40M), echo "CONFIG_ESPTOOLPY_FLASHFREQ_40M=y";) \
|
$(if $(CONFIG_ESP32_FLASH_FREQ_40M),$(call cfg_en,CONFIG_ESPTOOLPY_FLASHFREQ_40M)) \
|
||||||
$(if $(CONFIG_ESP32_FLASH_FREQ_26M), echo "CONFIG_ESPTOOLPY_FLASHFREQ_26M=y";) \
|
$(if $(CONFIG_ESP32_FLASH_FREQ_26M),$(call cfg_en,CONFIG_ESPTOOLPY_FLASHFREQ_26M)) \
|
||||||
$(if $(CONFIG_ESP32_FLASH_FREQ_20M), echo "CONFIG_ESPTOOLPY_FLASHFREQ_20M=y";) \
|
$(if $(CONFIG_ESP32_FLASH_FREQ_20M),$(call cfg_en,CONFIG_ESPTOOLPY_FLASHFREQ_20M)) \
|
||||||
} > $(BOOTLOADER_CONFIG)
|
} > $(BOOTLOADER_CONFIG)
|
||||||
ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y)
|
ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y)
|
||||||
$(eval KEYDIR := $(TOPDIR)/$(ESPSEC_KEYDIR))
|
|
||||||
$(eval APP_SIGN_KEY := $(abspath $(KEYDIR)/$(subst ",,$(CONFIG_ESP32_SECURE_BOOT_APP_SIGNING_KEY))))
|
|
||||||
$(Q) { \
|
$(Q) { \
|
||||||
$(if $(CONFIG_ESP32_SECURE_BOOT), \
|
$(if $(CONFIG_ESP32_SECURE_BOOT),$(call cfg_en,CONFIG_SECURE_BOOT)$(call cfg_en,CONFIG_SECURE_BOOT_V2_ENABLED)$(call cfg_val,CONFIG_ESP_SIGN_KEY_FILE,$(abspath $(TOPDIR)/$(ESPSEC_KEYDIR)/$(subst ",,$(CONFIG_ESP32_SECURE_BOOT_APP_SIGNING_KEY))))) \
|
||||||
echo "CONFIG_SECURE_BOOT=y"; \
|
$(if $(CONFIG_ESP32_SECURE_SIGNED_APPS_SCHEME_RSA_2048),$(call cfg_en,CONFIG_ESP_USE_MBEDTLS)$(call cfg_en,CONFIG_ESP_SIGN_RSA)$(call cfg_val,CONFIG_ESP_SIGN_RSA_LEN,2048)) \
|
||||||
echo "CONFIG_SECURE_BOOT_V2_ENABLED=y"; \
|
$(if $(CONFIG_ESP32_SECURE_SIGNED_APPS_SCHEME_RSA_3072),$(call cfg_en,CONFIG_ESP_USE_MBEDTLS)$(call cfg_en,CONFIG_ESP_SIGN_RSA)$(call cfg_val,CONFIG_ESP_SIGN_RSA_LEN,3072)) \
|
||||||
echo "CONFIG_ESP_SIGN_KEY_FILE=$(APP_SIGN_KEY)"; \
|
$(if $(CONFIG_ESP32_SECURE_SIGNED_APPS_SCHEME_ECDSA_P256),$(call cfg_en,CONFIG_ESP_USE_TINYCRYPT)$(call cfg_en,CONFIG_ESP_SIGN_EC256)) \
|
||||||
) \
|
$(if $(CONFIG_ESP32_SECURE_SIGNED_APPS_SCHEME_ED25519),$(call cfg_en,CONFIG_ESP_USE_TINYCRYPT)$(call cfg_en,CONFIG_ESP_SIGN_ED25519)) \
|
||||||
$(if $(CONFIG_ESP32_SECURE_SIGNED_APPS_SCHEME_RSA_2048), \
|
$(if $(CONFIG_ESP32_SECURE_BOOT_ALLOW_ROM_BASIC),$(call cfg_en,CONFIG_SECURE_BOOT_ALLOW_ROM_BASIC)) \
|
||||||
echo "CONFIG_ESP_USE_MBEDTLS=y"; \
|
$(if $(CONFIG_ESP32_SECURE_BOOT_ALLOW_JTAG),$(call cfg_en,CONFIG_SECURE_BOOT_ALLOW_JTAG)) \
|
||||||
echo "CONFIG_ESP_SIGN_RSA=y"; \
|
$(if $(CONFIG_ESP32_SECURE_BOOT_ALLOW_EFUSE_RD_DIS),$(call cfg_en,CONFIG_SECURE_BOOT_V2_ALLOW_EFUSE_RD_DIS)) \
|
||||||
echo "CONFIG_ESP_SIGN_RSA_LEN=2048"; \
|
$(if $(CONFIG_ESP32_SECURE_DISABLE_ROM_DL_MODE),$(call cfg_en,CONFIG_SECURE_DISABLE_ROM_DL_MODE)) \
|
||||||
) \
|
$(if $(CONFIG_ESP32_SECURE_INSECURE_ALLOW_DL_MODE),$(call cfg_en,CONFIG_SECURE_INSECURE_ALLOW_DL_MODE)) \
|
||||||
$(if $(CONFIG_ESP32_SECURE_SIGNED_APPS_SCHEME_RSA_3072), \
|
$(call cfg_val,CONFIG_ESP_BOOTLOADER_SIZE,0xF000) \
|
||||||
echo "CONFIG_ESP_USE_MBEDTLS=y"; \
|
$(call cfg_val,CONFIG_ESP_APPLICATION_PRIMARY_START_ADDRESS,$(CONFIG_ESP32_OTA_PRIMARY_SLOT_OFFSET)) \
|
||||||
echo "CONFIG_ESP_SIGN_RSA=y"; \
|
$(call cfg_val,CONFIG_ESP_APPLICATION_SIZE,$(CONFIG_ESP32_OTA_SLOT_SIZE)) \
|
||||||
echo "CONFIG_ESP_SIGN_RSA_LEN=3072"; \
|
$(call cfg_val,CONFIG_ESP_APPLICATION_SECONDARY_START_ADDRESS,$(CONFIG_ESP32_OTA_SECONDARY_SLOT_OFFSET)) \
|
||||||
) \
|
$(call cfg_en,CONFIG_ESP_MCUBOOT_WDT_ENABLE) \
|
||||||
$(if $(CONFIG_ESP32_SECURE_SIGNED_APPS_SCHEME_ECDSA_P256), \
|
$(call cfg_val,CONFIG_ESP_SCRATCH_OFFSET,$(CONFIG_ESP32_OTA_SCRATCH_OFFSET)) \
|
||||||
echo "CONFIG_ESP_USE_TINYCRYPT=y"; \
|
$(call cfg_val,CONFIG_ESP_SCRATCH_SIZE,$(CONFIG_ESP32_OTA_SCRATCH_SIZE)) \
|
||||||
echo "CONFIG_ESP_SIGN_EC256=y"; \
|
|
||||||
) \
|
|
||||||
$(if $(CONFIG_ESP32_SECURE_SIGNED_APPS_SCHEME_ED25519), \
|
|
||||||
echo "CONFIG_ESP_USE_TINYCRYPT=y"; \
|
|
||||||
echo "CONFIG_ESP_SIGN_ED25519=y"; \
|
|
||||||
) \
|
|
||||||
$(if $(CONFIG_ESP32_SECURE_BOOT_ALLOW_ROM_BASIC), \
|
|
||||||
echo "CONFIG_SECURE_BOOT_ALLOW_ROM_BASIC=y"; \
|
|
||||||
) \
|
|
||||||
$(if $(CONFIG_ESP32_SECURE_BOOT_ALLOW_JTAG), \
|
|
||||||
echo "CONFIG_SECURE_BOOT_ALLOW_JTAG=y"; \
|
|
||||||
) \
|
|
||||||
$(if $(CONFIG_ESP32_SECURE_BOOT_ALLOW_EFUSE_RD_DIS), \
|
|
||||||
echo "CONFIG_SECURE_BOOT_V2_ALLOW_EFUSE_RD_DIS=y"; \
|
|
||||||
) \
|
|
||||||
$(if $(CONFIG_ESP32_SECURE_DISABLE_ROM_DL_MODE), \
|
|
||||||
echo "CONFIG_SECURE_DISABLE_ROM_DL_MODE=y"; \
|
|
||||||
) \
|
|
||||||
$(if $(CONFIG_ESP32_SECURE_INSECURE_ALLOW_DL_MODE), \
|
|
||||||
echo "CONFIG_SECURE_INSECURE_ALLOW_DL_MODE=y"; \
|
|
||||||
) \
|
|
||||||
echo "CONFIG_ESP_BOOTLOADER_SIZE=0xF000"; \
|
|
||||||
echo "CONFIG_ESP_APPLICATION_PRIMARY_START_ADDRESS=$(CONFIG_ESP32_OTA_PRIMARY_SLOT_OFFSET)"; \
|
|
||||||
echo "CONFIG_ESP_APPLICATION_SIZE=$(CONFIG_ESP32_OTA_SLOT_SIZE)"; \
|
|
||||||
echo "CONFIG_ESP_APPLICATION_SECONDARY_START_ADDRESS=$(CONFIG_ESP32_OTA_SECONDARY_SLOT_OFFSET)";\
|
|
||||||
echo "CONFIG_ESP_MCUBOOT_WDT_ENABLE=y"; \
|
|
||||||
echo "CONFIG_ESP_SCRATCH_OFFSET=$(CONFIG_ESP32_OTA_SCRATCH_OFFSET)"; \
|
|
||||||
echo "CONFIG_ESP_SCRATCH_SIZE=$(CONFIG_ESP32_OTA_SCRATCH_SIZE)"; \
|
|
||||||
} >> $(BOOTLOADER_CONFIG)
|
} >> $(BOOTLOADER_CONFIG)
|
||||||
else ifeq ($(CONFIG_ESP32_APP_FORMAT_LEGACY),y)
|
else ifeq ($(CONFIG_ESP32_APP_FORMAT_LEGACY),y)
|
||||||
$(Q) { \
|
$(Q) { \
|
||||||
echo "CONFIG_PARTITION_TABLE_CUSTOM=y"; \
|
$(call cfg_en,CONFIG_PARTITION_TABLE_CUSTOM) \
|
||||||
echo "CONFIG_PARTITION_TABLE_CUSTOM_FILENAME=\"partitions.csv\""; \
|
$(call cfg_val,CONFIG_PARTITION_TABLE_CUSTOM_FILENAME,\"partitions.csv\") \
|
||||||
echo "CONFIG_PARTITION_TABLE_OFFSET=$(CONFIG_ESP32_PARTITION_TABLE_OFFSET)"; \
|
$(call cfg_val,CONFIG_PARTITION_TABLE_OFFSET,$(CONFIG_ESP32_PARTITION_TABLE_OFFSET)) \
|
||||||
} >> $(BOOTLOADER_CONFIG)
|
} >> $(BOOTLOADER_CONFIG)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -156,24 +131,24 @@ endif
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
clean_bootloader:
|
clean_bootloader:
|
||||||
$(call DELDIR, $(BOOTLOADER_SRCDIR))
|
$(call DELDIR,$(BOOTLOADER_SRCDIR))
|
||||||
$(call DELFILE, $(BOOTLOADER_CONFIG))
|
$(call DELFILE,$(BOOTLOADER_CONFIG))
|
||||||
$(call DELFILE, $(BOOTLOADER_BIN))
|
$(call DELFILE,$(BOOTLOADER_BIN))
|
||||||
$(if $(CONFIG_ESP32_SECURE_BOOT_BUILD_SIGNED_BINARIES), $(call DELFILE, $(BOOTLOADER_SIGNED_BIN)))
|
$(if $(CONFIG_ESP32_SECURE_BOOT_BUILD_SIGNED_BINARIES),$(call DELFILE,$(BOOTLOADER_SIGNED_BIN)))
|
||||||
|
|
||||||
else ifeq ($(CONFIG_ESP32_APP_FORMAT_LEGACY),y)
|
else ifeq ($(CONFIG_ESP32_APP_FORMAT_LEGACY),y)
|
||||||
|
|
||||||
bootloader: $(BOOTLOADER_SRCDIR) $(BOOTLOADER_CONFIG)
|
bootloader: $(BOOTLOADER_SRCDIR) $(BOOTLOADER_CONFIG)
|
||||||
$(Q) echo "Building Bootloader binaries"
|
$(Q) echo "Building Bootloader binaries"
|
||||||
$(Q) $(BOOTLOADER_SRCDIR)/build_idfboot.sh -c esp32 -s -f $(BOOTLOADER_CONFIG)
|
$(Q) $(BOOTLOADER_SRCDIR)/build_idfboot.sh -c esp32 -s -f $(BOOTLOADER_CONFIG)
|
||||||
$(call COPYFILE, $(BOOTLOADER_SRCDIR)/$(BOOTLOADER_OUTDIR)/bootloader-esp32.bin, $(TOPDIR))
|
$(call COPYFILE,$(BOOTLOADER_SRCDIR)/$(BOOTLOADER_OUTDIR)/bootloader-esp32.bin,$(TOPDIR))
|
||||||
$(call COPYFILE, $(BOOTLOADER_SRCDIR)/$(BOOTLOADER_OUTDIR)/partition-table-esp32.bin, $(TOPDIR))
|
$(call COPYFILE,$(BOOTLOADER_SRCDIR)/$(BOOTLOADER_OUTDIR)/partition-table-esp32.bin,$(TOPDIR))
|
||||||
|
|
||||||
clean_bootloader:
|
clean_bootloader:
|
||||||
$(call DELDIR, $(BOOTLOADER_SRCDIR))
|
$(call DELDIR,$(BOOTLOADER_SRCDIR))
|
||||||
$(call DELFILE, $(BOOTLOADER_CONFIG))
|
$(call DELFILE,$(BOOTLOADER_CONFIG))
|
||||||
$(call DELFILE, $(TOPDIR)/bootloader-esp32.bin)
|
$(call DELFILE,$(TOPDIR)/bootloader-esp32.bin)
|
||||||
$(call DELFILE, $(TOPDIR)/partition-table-esp32.bin)
|
$(call DELFILE,$(TOPDIR)/partition-table-esp32.bin)
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -189,7 +164,7 @@ bootloader:
|
|||||||
$(Q) curl -L $(BOOTLOADER_URL)/mcuboot-esp32.bin -o $(TOPDIR)/mcuboot-esp32.bin
|
$(Q) curl -L $(BOOTLOADER_URL)/mcuboot-esp32.bin -o $(TOPDIR)/mcuboot-esp32.bin
|
||||||
|
|
||||||
clean_bootloader:
|
clean_bootloader:
|
||||||
$(call DELFILE, $(TOPDIR)/mcuboot-esp32.bin)
|
$(call DELFILE,$(TOPDIR)/mcuboot-esp32.bin)
|
||||||
|
|
||||||
else ifeq ($(CONFIG_ESP32_APP_FORMAT_LEGACY),y)
|
else ifeq ($(CONFIG_ESP32_APP_FORMAT_LEGACY),y)
|
||||||
|
|
||||||
@ -199,8 +174,8 @@ bootloader:
|
|||||||
$(Q) curl -L $(BOOTLOADER_URL)/partition-table-esp32.bin -o $(TOPDIR)/partition-table-esp32.bin
|
$(Q) curl -L $(BOOTLOADER_URL)/partition-table-esp32.bin -o $(TOPDIR)/partition-table-esp32.bin
|
||||||
|
|
||||||
clean_bootloader:
|
clean_bootloader:
|
||||||
$(call DELFILE, $(TOPDIR)/bootloader-esp32.bin)
|
$(call DELFILE,$(TOPDIR)/bootloader-esp32.bin)
|
||||||
$(call DELFILE, $(TOPDIR)/partition-table-esp32.bin)
|
$(call DELFILE,$(TOPDIR)/partition-table-esp32.bin)
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -119,6 +119,24 @@ YELLOW = \033[1;33m
|
|||||||
BOLD = \033[1m
|
BOLD = \033[1m
|
||||||
RST = \033[0m
|
RST = \033[0m
|
||||||
|
|
||||||
|
# Functions for printing help messages
|
||||||
|
|
||||||
|
define HELP_SIGN_APP
|
||||||
|
$(Q) echo ""
|
||||||
|
$(Q) echo "$(YELLOW)Application not signed. Sign the application before flashing.$(RST)"
|
||||||
|
$(Q) echo "To sign the application, you can use this command:"
|
||||||
|
$(Q) echo " imgtool sign -k $(ESPSEC_KEYDIR)/$(CONFIG_ESP32_SECURE_BOOT_APP_SIGNING_KEY) --public-key-format hash --pad $(VERIFIED) --align 4 -v 0 -s auto -H $(CONFIG_ESP32_APP_MCUBOOT_HEADER_SIZE) --pad-header -S $(CONFIG_ESP32_OTA_SLOT_SIZE) nuttx.hex nuttx.signed.bin"
|
||||||
|
$(Q) echo ""
|
||||||
|
endef
|
||||||
|
|
||||||
|
define HELP_FLASH_BOOTLOADER
|
||||||
|
$(Q) echo ""
|
||||||
|
$(Q) echo "$(YELLOW)Secure boot enabled, so bootloader not flashed automatically.$(RST)"
|
||||||
|
$(Q) echo "Use the following command to flash the bootloader:"
|
||||||
|
$(Q) echo " esptool.py $(ESPTOOL_OPTS) write_flash $(ESPTOOL_WRITEFLASH_OPTS) $(FLASH_BL)"
|
||||||
|
$(Q) echo ""
|
||||||
|
endef
|
||||||
|
|
||||||
# MERGEBIN -- Merge raw binary files into a single file
|
# MERGEBIN -- Merge raw binary files into a single file
|
||||||
|
|
||||||
define MERGEBIN
|
define MERGEBIN
|
||||||
@ -149,7 +167,6 @@ endef
|
|||||||
|
|
||||||
# SIGNBIN -- Create the signed binary image file for Secure Boot
|
# SIGNBIN -- Create the signed binary image file for Secure Boot
|
||||||
|
|
||||||
ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y)
|
|
||||||
define SIGNBIN
|
define SIGNBIN
|
||||||
$(Q) echo "SIGNBIN: ESP32 signed binary"
|
$(Q) echo "SIGNBIN: ESP32 signed binary"
|
||||||
$(Q) if ! imgtool version 1>/dev/null 2>&1; then \
|
$(Q) if ! imgtool version 1>/dev/null 2>&1; then \
|
||||||
@ -184,12 +201,16 @@ define SIGNBIN
|
|||||||
$(Q) echo nuttx.signed.bin >> nuttx.manifest
|
$(Q) echo nuttx.signed.bin >> nuttx.manifest
|
||||||
$(Q) echo "Generated: nuttx.signed.bin (MCUboot compatible)"
|
$(Q) echo "Generated: nuttx.signed.bin (MCUboot compatible)"
|
||||||
endef
|
endef
|
||||||
endif
|
|
||||||
|
|
||||||
# ELF2IMAGE -- Convert an ELF file into a compatible binary file
|
# MKIMAGE -- Convert an ELF file into a compatible binary file
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ESP32_SECURE_BOOT),y)
|
||||||
|
define MKIMAGE
|
||||||
|
$(if $(CONFIG_ESP32_SECURE_BOOT_BUILD_SIGNED_BINARIES),$(call SIGNBIN),$(call HELP_SIGN_APP))
|
||||||
|
endef
|
||||||
|
else
|
||||||
ifeq ($(CONFIG_ESP32_APP_FORMAT_LEGACY),y)
|
ifeq ($(CONFIG_ESP32_APP_FORMAT_LEGACY),y)
|
||||||
define ELF2IMAGE
|
define MKIMAGE
|
||||||
$(Q) echo "MKIMAGE: ESP32 binary"
|
$(Q) echo "MKIMAGE: ESP32 binary"
|
||||||
$(Q) if ! esptool.py version 1>/dev/null 2>&1; then \
|
$(Q) if ! esptool.py version 1>/dev/null 2>&1; then \
|
||||||
echo ""; \
|
echo ""; \
|
||||||
@ -205,14 +226,14 @@ define ELF2IMAGE
|
|||||||
esptool.py -c esp32 elf2image $(ESPTOOL_FLASH_OPTS) -o nuttx.bin nuttx
|
esptool.py -c esp32 elf2image $(ESPTOOL_FLASH_OPTS) -o nuttx.bin nuttx
|
||||||
$(Q) echo "Generated: nuttx.bin (ESP32 compatible)"
|
$(Q) echo "Generated: nuttx.bin (ESP32 compatible)"
|
||||||
endef
|
endef
|
||||||
else
|
else ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y)
|
||||||
define ELF2IMAGE
|
define MKIMAGE
|
||||||
$(Q) echo "MKIMAGE: ESP32 binary"
|
$(Q) echo "MKIMAGE: ESP32 binary"
|
||||||
$(Q) if ! imgtool version 1>/dev/null 2>&1; then \
|
$(Q) if ! imgtool version 1>/dev/null 2>&1; then \
|
||||||
echo ""; \
|
echo ""; \
|
||||||
echo "imgtool not found. Please run: \"pip install imgtool\""; \
|
echo "imgtool not found. Please run: \"pip install imgtool\""; \
|
||||||
echo ""; \
|
echo ""; \
|
||||||
echo "Run make again to create the nuttx.signed.bin image."; \
|
echo "Run make again to create the nuttx.bin image."; \
|
||||||
exit 1; \
|
exit 1; \
|
||||||
fi
|
fi
|
||||||
imgtool sign --pad $(VERIFIED) --align 4 -v 0 -s auto \
|
imgtool sign --pad $(VERIFIED) --align 4 -v 0 -s auto \
|
||||||
@ -222,42 +243,14 @@ define ELF2IMAGE
|
|||||||
$(Q) echo "Generated: nuttx.bin (MCUboot compatible)"
|
$(Q) echo "Generated: nuttx.bin (MCUboot compatible)"
|
||||||
endef
|
endef
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
define HELP_SIGN_APP
|
|
||||||
$(Q) echo ""
|
|
||||||
$(Q) echo "$(YELLOW)Application not signed. Sign the application before flashing.$(RST)"
|
|
||||||
$(Q) echo "To sign the application, you can use this command:"
|
|
||||||
$(Q) echo " imgtool sign -k $(ESPSEC_KEYDIR)/$(CONFIG_ESP32_SECURE_BOOT_APP_SIGNING_KEY) --public-key-format hash --pad $(VERIFIED) --align 4 -v 0 -s auto -H $(CONFIG_ESP32_APP_MCUBOOT_HEADER_SIZE) --pad-header -S $(CONFIG_ESP32_OTA_SLOT_SIZE) nuttx.hex nuttx.signed.bin"
|
|
||||||
$(Q) echo ""
|
|
||||||
endef
|
|
||||||
|
|
||||||
define HELP_FLASH_BOOTLOADER
|
|
||||||
$(Q) echo ""
|
|
||||||
$(Q) echo "$(YELLOW)Secure boot enabled, so bootloader not flashed automatically.$(RST)"
|
|
||||||
$(Q) echo "Use the following command to flash the bootloader:"
|
|
||||||
$(Q) echo " esptool.py $(ESPTOOL_OPTS) write_flash $(ESPTOOL_WRITEFLASH_OPTS) $(FLASH_BL)"
|
|
||||||
$(Q) echo ""
|
|
||||||
endef
|
|
||||||
|
|
||||||
# POSTBUILD -- Perform post build operations
|
# POSTBUILD -- Perform post build operations
|
||||||
|
|
||||||
ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y)
|
|
||||||
define POSTBUILD
|
define POSTBUILD
|
||||||
$(if $(CONFIG_ESP32_SECURE_BOOT), \
|
$(call MKIMAGE)
|
||||||
$(if $(CONFIG_ESP32_SECURE_BOOT_BUILD_SIGNED_BINARIES), \
|
|
||||||
$(call SIGNBIN), \
|
|
||||||
$(call HELP_SIGN_APP) \
|
|
||||||
), \
|
|
||||||
$(call ELF2IMAGE) \
|
|
||||||
)
|
|
||||||
$(if $(CONFIG_ESP32_MERGE_BINS),$(call MERGEBIN))
|
$(if $(CONFIG_ESP32_MERGE_BINS),$(call MERGEBIN))
|
||||||
endef
|
endef
|
||||||
else ifeq ($(CONFIG_ESP32_APP_FORMAT_LEGACY),y)
|
|
||||||
define POSTBUILD
|
|
||||||
$(call ELF2IMAGE)
|
|
||||||
$(if $(CONFIG_ESP32_MERGE_BINS),$(call MERGEBIN))
|
|
||||||
endef
|
|
||||||
endif
|
|
||||||
|
|
||||||
# ESPTOOL_BAUD -- Serial port baud rate used when flashing/reading via esptool.py
|
# ESPTOOL_BAUD -- Serial port baud rate used when flashing/reading via esptool.py
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user