esp32c3: Improve selection of the bootloader being used on Kconfig
- A pre-built IDF bootloader is used by default; - `ESP32C3_PARTITION_TABLE` requires the IDF bootloader to be built from sources. - Native MCUboot also can be used to boot the device. It will be built from sources and depends on !ESP32C3_PARTITION_TABLE.
This commit is contained in:
parent
641a0df27f
commit
a2673d3bcd
@ -109,12 +109,12 @@ ifeq ($(CONFIG_ESP32C3_APP_FORMAT_MCUBOOT),y)
|
|||||||
BOOTLOADER_BIN = $(TOPDIR)/mcuboot-esp32c3.bin
|
BOOTLOADER_BIN = $(TOPDIR)/mcuboot-esp32c3.bin
|
||||||
BOOTLOADER_SIGNED_BIN = $(TOPDIR)/mcuboot-esp32c3.signed.bin
|
BOOTLOADER_SIGNED_BIN = $(TOPDIR)/mcuboot-esp32c3.signed.bin
|
||||||
|
|
||||||
$(BOOTLOADER_BIN): $(BOOTLOADER_CONFIG)
|
$(BOOTLOADER_BIN): $(BOOTLOADER_SRCDIR) $(BOOTLOADER_CONFIG)
|
||||||
$(Q) echo "Building Bootloader"
|
$(Q) echo "Building Bootloader"
|
||||||
$(Q) $(BOOTLOADER_SRCDIR)/build_mcuboot.sh -c esp32c3 -s -f $(BOOTLOADER_CONFIG)
|
$(Q) $(BOOTLOADER_SRCDIR)/build_mcuboot.sh -c esp32c3 -s -f $(BOOTLOADER_CONFIG)
|
||||||
$(call COPYFILE, $(BOOTLOADER_SRCDIR)/$(BOOTLOADER_OUTDIR)/mcuboot-esp32c3.bin, $(TOPDIR))
|
$(call COPYFILE, $(BOOTLOADER_SRCDIR)/$(BOOTLOADER_OUTDIR)/mcuboot-esp32c3.bin, $(TOPDIR))
|
||||||
|
|
||||||
bootloader: $(BOOTLOADER_CONFIG) $(BOOTLOADER_SRCDIR) $(BOOTLOADER_BIN)
|
bootloader: $(BOOTLOADER_CONFIG) $(BOOTLOADER_BIN)
|
||||||
ifeq ($(CONFIG_ESP32C3_SECURE_BOOT),y)
|
ifeq ($(CONFIG_ESP32C3_SECURE_BOOT),y)
|
||||||
$(eval KEYDIR := $(TOPDIR)/$(ESPSEC_KEYDIR))
|
$(eval KEYDIR := $(TOPDIR)/$(ESPSEC_KEYDIR))
|
||||||
$(eval BOOTLOADER_SIGN_KEY := $(abspath $(KEYDIR)/$(subst ",,$(CONFIG_ESP32C3_SECURE_BOOT_BOOTLOADER_SIGNING_KEY))))
|
$(eval BOOTLOADER_SIGN_KEY := $(abspath $(KEYDIR)/$(subst ",,$(CONFIG_ESP32C3_SECURE_BOOT_BOOTLOADER_SIGNING_KEY))))
|
||||||
@ -165,15 +165,7 @@ else ifeq ($(CONFIG_ESP32C3_BOOTLOADER_DOWNLOAD_PREBUILT),y)
|
|||||||
BOOTLOADER_VERSION = latest
|
BOOTLOADER_VERSION = latest
|
||||||
BOOTLOADER_URL = https://github.com/espressif/esp-nuttx-bootloader/releases/download/$(BOOTLOADER_VERSION)
|
BOOTLOADER_URL = https://github.com/espressif/esp-nuttx-bootloader/releases/download/$(BOOTLOADER_VERSION)
|
||||||
|
|
||||||
ifeq ($(CONFIG_ESP32C3_APP_FORMAT_MCUBOOT),y)
|
ifeq ($(CONFIG_ESP32C3_APP_FORMAT_LEGACY),y)
|
||||||
|
|
||||||
bootloader:
|
|
||||||
$(call DOWNLOAD,$(BOOTLOADER_URL),mcuboot-esp32c3.bin,$(TOPDIR)/mcuboot-esp32c3.bin)
|
|
||||||
|
|
||||||
clean_bootloader:
|
|
||||||
$(call DELFILE,$(TOPDIR)/mcuboot-esp32c3.bin)
|
|
||||||
|
|
||||||
else ifeq ($(CONFIG_ESP32C3_APP_FORMAT_LEGACY),y)
|
|
||||||
|
|
||||||
bootloader:
|
bootloader:
|
||||||
$(call DOWNLOAD,$(BOOTLOADER_URL),bootloader-esp32c3.bin,$(TOPDIR)/bootloader-esp32c3.bin)
|
$(call DOWNLOAD,$(BOOTLOADER_URL),bootloader-esp32c3.bin,$(TOPDIR)/bootloader-esp32c3.bin)
|
||||||
|
@ -994,6 +994,7 @@ comment "Partition Table configuration"
|
|||||||
config ESP32C3_PARTITION_TABLE
|
config ESP32C3_PARTITION_TABLE
|
||||||
bool "Create MTD partitions from Partition Table"
|
bool "Create MTD partitions from Partition Table"
|
||||||
default n
|
default n
|
||||||
|
select ESP32C3_BOOTLOADER_BUILD_FROM_SOURCE
|
||||||
---help---
|
---help---
|
||||||
Decode partition table and initialize partitions as MTD.
|
Decode partition table and initialize partitions as MTD.
|
||||||
|
|
||||||
@ -1032,42 +1033,28 @@ config ESP32C3_HAVE_OTA_PARTITION
|
|||||||
bool
|
bool
|
||||||
default n
|
default n
|
||||||
|
|
||||||
menu "Application Image Configuration"
|
menu "Bootloader and Image Configuration"
|
||||||
|
|
||||||
choice
|
|
||||||
prompt "Application Image Format"
|
|
||||||
default ESP32C3_APP_FORMAT_LEGACY
|
|
||||||
---help---
|
|
||||||
Depending on the chosen 2nd stage bootloader, the application may
|
|
||||||
be required to be perform a specific startup routine. Furthermore,
|
|
||||||
the image binary must be formatted according to the definition from
|
|
||||||
the 2nd stage bootloader.
|
|
||||||
|
|
||||||
config ESP32C3_APP_FORMAT_LEGACY
|
config ESP32C3_APP_FORMAT_LEGACY
|
||||||
bool "Legacy format"
|
bool
|
||||||
|
default y if !ESP32C3_APP_FORMAT_MCUBOOT
|
||||||
|
depends on !ESP32C3_APP_FORMAT_MCUBOOT
|
||||||
---help---
|
---help---
|
||||||
This is the legacy application image format, as supported by the ESP-IDF
|
This is the legacy application image format, as supported by the ESP-IDF
|
||||||
2nd stage bootloader.
|
2nd stage bootloader.
|
||||||
|
|
||||||
config ESP32C3_APP_FORMAT_MCUBOOT
|
config ESP32C3_APP_FORMAT_MCUBOOT
|
||||||
bool "MCUboot-bootable format"
|
bool "Enable MCUboot-bootable format"
|
||||||
depends on !MCUBOOT_BOOTLOADER
|
depends on !MCUBOOT_BOOTLOADER
|
||||||
select ESP32C3_HAVE_OTA_PARTITION
|
select ESP32C3_HAVE_OTA_PARTITION
|
||||||
|
select ESP32C3_BOOTLOADER_BUILD_FROM_SOURCE
|
||||||
---help---
|
---help---
|
||||||
The Espressif port of MCUboot supports the loading of unsegmented firmware
|
Enables the Espressif port of MCUboot to be used as 2nd stage bootloader.
|
||||||
images.
|
|
||||||
|
|
||||||
endchoice # Application Image Format
|
|
||||||
|
|
||||||
choice
|
|
||||||
prompt "Source for bootloader binaries"
|
|
||||||
default ESP32C3_BOOTLOADER_DOWNLOAD_PREBUILT
|
|
||||||
---help---
|
|
||||||
Select the action to be taken by the build system for the
|
|
||||||
"make bootloader" target.
|
|
||||||
|
|
||||||
config ESP32C3_BOOTLOADER_DOWNLOAD_PREBUILT
|
config ESP32C3_BOOTLOADER_DOWNLOAD_PREBUILT
|
||||||
bool "Download prebuilt binaries"
|
bool
|
||||||
|
default y if !ESP32C3_BOOTLOADER_BUILD_FROM_SOURCE
|
||||||
|
depends on !ESP32C3_BOOTLOADER_BUILD_FROM_SOURCE
|
||||||
---help---
|
---help---
|
||||||
The build system will download the prebuilt binaries from
|
The build system will download the prebuilt binaries from
|
||||||
https://github.com/espressif/esp-nuttx-bootloader according to the chosen
|
https://github.com/espressif/esp-nuttx-bootloader according to the chosen
|
||||||
@ -1081,8 +1068,6 @@ config ESP32C3_BOOTLOADER_BUILD_FROM_SOURCE
|
|||||||
custom bootloader according to the chosen Application Image Format
|
custom bootloader according to the chosen Application Image Format
|
||||||
(ESP32C3_APP_FORMAT_LEGACY or ESP32C3_APP_FORMAT_MCUBOOT) and partition information.
|
(ESP32C3_APP_FORMAT_LEGACY or ESP32C3_APP_FORMAT_MCUBOOT) and partition information.
|
||||||
|
|
||||||
endchoice
|
|
||||||
|
|
||||||
choice
|
choice
|
||||||
prompt "Target slot for image flashing"
|
prompt "Target slot for image flashing"
|
||||||
default ESP32C3_ESPTOOL_TARGET_PRIMARY
|
default ESP32C3_ESPTOOL_TARGET_PRIMARY
|
||||||
@ -1113,11 +1098,37 @@ config ESP32C3_APP_MCUBOOT_HEADER_SIZE
|
|||||||
default 32
|
default 32
|
||||||
depends on ESP32C3_APP_FORMAT_MCUBOOT
|
depends on ESP32C3_APP_FORMAT_MCUBOOT
|
||||||
|
|
||||||
config ESP32C3_PARTITION_TABLE_OFFSET
|
config ESP32C3_PARTITION_TABLE_OFFSET_DEFAULT
|
||||||
hex "Partition Table offset"
|
hex
|
||||||
default 0x8000
|
default 0x8000
|
||||||
depends on ESP32C3_APP_FORMAT_LEGACY
|
depends on ESP32C3_APP_FORMAT_LEGACY
|
||||||
|
|
||||||
|
config ESP32C3_CUSTOM_PARTITION_TABLE_OFFSET
|
||||||
|
bool "Customize partition table offset"
|
||||||
|
default n
|
||||||
|
depends on ESP32C3_APP_FORMAT_LEGACY
|
||||||
|
select ESP32C3_BOOTLOADER_BUILD_FROM_SOURCE
|
||||||
|
---help---
|
||||||
|
Enable to select the offset of the partition table in the flash.
|
||||||
|
|
||||||
|
if ESP32C3_CUSTOM_PARTITION_TABLE_OFFSET
|
||||||
|
|
||||||
|
config ESP32C3_PARTITION_TABLE_OFFSET
|
||||||
|
hex "Partition Table offset"
|
||||||
|
default ESP32C3_PARTITION_TABLE_OFFSET_DEFAULT
|
||||||
|
depends on ESP32C3_APP_FORMAT_LEGACY
|
||||||
|
|
||||||
|
endif # ESP32C3_CUSTOM_PARTITION_TABLE_OFFSET
|
||||||
|
|
||||||
|
if !ESP32C3_CUSTOM_PARTITION_TABLE_OFFSET
|
||||||
|
|
||||||
|
config ESP32C3_PARTITION_TABLE_OFFSET
|
||||||
|
hex
|
||||||
|
default ESP32C3_PARTITION_TABLE_OFFSET_DEFAULT
|
||||||
|
depends on ESP32C3_APP_FORMAT_LEGACY
|
||||||
|
|
||||||
|
endif # !ESP32C3_CUSTOM_PARTITION_TABLE_OFFSET
|
||||||
|
|
||||||
if BUILD_PROTECTED
|
if BUILD_PROTECTED
|
||||||
|
|
||||||
config ESP32C3_USER_IMAGE_OFFSET
|
config ESP32C3_USER_IMAGE_OFFSET
|
||||||
|
Loading…
Reference in New Issue
Block a user