Skip to content

Commit

Permalink
esp32s2: remove legacy bootloader support
Browse files Browse the repository at this point in the history
Deprecate Legacy Boot for ESP32-S2.

Signed-off-by: Almir Okato <almir.okato@espressif.com>
  • Loading branch information
almir-okato committed May 30, 2024
1 parent 6e9c825 commit 6090f42
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 345 deletions.
31 changes: 3 additions & 28 deletions arch/xtensa/src/esp32s2/Bootloader.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

.PHONY: bootloader clean_bootloader

ifeq ($(CONFIG_ESPRESSIF_SIMPLE_BOOT),)
ifeq ($(CONFIG_ESP32S2_APP_FORMAT_MCUBOOT),y)

TOOLSDIR = $(TOPDIR)/tools/espressif
CHIPDIR = $(TOPDIR)/arch/xtensa/src/chip
Expand Down Expand Up @@ -76,9 +76,6 @@ endif
$(if $(CONFIG_ESP32S2_FLASH_FREQ_40M),$(call cfg_en,CONFIG_ESPTOOLPY_FLASHFREQ_40M)) \
$(if $(CONFIG_ESP32S2_FLASH_FREQ_26M),$(call cfg_en,CONFIG_ESPTOOLPY_FLASHFREQ_26M)) \
$(if $(CONFIG_ESP32S2_FLASH_FREQ_20M),$(call cfg_en,CONFIG_ESPTOOLPY_FLASHFREQ_20M)) \
} > $(BOOTLOADER_CONFIG)
ifeq ($(CONFIG_ESP32S2_APP_FORMAT_MCUBOOT),y)
$(Q) { \
$(if $(CONFIG_ESP32S2_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_ESP32S2_SECURE_BOOT_APP_SIGNING_KEY))))) \
$(if $(CONFIG_ESP32S2_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)) \
$(if $(CONFIG_ESP32S2_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)) \
Expand Down Expand Up @@ -107,20 +104,14 @@ ifeq ($(CONFIG_ESP32S2_APP_FORMAT_MCUBOOT),y)
$(if $(CONFIG_UART0_SERIAL_CONSOLE),$(call cfg_val,CONFIG_ESP_CONSOLE_UART_NUM,0)) \
$(if $(CONFIG_UART1_SERIAL_CONSOLE),$(call cfg_val,CONFIG_ESP_CONSOLE_UART_NUM,1)) \
} >> $(BOOTLOADER_CONFIG)
else ifeq ($(CONFIG_ESP32S2_APP_FORMAT_LEGACY),y)
$(Q) { \
$(call cfg_en,CONFIG_PARTITION_TABLE_CUSTOM) \
$(call cfg_val,CONFIG_PARTITION_TABLE_CUSTOM_FILENAME,\"partitions.csv\") \
$(call cfg_val,CONFIG_PARTITION_TABLE_OFFSET,$(CONFIG_ESP32S2_PARTITION_TABLE_OFFSET)) \
} >> $(BOOTLOADER_CONFIG)
endif
endif

ifeq ($(CONFIG_ESPRESSIF_SIMPLE_BOOT),y)
bootloader:
$(Q) echo "Using direct bootloader to boot NuttX."

else ifeq ($(CONFIG_ESP32S2_APP_FORMAT_MCUBOOT),y)
else
# CONFIG_ESP32S2_APP_FORMAT_MCUBOOT

BOOTLOADER_BIN = $(TOPDIR)/mcuboot-esp32s2.bin
BOOTLOADER_SIGNED_BIN = $(TOPDIR)/mcuboot-esp32s2.signed.bin
Expand Down Expand Up @@ -169,20 +160,4 @@ clean_bootloader:
$(call DELFILE,$(BOOTLOADER_BIN))
$(if $(CONFIG_ESP32S2_SECURE_BOOT_BUILD_SIGNED_BINARIES),$(call DELFILE,$(BOOTLOADER_SIGNED_BIN)))

else ifeq ($(CONFIG_ESP32S2_APP_FORMAT_LEGACY),y)

$(BOOTLOADER_SRCDIR): $(BOOTLOADER_DIR)
$(Q) git clone $(BOOTLOADER_URL) $(BOOTLOADER_SRCDIR) -b $(BOOTLOADER_VERSION)

bootloader: $(BOOTLOADER_SRCDIR) $(BOOTLOADER_CONFIG)
$(Q) echo "Building Bootloader binaries"
$(Q) $(BOOTLOADER_SRCDIR)/build_idfboot.sh -c esp32s2 -s -f $(BOOTLOADER_CONFIG)
$(call COPYFILE,$(BOOTLOADER_SRCDIR)/$(BOOTLOADER_OUTDIR)/bootloader-esp32s2.bin,$(TOPDIR))
$(call COPYFILE,$(BOOTLOADER_SRCDIR)/$(BOOTLOADER_OUTDIR)/partition-table-esp32s2.bin,$(TOPDIR))

clean_bootloader:
$(call DELDIR,$(BOOTLOADER_DIR))
$(call DELFILE,$(TOPDIR)/bootloader-esp32s2.bin)
$(call DELFILE,$(TOPDIR)/partition-table-esp32s2.bin)

endif
38 changes: 0 additions & 38 deletions arch/xtensa/src/esp32s2/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1225,16 +1225,8 @@ menu "Bootloader and Image Configuration"
config ESPRESSIF_SIMPLE_BOOT
bool
depends on !ESP32S2_APP_FORMAT_MCUBOOT
depends on !ESP32S2_APP_FORMAT_LEGACY
default y

config ESP32S2_APP_FORMAT_LEGACY
bool "Enable Legacy boot format"
depends on !ESP32S2_APP_FORMAT_MCUBOOT
---help---
This is the legacy application image format, as supported by the ESP-IDF
2nd stage bootloader.

config ESP32S2_APP_FORMAT_MCUBOOT
bool "Enable MCUboot-bootable format"
depends on !MCUBOOT_BOOTLOADER
Expand Down Expand Up @@ -1278,36 +1270,6 @@ config ESP32S2_APP_MCUBOOT_HEADER_SIZE
default 32
depends on ESP32S2_APP_FORMAT_MCUBOOT

config ESP32S2_PARTITION_TABLE_OFFSET_DEFAULT
hex
default 0x8000
depends on ESP32S2_APP_FORMAT_LEGACY

config ESP32S2_CUSTOM_PARTITION_TABLE_OFFSET
bool "Customize partition table offset"
default n
depends on ESP32S2_APP_FORMAT_LEGACY
---help---
Enable to select the offset of the partition table in the flash.

if ESP32S2_CUSTOM_PARTITION_TABLE_OFFSET

config ESP32S2_PARTITION_TABLE_OFFSET
hex "Partition Table offset"
default ESP32S2_PARTITION_TABLE_OFFSET_DEFAULT
depends on ESP32S2_APP_FORMAT_LEGACY

endif # ESP32S2_CUSTOM_PARTITION_TABLE_OFFSET

if !ESP32S2_CUSTOM_PARTITION_TABLE_OFFSET

config ESP32S2_PARTITION_TABLE_OFFSET
hex
default ESP32S2_PARTITION_TABLE_OFFSET_DEFAULT
depends on ESP32S2_APP_FORMAT_LEGACY

endif # !ESP32S2_CUSTOM_PARTITION_TABLE_OFFSET

source "arch/xtensa/src/esp32s2/Kconfig.security"

endmenu # Bootloader and Image Configuration
Expand Down
6 changes: 1 addition & 5 deletions arch/xtensa/src/esp32s2/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ HEAD_CSRC = esp32s2_start.c esp32s2_wdt.c
CHIP_CSRCS = esp32s2_allocateheap.c esp32s2_clockconfig.c esp32s2_irq.c
CHIP_CSRCS += esp32s2_gpio.c esp32s2_rtc_gpio.c esp32s2_region.c esp32s2_user.c
CHIP_CSRCS += esp32s2_timerisr.c esp32s2_lowputc.c esp32s2_systemreset.c
CHIP_CSRCS += esp32s2_dma.c esp32s2_libc_stubs.c
CHIP_CSRCS += esp32s2_dma.c esp32s2_libc_stubs.c loader.c

# Configuration-dependent ESP32-S2 files

Expand Down Expand Up @@ -143,10 +143,6 @@ ifeq ($(CONFIG_RTC_DRIVER),y)
CHIP_CSRCS += esp32s2_rtc_lowerhalf.c
endif

ifeq ($(ESP32S2_APP_FORMAT_LEGACY), )
CHIP_CSRCS += loader.c
endif

#############################################################################
# Espressif HAL for 3rd Party Platforms
#############################################################################
Expand Down
235 changes: 0 additions & 235 deletions boards/xtensa/esp32s2/common/scripts/legacy_sections.ld

This file was deleted.

2 changes: 0 additions & 2 deletions boards/xtensa/esp32s2/esp32s2-kaluga-1/scripts/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ ifeq ($(CONFIG_ESP32S2_APP_FORMAT_MCUBOOT),y)
ARCHSCRIPT += $(call FINDSCRIPT,mcuboot_sections.ld)
else ifeq ($(CONFIG_ESPRESSIF_SIMPLE_BOOT),y)
ARCHSCRIPT += $(call FINDSCRIPT,simple_boot_sections.ld)
else
ARCHSCRIPT += $(call FINDSCRIPT,legacy_sections.ld)
endif

ARCHPICFLAGS = -fpic
Expand Down
2 changes: 0 additions & 2 deletions boards/xtensa/esp32s2/esp32s2-saola-1/scripts/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ ifeq ($(CONFIG_ESP32S2_APP_FORMAT_MCUBOOT),y)
ARCHSCRIPT += $(call FINDSCRIPT,mcuboot_sections.ld)
else ifeq ($(CONFIG_ESPRESSIF_SIMPLE_BOOT),y)
ARCHSCRIPT += $(call FINDSCRIPT,simple_boot_sections.ld)
else
ARCHSCRIPT += $(call FINDSCRIPT,legacy_sections.ld)
endif

ARCHPICFLAGS = -fpic
Expand Down
2 changes: 0 additions & 2 deletions boards/xtensa/esp32s2/franzininho-wifi/scripts/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ ifeq ($(CONFIG_ESP32S2_APP_FORMAT_MCUBOOT),y)
ARCHSCRIPT += $(call FINDSCRIPT,mcuboot_sections.ld)
else ifeq ($(CONFIG_ESPRESSIF_SIMPLE_BOOT),y)
ARCHSCRIPT += $(call FINDSCRIPT,simple_boot_sections.ld)
else
ARCHSCRIPT += $(call FINDSCRIPT,legacy_sections.ld)
endif

ARCHPICFLAGS = -fpic
Expand Down
Loading

0 comments on commit 6090f42

Please sign in to comment.